src/lemon/lp_glpk.cc
changeset 1376 8de0c1aeeb32
parent 1368 f9d0d792c8a6
child 1377 bfbb5b30c5b8
     1.1 --- a/src/lemon/lp_glpk.cc	Tue Apr 19 14:15:01 2005 +0000
     1.2 +++ b/src/lemon/lp_glpk.cc	Wed Apr 20 14:29:23 2005 +0000
     1.3 @@ -263,9 +263,26 @@
     1.4    
     1.5    void LpGlpk::_setObjCoeff(int i, Value obj_coef)
     1.6    {
     1.7 +    //i=0 means the constant term (shift)
     1.8      lpx_set_obj_coef(lp, i, obj_coef);
     1.9    }
    1.10  
    1.11 +  void LpGlpk::_setObj(int length,
    1.12 +		       int  const * indices, 
    1.13 +		       Value  const * values )
    1.14 +  {
    1.15 +    Value new_values[1+lpx_num_cols()];
    1.16 +    for (i=0;i<=lpx_num_cols();++i){
    1.17 +      new_values[i]=0;
    1.18 +    }
    1.19 +    for (i=1;i<=length;++i){
    1.20 +      new_values[indices[i]]=values[i];
    1.21 +    }
    1.22 +    
    1.23 +    for (i=0;i<=lpx_num_cols();++i){
    1.24 +      lpx_set_obj_coef(lp, i, new_values[i]);
    1.25 +    }
    1.26 +  }
    1.27  
    1.28    LpGlpk::SolveExitStatus LpGlpk::_solve()
    1.29    {