COIN-OR::LEMON - Graph Library

Changeset 485:9b082b3fb33f in lemon for lemon/soplex.cc


Ignore:
Timestamp:
01/12/09 13:26:02 (11 years ago)
Author:
Alpar Juttner <alpar@…>
Branch:
default
Phase:
public
Message:

Rename Lp*/Mip* to *Lp/*Mip

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/soplex.cc

    r484 r485  
    2727namespace lemon {
    2828
    29   LpSoplex::LpSoplex() {
     29  SoplexLp::SoplexLp() {
    3030    soplex = new soplex::SoPlex;
    3131  }
    3232
    33   LpSoplex::~LpSoplex() {
     33  SoplexLp::~SoplexLp() {
    3434    delete soplex;
    3535  }
    3636
    37   LpSoplex::LpSoplex(const LpSoplex& lp) {
     37  SoplexLp::SoplexLp(const SoplexLp& lp) {
    3838    rows = lp.rows;
    3939    cols = lp.cols;
     
    5050  }
    5151
    52   void LpSoplex::_clear_temporals() {
     52  void SoplexLp::_clear_temporals() {
    5353    _primal_values.clear();
    5454    _dual_values.clear();
    5555  }
    5656
    57   LpSoplex* LpSoplex::_newSolver() const {
    58     LpSoplex* newlp = new LpSoplex();
     57  SoplexLp* SoplexLp::_newSolver() const {
     58    SoplexLp* newlp = new SoplexLp();
    5959    return newlp;
    6060  }
    6161
    62   LpSoplex* LpSoplex::_cloneSolver() const {
    63     LpSoplex* newlp = new LpSoplex(*this);
     62  SoplexLp* SoplexLp::_cloneSolver() const {
     63    SoplexLp* newlp = new SoplexLp(*this);
    6464    return newlp;
    6565  }
    6666
    67   const char* LpSoplex::_solverName() const { return "LpSoplex"; }
    68 
    69   int LpSoplex::_addCol() {
     67  const char* SoplexLp::_solverName() const { return "SoplexLp"; }
     68
     69  int SoplexLp::_addCol() {
    7070    soplex::LPCol c;
    7171    c.setLower(-soplex::infinity);
     
    7878  }
    7979
    80   int LpSoplex::_addRow() {
     80  int SoplexLp::_addRow() {
    8181    soplex::LPRow r;
    8282    r.setLhs(-soplex::infinity);
     
    9090
    9191
    92   void LpSoplex::_eraseCol(int i) {
     92  void SoplexLp::_eraseCol(int i) {
    9393    soplex->removeCol(i);
    9494    _col_names_ref.erase(_col_names[i]);
     
    9898  }
    9999
    100   void LpSoplex::_eraseRow(int i) {
     100  void SoplexLp::_eraseRow(int i) {
    101101    soplex->removeRow(i);
    102102    _row_names_ref.erase(_row_names[i]);
     
    106106  }
    107107
    108   void LpSoplex::_eraseColId(int i) {
     108  void SoplexLp::_eraseColId(int i) {
    109109    cols.eraseIndex(i);
    110110    cols.relocateIndex(i, cols.maxIndex());
    111111  }
    112   void LpSoplex::_eraseRowId(int i) {
     112  void SoplexLp::_eraseRowId(int i) {
    113113    rows.eraseIndex(i);
    114114    rows.relocateIndex(i, rows.maxIndex());
    115115  }
    116116
    117   void LpSoplex::_getColName(int c, std::string &name) const {
     117  void SoplexLp::_getColName(int c, std::string &name) const {
    118118    name = _col_names[c];
    119119  }
    120120
    121   void LpSoplex::_setColName(int c, const std::string &name) {
     121  void SoplexLp::_setColName(int c, const std::string &name) {
    122122    _col_names_ref.erase(_col_names[c]);
    123123    _col_names[c] = name;
     
    127127  }
    128128
    129   int LpSoplex::_colByName(const std::string& name) const {
     129  int SoplexLp::_colByName(const std::string& name) const {
    130130    std::map<std::string, int>::const_iterator it =
    131131      _col_names_ref.find(name);
     
    137137  }
    138138
    139   void LpSoplex::_getRowName(int r, std::string &name) const {
     139  void SoplexLp::_getRowName(int r, std::string &name) const {
    140140    name = _row_names[r];
    141141  }
    142142
    143   void LpSoplex::_setRowName(int r, const std::string &name) {
     143  void SoplexLp::_setRowName(int r, const std::string &name) {
    144144    _row_names_ref.erase(_row_names[r]);
    145145    _row_names[r] = name;
     
    149149  }
    150150
    151   int LpSoplex::_rowByName(const std::string& name) const {
     151  int SoplexLp::_rowByName(const std::string& name) const {
    152152    std::map<std::string, int>::const_iterator it =
    153153      _row_names_ref.find(name);
     
    160160
    161161
    162   void LpSoplex::_setRowCoeffs(int i, ExprIterator b, ExprIterator e) {
     162  void SoplexLp::_setRowCoeffs(int i, ExprIterator b, ExprIterator e) {
    163163    for (int j = 0; j < soplex->nCols(); ++j) {
    164164      soplex->changeElement(i, j, 0.0);
     
    169169  }
    170170
    171   void LpSoplex::_getRowCoeffs(int i, InsertIterator b) const {
     171  void SoplexLp::_getRowCoeffs(int i, InsertIterator b) const {
    172172    const soplex::SVector& vec = soplex->rowVector(i);
    173173    for (int k = 0; k < vec.size(); ++k) {
     
    177177  }
    178178
    179   void LpSoplex::_setColCoeffs(int j, ExprIterator b, ExprIterator e) {
     179  void SoplexLp::_setColCoeffs(int j, ExprIterator b, ExprIterator e) {
    180180    for (int i = 0; i < soplex->nRows(); ++i) {
    181181      soplex->changeElement(i, j, 0.0);
     
    186186  }
    187187
    188   void LpSoplex::_getColCoeffs(int i, InsertIterator b) const {
     188  void SoplexLp::_getColCoeffs(int i, InsertIterator b) const {
    189189    const soplex::SVector& vec = soplex->colVector(i);
    190190    for (int k = 0; k < vec.size(); ++k) {
     
    194194  }
    195195
    196   void LpSoplex::_setCoeff(int i, int j, Value value) {
     196  void SoplexLp::_setCoeff(int i, int j, Value value) {
    197197    soplex->changeElement(i, j, value);
    198198  }
    199199
    200   LpSoplex::Value LpSoplex::_getCoeff(int i, int j) const {
     200  SoplexLp::Value SoplexLp::_getCoeff(int i, int j) const {
    201201    return soplex->rowVector(i)[j];
    202202  }
    203203
    204   void LpSoplex::_setColLowerBound(int i, Value value) {
     204  void SoplexLp::_setColLowerBound(int i, Value value) {
    205205    LEMON_ASSERT(value != INF, "Invalid bound");
    206206    soplex->changeLower(i, value != -INF ? value : -soplex::infinity);
    207207  }
    208208
    209   LpSoplex::Value LpSoplex::_getColLowerBound(int i) const {
     209  SoplexLp::Value SoplexLp::_getColLowerBound(int i) const {
    210210    double value = soplex->lower(i);
    211211    return value != -soplex::infinity ? value : -INF;
    212212  }
    213213
    214   void LpSoplex::_setColUpperBound(int i, Value value) {
     214  void SoplexLp::_setColUpperBound(int i, Value value) {
    215215    LEMON_ASSERT(value != -INF, "Invalid bound");
    216216    soplex->changeUpper(i, value != INF ? value : soplex::infinity);
    217217  }
    218218
    219   LpSoplex::Value LpSoplex::_getColUpperBound(int i) const {
     219  SoplexLp::Value SoplexLp::_getColUpperBound(int i) const {
    220220    double value = soplex->upper(i);
    221221    return value != soplex::infinity ? value : INF;
    222222  }
    223223
    224   void LpSoplex::_setRowLowerBound(int i, Value lb) {
     224  void SoplexLp::_setRowLowerBound(int i, Value lb) {
    225225    LEMON_ASSERT(lb != INF, "Invalid bound");
    226226    soplex->changeRange(i, lb != -INF ? lb : -soplex::infinity, soplex->rhs(i));
    227227  }
    228228
    229   LpSoplex::Value LpSoplex::_getRowLowerBound(int i) const {
     229  SoplexLp::Value SoplexLp::_getRowLowerBound(int i) const {
    230230    double res = soplex->lhs(i);
    231231    return res == -soplex::infinity ? -INF : res;
    232232  }
    233233
    234   void LpSoplex::_setRowUpperBound(int i, Value ub) {
     234  void SoplexLp::_setRowUpperBound(int i, Value ub) {
    235235    LEMON_ASSERT(ub != -INF, "Invalid bound");
    236236    soplex->changeRange(i, soplex->lhs(i), ub != INF ? ub : soplex::infinity);
    237237  }
    238238
    239   LpSoplex::Value LpSoplex::_getRowUpperBound(int i) const {
     239  SoplexLp::Value SoplexLp::_getRowUpperBound(int i) const {
    240240    double res = soplex->rhs(i);
    241241    return res == soplex::infinity ? INF : res;
    242242  }
    243243
    244   void LpSoplex::_setObjCoeffs(ExprIterator b, ExprIterator e) {
     244  void SoplexLp::_setObjCoeffs(ExprIterator b, ExprIterator e) {
    245245    for (int j = 0; j < soplex->nCols(); ++j) {
    246246      soplex->changeObj(j, 0.0);
     
    251251  }
    252252
    253   void LpSoplex::_getObjCoeffs(InsertIterator b) const {
     253  void SoplexLp::_getObjCoeffs(InsertIterator b) const {
    254254    for (int j = 0; j < soplex->nCols(); ++j) {
    255255      Value coef = soplex->obj(j);
     
    261261  }
    262262
    263   void LpSoplex::_setObjCoeff(int i, Value obj_coef) {
     263  void SoplexLp::_setObjCoeff(int i, Value obj_coef) {
    264264    soplex->changeObj(i, obj_coef);
    265265  }
    266266
    267   LpSoplex::Value LpSoplex::_getObjCoeff(int i) const {
     267  SoplexLp::Value SoplexLp::_getObjCoeff(int i) const {
    268268    return soplex->obj(i);
    269269  }
    270270
    271   LpSoplex::SolveExitStatus LpSoplex::_solve() {
     271  SoplexLp::SolveExitStatus SoplexLp::_solve() {
    272272
    273273    _clear_temporals();
     
    285285  }
    286286
    287   LpSoplex::Value LpSoplex::_getPrimal(int i) const {
     287  SoplexLp::Value SoplexLp::_getPrimal(int i) const {
    288288    if (_primal_values.empty()) {
    289289      _primal_values.resize(soplex->nCols());
     
    294294  }
    295295
    296   LpSoplex::Value LpSoplex::_getDual(int i) const {
     296  SoplexLp::Value SoplexLp::_getDual(int i) const {
    297297    if (_dual_values.empty()) {
    298298      _dual_values.resize(soplex->nRows());
     
    303303  }
    304304
    305   LpSoplex::Value LpSoplex::_getPrimalValue() const {
     305  SoplexLp::Value SoplexLp::_getPrimalValue() const {
    306306    return soplex->objValue();
    307307  }
    308308
    309   LpSoplex::VarStatus LpSoplex::_getColStatus(int i) const {
     309  SoplexLp::VarStatus SoplexLp::_getColStatus(int i) const {
    310310    switch (soplex->getBasisColStatus(i)) {
    311311    case soplex::SPxSolver::BASIC:
     
    325325  }
    326326
    327   LpSoplex::VarStatus LpSoplex::_getRowStatus(int i) const {
     327  SoplexLp::VarStatus SoplexLp::_getRowStatus(int i) const {
    328328    switch (soplex->getBasisRowStatus(i)) {
    329329    case soplex::SPxSolver::BASIC:
     
    343343  }
    344344
    345   LpSoplex::Value LpSoplex::_getPrimalRay(int i) const {
     345  SoplexLp::Value SoplexLp::_getPrimalRay(int i) const {
    346346    if (_primal_ray.empty()) {
    347347      _primal_ray.resize(soplex->nCols());
     
    352352  }
    353353
    354   LpSoplex::Value LpSoplex::_getDualRay(int i) const {
     354  SoplexLp::Value SoplexLp::_getDualRay(int i) const {
    355355    if (_dual_ray.empty()) {
    356356      _dual_ray.resize(soplex->nRows());
     
    361361  }
    362362
    363   LpSoplex::ProblemType LpSoplex::_getPrimalType() const {
     363  SoplexLp::ProblemType SoplexLp::_getPrimalType() const {
    364364    switch (soplex->status()) {
    365365    case soplex::SPxSolver::OPTIMAL:
     
    374374  }
    375375
    376   LpSoplex::ProblemType LpSoplex::_getDualType() const {
     376  SoplexLp::ProblemType SoplexLp::_getDualType() const {
    377377    switch (soplex->status()) {
    378378    case soplex::SPxSolver::OPTIMAL:
     
    387387  }
    388388
    389   void LpSoplex::_setSense(Sense sense) {
     389  void SoplexLp::_setSense(Sense sense) {
    390390    switch (sense) {
    391391    case MIN:
     
    397397  }
    398398
    399   LpSoplex::Sense LpSoplex::_getSense() const {
     399  SoplexLp::Sense SoplexLp::_getSense() const {
    400400    switch (soplex->spxSense()) {
    401401    case soplex::SPxSolver::MAXIMIZE:
     
    405405    default:
    406406      LEMON_ASSERT(false, "Wrong sense.");
    407       return LpSoplex::Sense();
    408     }
    409   }
    410 
    411   void LpSoplex::_clear() {
     407      return SoplexLp::Sense();
     408    }
     409  }
     410
     411  void SoplexLp::_clear() {
    412412    soplex->clear();
    413413    _col_names.clear();
Note: See TracChangeset for help on using the changeset viewer.