COIN-OR::LEMON - Graph Library

Changeset 2361:f2ef1aa8189a in lemon-0.x for lemon/lp_cplex.cc


Ignore:
Timestamp:
02/14/07 14:50:25 (17 years ago)
Author:
athos
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3167
Message:

Implemented virtual functions of class LpCplex?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/lp_cplex.cc

    r2328 r2361  
    148148  }
    149149
     150  LpCplex::Value LpCplex::_getCoeff(int row, int col)
     151  {
     152    LpCplex::Value value;
     153    CPXgetcoef(env, lp, row, col, &value);
     154    return value;
     155  }
     156
    150157  void LpCplex::_setColLowerBound(int i, Value value)
    151158  {
     
    159166 
    160167  }
     168
     169  LpCplex::Value LpCplex::_getColLowerBound(int i)
     170  {
     171    LpCplex::Value x;
     172    CPXgetlb (env, lp, &x, i, i);
     173    return x;
     174  }
    161175 
    162176  void LpCplex::_setColUpperBound(int i, Value value)
     
    169183    bd[0]=value;
    170184    status = CPXchgbds(env, lp, 1, indices, lu, bd);
     185  }
     186
     187  LpCplex::Value LpCplex::_getColUpperBound(int i)
     188  {
     189    LpCplex::Value x;
     190    CPXgetub (env, lp, &x, i, i);
     191    return x;
    171192  }
    172193
     
    243264//   }
    244265 
     266  void LpCplex::_getRowBounds(int i, Value &lb, Value &ub)
     267  {
     268    char sense;
     269    CPXgetsense(env, lp, &sense,i,i);
     270    lb=-INF;
     271    ub=INF;
     272    switch (sense)
     273      {
     274      case 'L':
     275        CPXgetcoef(env, lp, i, -1, &ub);
     276        break;
     277      case 'G':
     278        CPXgetcoef(env, lp, i, -1, &lb);
     279        break;
     280      case 'E':
     281        CPXgetcoef(env, lp, i, -1, &lb);
     282        ub=lb;
     283        break;
     284      case 'R':
     285        CPXgetcoef(env, lp, i, -1, &lb);
     286        Value x;
     287        CPXgetcoef(env, lp, i, -2, &x);
     288        ub=lb+x;
     289        break;
     290      }
     291  }
     292
    245293  void LpCplex::_setObjCoeff(int i, Value obj_coef)
    246294  {
    247295    CPXchgcoef(env, lp, -1, i, obj_coef);
     296  }
     297
     298  LpCplex::Value LpCplex::_getObjCoeff(int i)
     299  {
     300    Value x;
     301    CPXgetcoef(env, lp, -1, i, &x);
     302    return x;
    248303  }
    249304
     
    565620    CPXchgobjsen(env, lp, CPX_MIN);
    566621   }
     622
     623  bool LpCplex::_isMax()
     624  {
     625    if (CPXgetobjsen(env, lp)==CPX_MAX)
     626      return true;
     627    else
     628      return false;
     629  }
    567630 
    568631} //namespace lemon
Note: See TracChangeset for help on using the changeset viewer.