COIN-OR::LEMON - Graph Library

Changeset 1376:8de0c1aeeb32 in lemon-0.x for src/lemon/lp_glpk.cc


Ignore:
Timestamp:
04/20/05 16:29:23 (19 years ago)
Author:
athos
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1821
Message:

_setObj function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/lp_glpk.cc

    r1368 r1376  
    264264  void LpGlpk::_setObjCoeff(int i, Value obj_coef)
    265265  {
     266    //i=0 means the constant term (shift)
    266267    lpx_set_obj_coef(lp, i, obj_coef);
    267268  }
    268269
     270  void LpGlpk::_setObj(int length,
     271                       int  const * indices,
     272                       Value  const * values )
     273  {
     274    Value new_values[1+lpx_num_cols()];
     275    for (i=0;i<=lpx_num_cols();++i){
     276      new_values[i]=0;
     277    }
     278    for (i=1;i<=length;++i){
     279      new_values[indices[i]]=values[i];
     280    }
     281   
     282    for (i=0;i<=lpx_num_cols();++i){
     283      lpx_set_obj_coef(lp, i, new_values[i]);
     284    }
     285  }
    269286
    270287  LpGlpk::SolveExitStatus LpGlpk::_solve()
Note: See TracChangeset for help on using the changeset viewer.