[Lemon-commits] [lemon_svn] athos: r1821 - hugo/trunk/src/lemon
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:47:57 CET 2006
Author: athos
Date: Wed Apr 20 16:29:23 2005
New Revision: 1821
Modified:
hugo/trunk/src/lemon/lp_base.h
hugo/trunk/src/lemon/lp_glpk.cc
hugo/trunk/src/lemon/lp_glpk.h
Log:
_setObj function
Modified: hugo/trunk/src/lemon/lp_base.h
==============================================================================
--- hugo/trunk/src/lemon/lp_base.h (original)
+++ hugo/trunk/src/lemon/lp_base.h Wed Apr 20 16:29:23 2005
@@ -434,6 +434,9 @@
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 SolveExitStatus _solve() = 0;
virtual Value _getPrimal(int i) = 0;
virtual Value _getPrimalValue() = 0;
Modified: hugo/trunk/src/lemon/lp_glpk.cc
==============================================================================
--- hugo/trunk/src/lemon/lp_glpk.cc (original)
+++ hugo/trunk/src/lemon/lp_glpk.cc Wed Apr 20 16:29:23 2005
@@ -263,9 +263,26 @@
void LpGlpk::_setObjCoeff(int i, Value obj_coef)
{
+ //i=0 means the constant term (shift)
lpx_set_obj_coef(lp, i, obj_coef);
}
+ 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()
{
Modified: hugo/trunk/src/lemon/lp_glpk.h
==============================================================================
--- hugo/trunk/src/lemon/lp_glpk.h (original)
+++ hugo/trunk/src/lemon/lp_glpk.h Wed Apr 20 16:29:23 2005
@@ -63,6 +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;
+
///\e
///\todo It should be clarified
More information about the Lemon-commits
mailing list