# HG changeset patch # User athos # Date 1114009602 0 # Node ID bfbb5b30c5b8fcafba6410a04fd797861a23ad7c # Parent 8de0c1aeeb32112de1228876077ea9376dd32e0c _clearObj instead of _setObj. diff -r 8de0c1aeeb32 -r bfbb5b30c5b8 src/lemon/lp_base.h --- a/src/lemon/lp_base.h Wed Apr 20 14:29:23 2005 +0000 +++ b/src/lemon/lp_base.h Wed Apr 20 15:06:42 2005 +0000 @@ -434,9 +434,10 @@ virtual void _setRowLowerBound(int i, Value value) = 0; virtual void _setRowUpperBound(int i, Value value) = 0; virtual void _setObjCoeff(int i, Value obj_coef) = 0; - virtual void _setObj(int length, - int const * indices, - Value const * values ) = 0; + virtual void _clearObj()=0; +// virtual void _setObj(int length, +// int const * indices, +// Value const * values ) = 0; virtual SolveExitStatus _solve() = 0; virtual Value _getPrimal(int i) = 0; virtual Value _getPrimalValue() = 0; @@ -449,10 +450,8 @@ //Constant component of the objective function Value obj_const_comp; - ///\e - - ///\bug Unimplemented - void clearObj() {} + + public: @@ -667,7 +666,7 @@ ///\param e is a linear expression of type \ref Expr. ///\bug The previous objective function is not cleared! void setObj(Expr e) { - clearObj(); + _clearObj(); for (Expr::iterator i=e.begin(); i!=e.end(); ++i) objCoeff((*i).first,(*i).second); obj_const_comp=e.constComp(); diff -r 8de0c1aeeb32 -r bfbb5b30c5b8 src/lemon/lp_glpk.cc --- a/src/lemon/lp_glpk.cc Wed Apr 20 14:29:23 2005 +0000 +++ b/src/lemon/lp_glpk.cc Wed Apr 20 15:06:42 2005 +0000 @@ -267,22 +267,28 @@ lpx_set_obj_coef(lp, i, obj_coef); } - void LpGlpk::_setObj(int length, - int const * indices, - Value const * values ) + void LpGlpk::_clearObj() { - Value new_values[1+lpx_num_cols()]; - for (i=0;i<=lpx_num_cols();++i){ - new_values[i]=0; - } - for (i=1;i<=length;++i){ - new_values[indices[i]]=values[i]; - } - - for (i=0;i<=lpx_num_cols();++i){ - lpx_set_obj_coef(lp, i, new_values[i]); + for (int i=0;i<=lpx_get_num_cols(lp);++i){ + lpx_set_obj_coef(lp, i, 0); } } +// void LpGlpk::_setObj(int length, +// int const * indices, +// Value const * values ) +// { +// Value new_values[1+lpx_num_cols()]; +// for (i=0;i<=lpx_num_cols();++i){ +// new_values[i]=0; +// } +// for (i=1;i<=length;++i){ +// new_values[indices[i]]=values[i]; +// } + +// for (i=0;i<=lpx_num_cols();++i){ +// lpx_set_obj_coef(lp, i, new_values[i]); +// } +// } LpGlpk::SolveExitStatus LpGlpk::_solve() { diff -r 8de0c1aeeb32 -r bfbb5b30c5b8 src/lemon/lp_glpk.h --- a/src/lemon/lp_glpk.h Wed Apr 20 14:29:23 2005 +0000 +++ b/src/lemon/lp_glpk.h Wed Apr 20 15:06:42 2005 +0000 @@ -63,9 +63,10 @@ virtual void _setRowLowerBound(int i, Value value); virtual void _setRowUpperBound(int i, Value value); virtual void _setObjCoeff(int i, Value obj_coef); - virtual void _setObj(int length, - int const * indices, - Value const * values ) = 0; + virtual void _clearObj(); +// virtual void _setObj(int length, +// int const * indices, +// Value const * values ) = 0; ///\e