lemon/lp_base.h
changeset 2324 18fc834761d9
parent 2312 07e46cbb7d85
child 2328 b4931ae52069
equal deleted inserted replaced
39:d9b7247ed0f9 40:9f95caf95b13
   701     virtual void _getColName(int col, std::string & name) = 0;
   701     virtual void _getColName(int col, std::string & name) = 0;
   702     virtual void _setColName(int col, const std::string & name) = 0;
   702     virtual void _setColName(int col, const std::string & name) = 0;
   703     virtual void _setRowCoeffs(int i, LpRowIterator b, LpRowIterator e) = 0;
   703     virtual void _setRowCoeffs(int i, LpRowIterator b, LpRowIterator e) = 0;
   704     virtual void _setColCoeffs(int i, LpColIterator b, LpColIterator e) = 0;
   704     virtual void _setColCoeffs(int i, LpColIterator b, LpColIterator e) = 0;
   705     virtual void _setCoeff(int row, int col, Value value) = 0;
   705     virtual void _setCoeff(int row, int col, Value value) = 0;
       
   706     virtual Value _getCoeff(int row, int col) = 0;
       
   707 
   706     virtual void _setColLowerBound(int i, Value value) = 0;
   708     virtual void _setColLowerBound(int i, Value value) = 0;
   707     virtual void _setColUpperBound(int i, Value value) = 0;
   709     virtual void _setColUpperBound(int i, Value value) = 0;
   708 //     virtual void _setRowLowerBound(int i, Value value) = 0;
   710 //     virtual void _setRowLowerBound(int i, Value value) = 0;
   709 //     virtual void _setRowUpperBound(int i, Value value) = 0;
   711 //     virtual void _setRowUpperBound(int i, Value value) = 0;
   710     virtual void _setRowBounds(int i, Value lower, Value upper) = 0;
   712     virtual void _setRowBounds(int i, Value lower, Value upper) = 0;
   711     virtual void _setObjCoeff(int i, Value obj_coef) = 0;
   713     virtual void _setObjCoeff(int i, Value obj_coef) = 0;
       
   714     virtual Value _getObjCoeff(int i) = 0;
   712     virtual void _clearObj()=0;
   715     virtual void _clearObj()=0;
   713 
   716 
   714     virtual SolveExitStatus _solve() = 0;
   717     virtual SolveExitStatus _solve() = 0;
   715     virtual Value _getPrimal(int i) = 0;
   718     virtual Value _getPrimal(int i) = 0;
   716     virtual Value _getDual(int i) = 0;
   719     virtual Value _getDual(int i) = 0;
   723     virtual ProblemTypes _getProblemType() = 0;
   726     virtual ProblemTypes _getProblemType() = 0;
   724 
   727 
   725     virtual void _setMax() = 0;
   728     virtual void _setMax() = 0;
   726     virtual void _setMin() = 0;
   729     virtual void _setMin() = 0;
   727     
   730     
       
   731 
       
   732     virtual bool _isMax() = 0;
       
   733 
   728     //Own protected stuff
   734     //Own protected stuff
   729     
   735     
   730     //Constant component of the objective function
   736     //Constant component of the objective function
   731     Value obj_const_comp;
   737     Value obj_const_comp;
   732         
   738         
   998 
  1004 
   999     void coeff(Row r, Col c, Value val){
  1005     void coeff(Row r, Col c, Value val){
  1000       _setCoeff(_lpId(r),_lpId(c), val);
  1006       _setCoeff(_lpId(r),_lpId(c), val);
  1001     }
  1007     }
  1002 
  1008 
       
  1009     /// Get an element of the coefficient matrix of the LP
       
  1010 
       
  1011     ///\param r is the row of the element in question
       
  1012     ///\param c is the coloumn of the element in question
       
  1013     ///\return the corresponding coefficient
       
  1014 
       
  1015     Value coeff(Row r, Col c){
       
  1016       return _getCoeff(_lpId(r),_lpId(c));
       
  1017     }
       
  1018 
  1003     /// Set the lower bound of a column (i.e a variable)
  1019     /// Set the lower bound of a column (i.e a variable)
  1004 
  1020 
  1005     /// The lower bound of a variable (column) has to be given by an 
  1021     /// The lower bound of a variable (column) has to be given by an 
  1006     /// extended number of type Value, i.e. a finite number of type 
  1022     /// extended number of type Value, i.e. a finite number of type 
  1007     /// Value or -\ref INF.
  1023     /// Value or -\ref INF.
  1169       // _setRowUpperBound(_lpId(c),upper);
  1185       // _setRowUpperBound(_lpId(c),upper);
  1170     }
  1186     }
  1171     
  1187     
  1172     ///Set an element of the objective function
  1188     ///Set an element of the objective function
  1173     void objCoeff(Col c, Value v) {_setObjCoeff(_lpId(c),v); };
  1189     void objCoeff(Col c, Value v) {_setObjCoeff(_lpId(c),v); };
       
  1190 
       
  1191     ///Get an element of the objective function
       
  1192     Value objCoeff(Col c) {return _getObjCoeff(_lpId(c)); };
       
  1193 
  1174     ///Set the objective function
  1194     ///Set the objective function
  1175     
  1195 
  1176     ///\param e is a linear expression of type \ref Expr.
  1196     ///\param e is a linear expression of type \ref Expr.
  1177     ///\bug Is should be called obj()
  1197     ///\bug Is should be called obj()
  1178     void setObj(Expr e) {
  1198     void setObj(Expr e) {
  1179       _clearObj();
  1199       _clearObj();
  1180       for (Expr::iterator i=e.begin(); i!=e.end(); ++i)
  1200       for (Expr::iterator i=e.begin(); i!=e.end(); ++i)
  1185     ///Maximize
  1205     ///Maximize
  1186     void max() { _setMax(); }
  1206     void max() { _setMax(); }
  1187     ///Minimize
  1207     ///Minimize
  1188     void min() { _setMin(); }
  1208     void min() { _setMin(); }
  1189 
  1209 
       
  1210     ///Query function: is this a maximization problem?
       
  1211     bool is_max() {return _isMax(); }
       
  1212 
       
  1213     ///Query function: is this a minimization problem?
       
  1214     bool is_min() {return !is_max(); }
  1190     
  1215     
  1191     ///@}
  1216     ///@}
  1192 
  1217 
  1193 
  1218 
  1194     ///\name Solve the LP
  1219     ///\name Solve the LP