COIN-OR::LEMON - Graph Library

Changeset 2366:bfbdded3763a in lemon-0.x for lemon/lp_soplex.cc


Ignore:
Timestamp:
02/16/07 20:11:31 (17 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3181
Message:

Using const in lp interface
colByName functionality

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/lp_soplex.cc

    r2364 r2366  
    9191  }
    9292 
    93   void LpSoplex::_getColName(int col, std::string &name) {
     93  void LpSoplex::_getColName(int col, std::string &name) const {
    9494    name = colNames[col];
    9595  }
    9696 
    9797  void LpSoplex::_setColName(int col, const std::string &name) {
     98    invColNames.erase(colNames[col]);
    9899    colNames[col] = name;
     100    if (!name.empty()) {
     101      invColNames.insert(std::make_pair(name, col));
     102    }
     103  }
     104
     105  int LpSoplex::_colByName(const std::string& name) const {
     106    std::map<std::string, int>::const_iterator it =
     107      invColNames.find(name);
     108    if (it != invColNames.end()) {
     109      return it->second;
     110    } else {
     111      return -1;
     112    }
    99113  }
    100114 
     
    110124  }
    111125
    112   void LpSoplex::_getRowCoeffs(int i, RowIterator b) {
     126  void LpSoplex::_getRowCoeffs(int i, RowIterator b) const {
    113127    const soplex::SVector& vec = soplex->rowVector(i);
    114128    for (int k = 0; k < vec.size(); ++k) {
     
    128142  }
    129143
    130   void LpSoplex::_getColCoeffs(int i, ColIterator b) {
     144  void LpSoplex::_getColCoeffs(int i, ColIterator b) const {
    131145    const soplex::SVector& vec = soplex->colVector(i);
    132146    for (int k = 0; k < vec.size(); ++k) {
     
    141155  }
    142156
    143   LpSoplex::Value LpSoplex::_getCoeff(int i, int j) {
     157  LpSoplex::Value LpSoplex::_getCoeff(int i, int j) const {
    144158    return soplex->rowVector(i)[j];
    145159  }
     
    150164  }
    151165 
    152   LpSoplex::Value LpSoplex::_getColLowerBound(int i) {
     166  LpSoplex::Value LpSoplex::_getColLowerBound(int i) const {
    153167    double value = soplex->lower(i);
    154168    return value != -soplex::infinity ? value : -INF;
     
    160174  }
    161175
    162   LpSoplex::Value LpSoplex::_getColUpperBound(int i) {
     176  LpSoplex::Value LpSoplex::_getColUpperBound(int i) const {
    163177    double value = soplex->upper(i);
    164178    return value != soplex::infinity ? value : INF;
     
    170184    solved = false;
    171185  }
    172   void LpSoplex::_getRowBounds(int i, Value &lower, Value &upper) {
     186  void LpSoplex::_getRowBounds(int i, Value &lower, Value &upper) const {
    173187    lower = soplex->lhs(i);
    174188    if (lower == -soplex::infinity) lower = -INF;
     
    182196  }
    183197
    184   LpSoplex::Value LpSoplex::_getObjCoeff(int i) {
     198  LpSoplex::Value LpSoplex::_getObjCoeff(int i) const {
    185199    return soplex->obj(i);
    186200  }
     
    213227  }
    214228
    215   LpSoplex::Value LpSoplex::_getPrimal(int i) {
     229  LpSoplex::Value LpSoplex::_getPrimal(int i) const {
    216230    return primal_value[i];
    217231  }
    218232
    219   LpSoplex::Value LpSoplex::_getDual(int i) {
     233  LpSoplex::Value LpSoplex::_getDual(int i) const {
    220234    return dual_value[i];
    221235  }
    222236 
    223   LpSoplex::Value LpSoplex::_getPrimalValue() {
     237  LpSoplex::Value LpSoplex::_getPrimalValue() const {
    224238    return soplex->objValue();
    225239  }
    226240
    227   bool LpSoplex::_isBasicCol(int i) {
     241  bool LpSoplex::_isBasicCol(int i) const {
    228242    return soplex->getBasisColStatus(i) == soplex::SPxSolver::BASIC;
    229243  } 
    230244
    231   LpSoplex::SolutionStatus LpSoplex::_getPrimalStatus() {
     245  LpSoplex::SolutionStatus LpSoplex::_getPrimalStatus() const {
    232246    if (!solved) return UNDEFINED;
    233247    switch (soplex->status()) {
     
    243257  }
    244258
    245   LpSoplex::SolutionStatus LpSoplex::_getDualStatus() {
     259  LpSoplex::SolutionStatus LpSoplex::_getDualStatus() const {
    246260    if (!solved) return UNDEFINED;
    247261    switch (soplex->status()) {
     
    255269  }
    256270
    257   LpSoplex::ProblemTypes LpSoplex::_getProblemType() {
     271  LpSoplex::ProblemTypes LpSoplex::_getProblemType() const {
    258272    if (!solved) return UNKNOWN;
    259273    switch (soplex->status()) {
     
    275289    solved = false;
    276290  }
    277   bool LpSoplex::_isMax() {
     291  bool LpSoplex::_isMax() const {
    278292    return soplex->spxSense() == soplex::SPxSolver::MAXIMIZE;
    279293  }
Note: See TracChangeset for help on using the changeset viewer.