lemon/lp_soplex.h
changeset 482 ed54c0d13df0
parent 481 7afc121e0689
equal deleted inserted replaced
0:ccb3ec1be7aa 1:2e86ad92ff30
    41   /// This class implements an interface for the SoPlex LP solver.
    41   /// This class implements an interface for the SoPlex LP solver.
    42   /// The SoPlex library is an object oriented lp solver library
    42   /// The SoPlex library is an object oriented lp solver library
    43   /// developed at the Konrad-Zuse-Zentrum für Informationstechnik
    43   /// developed at the Konrad-Zuse-Zentrum für Informationstechnik
    44   /// Berlin (ZIB). You can find detailed information about it at the
    44   /// Berlin (ZIB). You can find detailed information about it at the
    45   /// <tt>http://soplex.zib.de</tt> address.
    45   /// <tt>http://soplex.zib.de</tt> address.
    46   class LpSoplex :virtual public LpSolverBase {
    46   class LpSoplex : public LpSolver {
    47   protected:
    47   private:
    48 
       
    49     _lp_bits::RelocateIdHandler relocateIdHandler;
       
    50 
    48 
    51     soplex::SoPlex* soplex;
    49     soplex::SoPlex* soplex;
    52     bool solved;
       
    53 
    50 
    54     std::vector<std::string> colNames;
    51     std::vector<std::string> _col_names;
    55     std::map<std::string, int> invColNames;
    52     std::map<std::string, int> _col_names_ref;
    56 
    53 
    57     std::vector<Value> primal_value;
    54     std::vector<std::string> _row_names;
    58     std::vector<Value> dual_value;
    55     std::map<std::string, int> _row_names_ref;
    59 
    56 
       
    57   private:
       
    58 
       
    59     // these values cannot be retrieved element by element
       
    60     mutable std::vector<Value> _primal_values;
       
    61     mutable std::vector<Value> _dual_values;
       
    62 
       
    63     mutable std::vector<Value> _primal_ray;
       
    64     mutable std::vector<Value> _dual_ray;
       
    65 
       
    66     void _clear_temporals();
    60 
    67 
    61   public:
    68   public:
    62 
       
    63     typedef LpSolverBase Parent;
       
    64 
       
    65 
    69 
    66     /// \e
    70     /// \e
    67     LpSoplex();
    71     LpSoplex();
    68     /// \e
    72     /// \e
    69     LpSoplex(const LpSoplex&);
    73     LpSoplex(const LpSoplex&);
    70     /// \e
    74     /// \e
    71     ~LpSoplex();
    75     ~LpSoplex();
    72 
    76 
    73   protected:
    77   protected:
    74 
    78 
    75     virtual LpSolverBase* _newLp();
    79     virtual LpSoplex* _newSolver() const;
    76     virtual LpSolverBase* _copyLp();
    80     virtual LpSoplex* _cloneSolver() const;
       
    81 
       
    82     virtual const char* _solverName() const;
    77 
    83 
    78     virtual int _addCol();
    84     virtual int _addCol();
    79     virtual int _addRow();
    85     virtual int _addRow();
       
    86 
    80     virtual void _eraseCol(int i);
    87     virtual void _eraseCol(int i);
    81     virtual void _eraseRow(int i);
    88     virtual void _eraseRow(int i);
    82     virtual void _getColName(int col, std::string & name) const;
    89 
    83     virtual void _setColName(int col, const std::string & name);
    90     virtual void _eraseColId(int i);
       
    91     virtual void _eraseRowId(int i);
       
    92 
       
    93     virtual void _getColName(int col, std::string& name) const;
       
    94     virtual void _setColName(int col, const std::string& name);
    84     virtual int _colByName(const std::string& name) const;
    95     virtual int _colByName(const std::string& name) const;
    85     virtual void _setRowCoeffs(int i, ConstRowIterator b, ConstRowIterator e);
    96 
    86     virtual void _getRowCoeffs(int i, RowIterator b) const;
    97     virtual void _getRowName(int row, std::string& name) const;
    87     virtual void _setColCoeffs(int i, ConstColIterator b, ConstColIterator e);
    98     virtual void _setRowName(int row, const std::string& name);
    88     virtual void _getColCoeffs(int i, ColIterator b) const;
    99     virtual int _rowByName(const std::string& name) const;
       
   100 
       
   101     virtual void _setRowCoeffs(int i, ExprIterator b, ExprIterator e);
       
   102     virtual void _getRowCoeffs(int i, InsertIterator b) const;
       
   103 
       
   104     virtual void _setColCoeffs(int i, ExprIterator b, ExprIterator e);
       
   105     virtual void _getColCoeffs(int i, InsertIterator b) const;
       
   106 
    89     virtual void _setCoeff(int row, int col, Value value);
   107     virtual void _setCoeff(int row, int col, Value value);
    90     virtual Value _getCoeff(int row, int col) const;
   108     virtual Value _getCoeff(int row, int col) const;
       
   109 
    91     virtual void _setColLowerBound(int i, Value value);
   110     virtual void _setColLowerBound(int i, Value value);
    92     virtual Value _getColLowerBound(int i) const;
   111     virtual Value _getColLowerBound(int i) const;
    93     virtual void _setColUpperBound(int i, Value value);
   112     virtual void _setColUpperBound(int i, Value value);
    94     virtual Value _getColUpperBound(int i) const;
   113     virtual Value _getColUpperBound(int i) const;
    95     virtual void _setRowBounds(int i, Value lower, Value upper);
   114 
    96     virtual void _getRowBounds(int i, Value &lower, Value &upper) const;
   115     virtual void _setRowLowerBound(int i, Value value);
       
   116     virtual Value _getRowLowerBound(int i) const;
       
   117     virtual void _setRowUpperBound(int i, Value value);
       
   118     virtual Value _getRowUpperBound(int i) const;
       
   119 
       
   120     virtual void _setObjCoeffs(ExprIterator b, ExprIterator e);
       
   121     virtual void _getObjCoeffs(InsertIterator b) const;
       
   122 
    97     virtual void _setObjCoeff(int i, Value obj_coef);
   123     virtual void _setObjCoeff(int i, Value obj_coef);
    98     virtual Value _getObjCoeff(int i) const;
   124     virtual Value _getObjCoeff(int i) const;
    99     virtual void _clearObj();
   125 
       
   126     virtual void _setSense(Sense sense);
       
   127     virtual Sense _getSense() const;
   100 
   128 
   101     virtual SolveExitStatus _solve();
   129     virtual SolveExitStatus _solve();
   102     virtual Value _getPrimal(int i) const;
   130     virtual Value _getPrimal(int i) const;
   103     virtual Value _getDual(int i) const;
   131     virtual Value _getDual(int i) const;
       
   132 
   104     virtual Value _getPrimalValue() const;
   133     virtual Value _getPrimalValue() const;
   105     virtual bool _isBasicCol(int i) const;
       
   106 
   134 
   107     virtual SolutionStatus _getPrimalStatus() const;
   135     virtual Value _getPrimalRay(int i) const;
   108     virtual SolutionStatus _getDualStatus() const;
   136     virtual Value _getDualRay(int i) const;
   109     virtual ProblemTypes _getProblemType() const;
       
   110 
   137 
       
   138     virtual VarStatus _getColStatus(int i) const;
       
   139     virtual VarStatus _getRowStatus(int i) const;
   111 
   140 
   112     virtual void _setMax();
   141     virtual ProblemType _getPrimalType() const;
   113     virtual void _setMin();
   142     virtual ProblemType _getDualType() const;
   114     virtual bool _isMax() const;
   143 
       
   144     virtual void _clear();
   115 
   145 
   116   };
   146   };
       
   147 
   117 } //END OF NAMESPACE LEMON
   148 } //END OF NAMESPACE LEMON
   118 
   149 
   119 #endif //LEMON_LP_SOPLEX_H
   150 #endif //LEMON_LP_SOPLEX_H
   120 
   151