All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
spxlpbase.h
Go to the documentation of this file.
22 /* undefine SOPLEX_DEBUG flag from including files; if SOPLEX_DEBUG should be defined in this file, do so below */
67 * Note, that the optimization sense is not saved directly. Instead, the objective function are multiplied by -1 to
68 * transform the LP to our standard form maximizing the objective function. However, the sense of the loaded LP can be
71 * Further, equality constraints are modelled by \f$l_r = u_r\f$. Analogously, fixed variables have \f$l_c = u_c\f$.
73 * #SPxLPBase%s are saved as an SVSet, both for columns and rows. Note that this is redundant but eases the access.
87 // ------------------------------------------------------------------------------------------------------------------
102 // ------------------------------------------------------------------------------------------------------------------
122 // ------------------------------------------------------------------------------------------------------------------
380 /** Methods #maxObj() return the objective vector or its elements, after transformation to a maximization
381 * problem. Since this is how SPxLPBase internally stores any LP these methods are generally faster. The following
483 // ------------------------------------------------------------------------------------------------------------------
501 void addRow(const S* lhsValue, const S* rowValues, const int* rowIndices, int rowSize, const S* rhsValue)
550 void addRows(const S* lhsValues, const S* rowValues, const int* rowIndices, const int* rowStarts, const int* rowLengths, const int numRows, const int numValues, const S* rhsValues)
572 LPRowSetBase<R>::add(&(lhsValues[i]), &(rowValues[rowStarts[i]]), &(rowIndices[rowStarts[i]]), rowLengths[i], &(rhsValues[i]));
603 /* preset the sizes: beware that this can irritate a consistency check call from xtend(). We need to set the
604 * sizes here, because a possible garbage collection called from xtend might destroy the sizes again. */
656 virtual void addCol(const R& objValue, const R& lowerValue, const SVectorBase<R>& colVec, const R& upperValue)
663 void addCol(const S* objValue, const S* lowerValue, const S* colValues, const int* colIndices, int colSize, const S* upperValue)
709 void addCols(const S* objValue, const S* lowerValues, const S* colValues, const int* colIndices, const int* colStarts, const int* colLengths, const int numCols, const int numValues, const S* upperValues)
732 LPColSetBase<R>::add(&(objValue[i]), &(lowerValues[i]), &(colValues[colStarts[i]]), &(colIndices[colStarts[i]]), colLengths[i], &(upperValues[i]));
760 /* preset the sizes: beware that this can irritate a consistency check call from xtend(). We need to set the
761 * sizes here, because a possible garbage collection called from xtend might destroy the sizes again. */
808 // ------------------------------------------------------------------------------------------------------------------
828 /** This method removes all LPRowBase%s from the SPxLPBase with an index \p i such that \p perm[i] < 0. Upon
829 * completion, \p perm[i] >= 0 indicates the new index where the \p i'th LPRow has been moved to due to this
858 /** Removing multiple rows with one method invocation is available in two flavours. An array \p perm can be passed as
859 * third argument or not. If given, \p perm must be an array at least of size #nRows(). It is used to return the
860 * permutations resulting from this removal: \p perm[i] < 0 indicates, that the element to index \p i has been
861 * removed. Otherwise, \p perm[i] is the new index of the element with index \p i before the removal.
925 /** This method removes all LPColBase%s from the SPxLPBase with an index \p i such that \p perm[i] < 0. Upon
926 * completion, \p perm[i] >= 0 indicates the new index where the \p i 'th LPColBase has been moved to due to this
955 /** Removing multiple columns with one method invocation is available in two flavours. An array \p perm can be passed
956 * as third argument or not. If given, \p perm must be an array at least of size #nCols(). It is used to return the
957 * permutations resulting from this removal: \p perm[i] < 0 indicates, that the element to index \p i has been
958 * removed. Otherwise, \p perm[i] is the new index of the element with index \p i before the removal.
1018 // ------------------------------------------------------------------------------------------------------------------
1023 virtual bool readLPF(std::istream& in, NameSet* rowNames = 0, NameSet* colNames = 0, DIdxSet* intVars = 0);
1026 virtual bool readMPS(std::istream& in, NameSet* rowNames = 0, NameSet* colNames = 0, DIdxSet* intVars = 0);
1030 * @param rowNames contains after the call the names of the constraints (rows) in the same order as the rows in the
1031 * LP. Constraints without a name (only possible with LPF files) are automatically assigned a name.
1033 * @param colNames contains after the call the names of the variables (columns) in the same order as the columns in
1035 * @param intVars contains after the call the indices of those variables that where marked as beeing integer in the
1039 virtual bool read(std::istream& in, NameSet* rowNames = 0, NameSet* colNames = 0, DIdxSet* intVars = 0)
1047 /* MPS starts either with a comment mark '*' or with the keyword 'NAME' at the first column. LPF starts either
1048 * with blanks, a comment mark '\' or with the keyword "MAX" or "MIN" in upper or lower case. There is no
1059 virtual bool readFile(const char* filename, NameSet* rowNames = 0, NameSet* colNames = 0, DIdxSet* intVars = 0)
1070 /** Writes a file in LP format to \p out. If \p rowNames and \p colNames are \c NULL, default names are used for the
1071 * constraints and variables. If \p intVars is not \c NULL, the variables contained in it are marked as integer in
1074 virtual void writeLPF(std::ostream& out, const NameSet* rowNames, const NameSet* colNames, const DIdxSet* p_intvars = 0) const;
1077 virtual void writeMPS(std::ostream& out, const NameSet* rowNames, const NameSet* colNames, const DIdxSet* p_intvars = 0) const;
1080 virtual void writeFile(const char* filename, const NameSet* rowNames = 0, const NameSet* colNames = 0, const DIdxSet* p_intvars = 0) const
1086 if( len_f > 4 && filename[len_f-1] == 's' && filename[len_f-2] == 'p' && filename[len_f-3] == 'm' && filename[len_f-4] == '.' )
1177 // ------------------------------------------------------------------------------------------------------------------
1617 /// @throw SPxInternalCodeException if the dimension of primal vector does not match number of columns or if the
1623 throw SPxInternalCodeException("XSPXLP01 Primal vector for computing row activity has wrong dimension");
1628 throw SPxInternalCodeException("XSPXLP03 Activity vector computing row activity has wrong dimension");
1653 /// @throw SPxInternalCodeException if the dimension of primal vector does not match number of columns or if the
1659 throw SPxInternalCodeException("XSPXLP03 Activity vector computing row activity has wrong dimension");
1670 /// Computes "dual" activity of the columns for a given dual vector, i.e., y^T A; activity does not need to be zero
1671 /// @throw SPxInternalCodeException if dimension of dual vector does not match number of rows or if the dimension of
1677 throw SPxInternalCodeException("XSPXLP02 Dual vector for computing dual activity has wrong dimension");
1682 throw SPxInternalCodeException("XSPXLP04 Activity vector computing dual activity has wrong dimension");
1706 /// Updates "dual" activity of the columns for a given dual vector, i.e., y^T A; activity does not need to be zero
1707 /// @throw SPxInternalCodeException if dimension of dual vector does not match number of rows or if the dimension of
1713 throw SPxInternalCodeException("XSPXLP04 Activity vector computing dual activity has wrong dimension");
1724 /// Updates "dual" activity of the columns for a given dual vector, i.e., y^T A; activity does not need to be zero
1725 /// @throw SPxInternalCodeException if dimension of dual vector does not match number of rows or if the dimension of
1731 throw SPxInternalCodeException("XSPXLP02 Dual vector for computing dual activity has wrong dimension");
1736 throw SPxInternalCodeException("XSPXLP04 Activity vector computing dual activity has wrong dimension");
1748 // ------------------------------------------------------------------------------------------------------------------
1801 // ------------------------------------------------------------------------------------------------------------------
1843 // ------------------------------------------------------------------------------------------------------------------
2025 // ------------------------------------------------------------------------------------------------------------------
2154 /* preset the sizes: beware that this can irritate a consistency check call from xtend(). We need to set the
2155 * sizes here, because a possible garbage collection called from xtend might destroy the sizes again. */
2225 void doAddCol (const R& objValue, const R& lowerValue, const SVectorBase<R>& colVec, const R& upperValue)
2345 // ------------------------------------------------------------------------------------------------------------------
2377 , thesense(old.thesense == SPxLPBase<S>::MINIMIZE ? SPxLPBase<R>::MINIMIZE : SPxLPBase<R>::MAXIMIZE)
2408 thesense = (old.thesense) == SPxLPBase<S>::MINIMIZE ? SPxLPBase<R>::MINIMIZE : SPxLPBase<R>::MAXIMIZE;
|