_clearObj instead of _setObj.
authorathos
Wed, 20 Apr 2005 15:06:42 +0000
changeset 1377bfbb5b30c5b8
parent 1376 8de0c1aeeb32
child 1378 b82995734b2d
_clearObj instead of _setObj.
src/lemon/lp_base.h
src/lemon/lp_glpk.cc
src/lemon/lp_glpk.h
     1.1 --- a/src/lemon/lp_base.h	Wed Apr 20 14:29:23 2005 +0000
     1.2 +++ b/src/lemon/lp_base.h	Wed Apr 20 15:06:42 2005 +0000
     1.3 @@ -434,9 +434,10 @@
     1.4      virtual void _setRowLowerBound(int i, Value value) = 0;
     1.5      virtual void _setRowUpperBound(int i, Value value) = 0;
     1.6      virtual void _setObjCoeff(int i, Value obj_coef) = 0;
     1.7 -    virtual void _setObj(int length,
     1.8 -                         int  const * indices, 
     1.9 -                         Value  const * values ) = 0;
    1.10 +    virtual void _clearObj()=0;
    1.11 +//     virtual void _setObj(int length,
    1.12 +//                          int  const * indices, 
    1.13 +//                          Value  const * values ) = 0;
    1.14      virtual SolveExitStatus _solve() = 0;
    1.15      virtual Value _getPrimal(int i) = 0;
    1.16      virtual Value _getPrimalValue() = 0;
    1.17 @@ -449,10 +450,8 @@
    1.18      //Constant component of the objective function
    1.19      Value obj_const_comp;
    1.20      
    1.21 -    ///\e
    1.22 -    
    1.23 -    ///\bug Unimplemented
    1.24 -    void clearObj() {}
    1.25 +
    1.26 +
    1.27      
    1.28    public:
    1.29  
    1.30 @@ -667,7 +666,7 @@
    1.31      ///\param e is a linear expression of type \ref Expr.
    1.32      ///\bug The previous objective function is not cleared!
    1.33      void setObj(Expr e) {
    1.34 -      clearObj();
    1.35 +      _clearObj();
    1.36        for (Expr::iterator i=e.begin(); i!=e.end(); ++i)
    1.37  	objCoeff((*i).first,(*i).second);
    1.38        obj_const_comp=e.constComp();
     2.1 --- a/src/lemon/lp_glpk.cc	Wed Apr 20 14:29:23 2005 +0000
     2.2 +++ b/src/lemon/lp_glpk.cc	Wed Apr 20 15:06:42 2005 +0000
     2.3 @@ -267,22 +267,28 @@
     2.4      lpx_set_obj_coef(lp, i, obj_coef);
     2.5    }
     2.6  
     2.7 -  void LpGlpk::_setObj(int length,
     2.8 -		       int  const * indices, 
     2.9 -		       Value  const * values )
    2.10 +  void LpGlpk::_clearObj()
    2.11    {
    2.12 -    Value new_values[1+lpx_num_cols()];
    2.13 -    for (i=0;i<=lpx_num_cols();++i){
    2.14 -      new_values[i]=0;
    2.15 -    }
    2.16 -    for (i=1;i<=length;++i){
    2.17 -      new_values[indices[i]]=values[i];
    2.18 -    }
    2.19 -    
    2.20 -    for (i=0;i<=lpx_num_cols();++i){
    2.21 -      lpx_set_obj_coef(lp, i, new_values[i]);
    2.22 +    for (int i=0;i<=lpx_get_num_cols(lp);++i){
    2.23 +      lpx_set_obj_coef(lp, i, 0);
    2.24      }
    2.25    }
    2.26 +//   void LpGlpk::_setObj(int length,
    2.27 +// 		       int  const * indices, 
    2.28 +// 		       Value  const * values )
    2.29 +//   {
    2.30 +//     Value new_values[1+lpx_num_cols()];
    2.31 +//     for (i=0;i<=lpx_num_cols();++i){
    2.32 +//       new_values[i]=0;
    2.33 +//     }
    2.34 +//     for (i=1;i<=length;++i){
    2.35 +//       new_values[indices[i]]=values[i];
    2.36 +//     }
    2.37 +    
    2.38 +//     for (i=0;i<=lpx_num_cols();++i){
    2.39 +//       lpx_set_obj_coef(lp, i, new_values[i]);
    2.40 +//     }
    2.41 +//   }
    2.42  
    2.43    LpGlpk::SolveExitStatus LpGlpk::_solve()
    2.44    {
     3.1 --- a/src/lemon/lp_glpk.h	Wed Apr 20 14:29:23 2005 +0000
     3.2 +++ b/src/lemon/lp_glpk.h	Wed Apr 20 15:06:42 2005 +0000
     3.3 @@ -63,9 +63,10 @@
     3.4      virtual void _setRowLowerBound(int i, Value value);
     3.5      virtual void _setRowUpperBound(int i, Value value);
     3.6      virtual void _setObjCoeff(int i, Value obj_coef);
     3.7 -    virtual void _setObj(int length,
     3.8 -                         int  const * indices, 
     3.9 -                         Value  const * values ) = 0;
    3.10 +    virtual void _clearObj();
    3.11 +//     virtual void _setObj(int length,
    3.12 +//                          int  const * indices, 
    3.13 +//                          Value  const * values ) = 0;
    3.14  
    3.15      ///\e
    3.16