lemon/soplex.cc
changeset 492 b9b3473327e3
parent 461 08d495d48089
child 539 547e966b3b29
equal deleted inserted replaced
0:437112a19327 1:98493e115012
    24 
    24 
    25 ///\file
    25 ///\file
    26 ///\brief Implementation of the LEMON-SOPLEX lp solver interface.
    26 ///\brief Implementation of the LEMON-SOPLEX lp solver interface.
    27 namespace lemon {
    27 namespace lemon {
    28 
    28 
    29   LpSoplex::LpSoplex() {
    29   SoplexLp::SoplexLp() {
    30     soplex = new soplex::SoPlex;
    30     soplex = new soplex::SoPlex;
    31   }
    31   }
    32 
    32 
    33   LpSoplex::~LpSoplex() {
    33   SoplexLp::~SoplexLp() {
    34     delete soplex;
    34     delete soplex;
    35   }
    35   }
    36 
    36 
    37   LpSoplex::LpSoplex(const LpSoplex& lp) {
    37   SoplexLp::SoplexLp(const SoplexLp& lp) {
    38     rows = lp.rows;
    38     rows = lp.rows;
    39     cols = lp.cols;
    39     cols = lp.cols;
    40 
    40 
    41     soplex = new soplex::SoPlex;
    41     soplex = new soplex::SoPlex;
    42     (*static_cast<soplex::SPxLP*>(soplex)) = *(lp.soplex);
    42     (*static_cast<soplex::SPxLP*>(soplex)) = *(lp.soplex);
    47     _row_names = lp._row_names;
    47     _row_names = lp._row_names;
    48     _row_names_ref = lp._row_names_ref;
    48     _row_names_ref = lp._row_names_ref;
    49 
    49 
    50   }
    50   }
    51 
    51 
    52   void LpSoplex::_clear_temporals() {
    52   void SoplexLp::_clear_temporals() {
    53     _primal_values.clear();
    53     _primal_values.clear();
    54     _dual_values.clear();
    54     _dual_values.clear();
    55   }
    55   }
    56 
    56 
    57   LpSoplex* LpSoplex::_newSolver() const {
    57   SoplexLp* SoplexLp::_newSolver() const {
    58     LpSoplex* newlp = new LpSoplex();
    58     SoplexLp* newlp = new SoplexLp();
    59     return newlp;
    59     return newlp;
    60   }
    60   }
    61 
    61 
    62   LpSoplex* LpSoplex::_cloneSolver() const {
    62   SoplexLp* SoplexLp::_cloneSolver() const {
    63     LpSoplex* newlp = new LpSoplex(*this);
    63     SoplexLp* newlp = new SoplexLp(*this);
    64     return newlp;
    64     return newlp;
    65   }
    65   }
    66 
    66 
    67   const char* LpSoplex::_solverName() const { return "LpSoplex"; }
    67   const char* SoplexLp::_solverName() const { return "SoplexLp"; }
    68 
    68 
    69   int LpSoplex::_addCol() {
    69   int SoplexLp::_addCol() {
    70     soplex::LPCol c;
    70     soplex::LPCol c;
    71     c.setLower(-soplex::infinity);
    71     c.setLower(-soplex::infinity);
    72     c.setUpper(soplex::infinity);
    72     c.setUpper(soplex::infinity);
    73     soplex->addCol(c);
    73     soplex->addCol(c);
    74 
    74 
    75     _col_names.push_back(std::string());
    75     _col_names.push_back(std::string());
    76 
    76 
    77     return soplex->nCols() - 1;
    77     return soplex->nCols() - 1;
    78   }
    78   }
    79 
    79 
    80   int LpSoplex::_addRow() {
    80   int SoplexLp::_addRow() {
    81     soplex::LPRow r;
    81     soplex::LPRow r;
    82     r.setLhs(-soplex::infinity);
    82     r.setLhs(-soplex::infinity);
    83     r.setRhs(soplex::infinity);
    83     r.setRhs(soplex::infinity);
    84     soplex->addRow(r);
    84     soplex->addRow(r);
    85 
    85 
    87 
    87 
    88     return soplex->nRows() - 1;
    88     return soplex->nRows() - 1;
    89   }
    89   }
    90 
    90 
    91 
    91 
    92   void LpSoplex::_eraseCol(int i) {
    92   void SoplexLp::_eraseCol(int i) {
    93     soplex->removeCol(i);
    93     soplex->removeCol(i);
    94     _col_names_ref.erase(_col_names[i]);
    94     _col_names_ref.erase(_col_names[i]);
    95     _col_names[i] = _col_names.back();
    95     _col_names[i] = _col_names.back();
    96     _col_names_ref[_col_names.back()] = i;
    96     _col_names_ref[_col_names.back()] = i;
    97     _col_names.pop_back();
    97     _col_names.pop_back();
    98   }
    98   }
    99 
    99 
   100   void LpSoplex::_eraseRow(int i) {
   100   void SoplexLp::_eraseRow(int i) {
   101     soplex->removeRow(i);
   101     soplex->removeRow(i);
   102     _row_names_ref.erase(_row_names[i]);
   102     _row_names_ref.erase(_row_names[i]);
   103     _row_names[i] = _row_names.back();
   103     _row_names[i] = _row_names.back();
   104     _row_names_ref[_row_names.back()] = i;
   104     _row_names_ref[_row_names.back()] = i;
   105     _row_names.pop_back();
   105     _row_names.pop_back();
   106   }
   106   }
   107 
   107 
   108   void LpSoplex::_eraseColId(int i) {
   108   void SoplexLp::_eraseColId(int i) {
   109     cols.eraseIndex(i);
   109     cols.eraseIndex(i);
   110     cols.relocateIndex(i, cols.maxIndex());
   110     cols.relocateIndex(i, cols.maxIndex());
   111   }
   111   }
   112   void LpSoplex::_eraseRowId(int i) {
   112   void SoplexLp::_eraseRowId(int i) {
   113     rows.eraseIndex(i);
   113     rows.eraseIndex(i);
   114     rows.relocateIndex(i, rows.maxIndex());
   114     rows.relocateIndex(i, rows.maxIndex());
   115   }
   115   }
   116 
   116 
   117   void LpSoplex::_getColName(int c, std::string &name) const {
   117   void SoplexLp::_getColName(int c, std::string &name) const {
   118     name = _col_names[c];
   118     name = _col_names[c];
   119   }
   119   }
   120 
   120 
   121   void LpSoplex::_setColName(int c, const std::string &name) {
   121   void SoplexLp::_setColName(int c, const std::string &name) {
   122     _col_names_ref.erase(_col_names[c]);
   122     _col_names_ref.erase(_col_names[c]);
   123     _col_names[c] = name;
   123     _col_names[c] = name;
   124     if (!name.empty()) {
   124     if (!name.empty()) {
   125       _col_names_ref.insert(std::make_pair(name, c));
   125       _col_names_ref.insert(std::make_pair(name, c));
   126     }
   126     }
   127   }
   127   }
   128 
   128 
   129   int LpSoplex::_colByName(const std::string& name) const {
   129   int SoplexLp::_colByName(const std::string& name) const {
   130     std::map<std::string, int>::const_iterator it =
   130     std::map<std::string, int>::const_iterator it =
   131       _col_names_ref.find(name);
   131       _col_names_ref.find(name);
   132     if (it != _col_names_ref.end()) {
   132     if (it != _col_names_ref.end()) {
   133       return it->second;
   133       return it->second;
   134     } else {
   134     } else {
   135       return -1;
   135       return -1;
   136     }
   136     }
   137   }
   137   }
   138 
   138 
   139   void LpSoplex::_getRowName(int r, std::string &name) const {
   139   void SoplexLp::_getRowName(int r, std::string &name) const {
   140     name = _row_names[r];
   140     name = _row_names[r];
   141   }
   141   }
   142 
   142 
   143   void LpSoplex::_setRowName(int r, const std::string &name) {
   143   void SoplexLp::_setRowName(int r, const std::string &name) {
   144     _row_names_ref.erase(_row_names[r]);
   144     _row_names_ref.erase(_row_names[r]);
   145     _row_names[r] = name;
   145     _row_names[r] = name;
   146     if (!name.empty()) {
   146     if (!name.empty()) {
   147       _row_names_ref.insert(std::make_pair(name, r));
   147       _row_names_ref.insert(std::make_pair(name, r));
   148     }
   148     }
   149   }
   149   }
   150 
   150 
   151   int LpSoplex::_rowByName(const std::string& name) const {
   151   int SoplexLp::_rowByName(const std::string& name) const {
   152     std::map<std::string, int>::const_iterator it =
   152     std::map<std::string, int>::const_iterator it =
   153       _row_names_ref.find(name);
   153       _row_names_ref.find(name);
   154     if (it != _row_names_ref.end()) {
   154     if (it != _row_names_ref.end()) {
   155       return it->second;
   155       return it->second;
   156     } else {
   156     } else {
   157       return -1;
   157       return -1;
   158     }
   158     }
   159   }
   159   }
   160 
   160 
   161 
   161 
   162   void LpSoplex::_setRowCoeffs(int i, ExprIterator b, ExprIterator e) {
   162   void SoplexLp::_setRowCoeffs(int i, ExprIterator b, ExprIterator e) {
   163     for (int j = 0; j < soplex->nCols(); ++j) {
   163     for (int j = 0; j < soplex->nCols(); ++j) {
   164       soplex->changeElement(i, j, 0.0);
   164       soplex->changeElement(i, j, 0.0);
   165     }
   165     }
   166     for(ExprIterator it = b; it != e; ++it) {
   166     for(ExprIterator it = b; it != e; ++it) {
   167       soplex->changeElement(i, it->first, it->second);
   167       soplex->changeElement(i, it->first, it->second);
   168     }
   168     }
   169   }
   169   }
   170 
   170 
   171   void LpSoplex::_getRowCoeffs(int i, InsertIterator b) const {
   171   void SoplexLp::_getRowCoeffs(int i, InsertIterator b) const {
   172     const soplex::SVector& vec = soplex->rowVector(i);
   172     const soplex::SVector& vec = soplex->rowVector(i);
   173     for (int k = 0; k < vec.size(); ++k) {
   173     for (int k = 0; k < vec.size(); ++k) {
   174       *b = std::make_pair(vec.index(k), vec.value(k));
   174       *b = std::make_pair(vec.index(k), vec.value(k));
   175       ++b;
   175       ++b;
   176     }
   176     }
   177   }
   177   }
   178 
   178 
   179   void LpSoplex::_setColCoeffs(int j, ExprIterator b, ExprIterator e) {
   179   void SoplexLp::_setColCoeffs(int j, ExprIterator b, ExprIterator e) {
   180     for (int i = 0; i < soplex->nRows(); ++i) {
   180     for (int i = 0; i < soplex->nRows(); ++i) {
   181       soplex->changeElement(i, j, 0.0);
   181       soplex->changeElement(i, j, 0.0);
   182     }
   182     }
   183     for(ExprIterator it = b; it != e; ++it) {
   183     for(ExprIterator it = b; it != e; ++it) {
   184       soplex->changeElement(it->first, j, it->second);
   184       soplex->changeElement(it->first, j, it->second);
   185     }
   185     }
   186   }
   186   }
   187 
   187 
   188   void LpSoplex::_getColCoeffs(int i, InsertIterator b) const {
   188   void SoplexLp::_getColCoeffs(int i, InsertIterator b) const {
   189     const soplex::SVector& vec = soplex->colVector(i);
   189     const soplex::SVector& vec = soplex->colVector(i);
   190     for (int k = 0; k < vec.size(); ++k) {
   190     for (int k = 0; k < vec.size(); ++k) {
   191       *b = std::make_pair(vec.index(k), vec.value(k));
   191       *b = std::make_pair(vec.index(k), vec.value(k));
   192       ++b;
   192       ++b;
   193     }
   193     }
   194   }
   194   }
   195 
   195 
   196   void LpSoplex::_setCoeff(int i, int j, Value value) {
   196   void SoplexLp::_setCoeff(int i, int j, Value value) {
   197     soplex->changeElement(i, j, value);
   197     soplex->changeElement(i, j, value);
   198   }
   198   }
   199 
   199 
   200   LpSoplex::Value LpSoplex::_getCoeff(int i, int j) const {
   200   SoplexLp::Value SoplexLp::_getCoeff(int i, int j) const {
   201     return soplex->rowVector(i)[j];
   201     return soplex->rowVector(i)[j];
   202   }
   202   }
   203 
   203 
   204   void LpSoplex::_setColLowerBound(int i, Value value) {
   204   void SoplexLp::_setColLowerBound(int i, Value value) {
   205     LEMON_ASSERT(value != INF, "Invalid bound");
   205     LEMON_ASSERT(value != INF, "Invalid bound");
   206     soplex->changeLower(i, value != -INF ? value : -soplex::infinity);
   206     soplex->changeLower(i, value != -INF ? value : -soplex::infinity);
   207   }
   207   }
   208 
   208 
   209   LpSoplex::Value LpSoplex::_getColLowerBound(int i) const {
   209   SoplexLp::Value SoplexLp::_getColLowerBound(int i) const {
   210     double value = soplex->lower(i);
   210     double value = soplex->lower(i);
   211     return value != -soplex::infinity ? value : -INF;
   211     return value != -soplex::infinity ? value : -INF;
   212   }
   212   }
   213 
   213 
   214   void LpSoplex::_setColUpperBound(int i, Value value) {
   214   void SoplexLp::_setColUpperBound(int i, Value value) {
   215     LEMON_ASSERT(value != -INF, "Invalid bound");
   215     LEMON_ASSERT(value != -INF, "Invalid bound");
   216     soplex->changeUpper(i, value != INF ? value : soplex::infinity);
   216     soplex->changeUpper(i, value != INF ? value : soplex::infinity);
   217   }
   217   }
   218 
   218 
   219   LpSoplex::Value LpSoplex::_getColUpperBound(int i) const {
   219   SoplexLp::Value SoplexLp::_getColUpperBound(int i) const {
   220     double value = soplex->upper(i);
   220     double value = soplex->upper(i);
   221     return value != soplex::infinity ? value : INF;
   221     return value != soplex::infinity ? value : INF;
   222   }
   222   }
   223 
   223 
   224   void LpSoplex::_setRowLowerBound(int i, Value lb) {
   224   void SoplexLp::_setRowLowerBound(int i, Value lb) {
   225     LEMON_ASSERT(lb != INF, "Invalid bound");
   225     LEMON_ASSERT(lb != INF, "Invalid bound");
   226     soplex->changeRange(i, lb != -INF ? lb : -soplex::infinity, soplex->rhs(i));
   226     soplex->changeRange(i, lb != -INF ? lb : -soplex::infinity, soplex->rhs(i));
   227   }
   227   }
   228 
   228 
   229   LpSoplex::Value LpSoplex::_getRowLowerBound(int i) const {
   229   SoplexLp::Value SoplexLp::_getRowLowerBound(int i) const {
   230     double res = soplex->lhs(i);
   230     double res = soplex->lhs(i);
   231     return res == -soplex::infinity ? -INF : res;
   231     return res == -soplex::infinity ? -INF : res;
   232   }
   232   }
   233 
   233 
   234   void LpSoplex::_setRowUpperBound(int i, Value ub) {
   234   void SoplexLp::_setRowUpperBound(int i, Value ub) {
   235     LEMON_ASSERT(ub != -INF, "Invalid bound");
   235     LEMON_ASSERT(ub != -INF, "Invalid bound");
   236     soplex->changeRange(i, soplex->lhs(i), ub != INF ? ub : soplex::infinity);
   236     soplex->changeRange(i, soplex->lhs(i), ub != INF ? ub : soplex::infinity);
   237   }
   237   }
   238 
   238 
   239   LpSoplex::Value LpSoplex::_getRowUpperBound(int i) const {
   239   SoplexLp::Value SoplexLp::_getRowUpperBound(int i) const {
   240     double res = soplex->rhs(i);
   240     double res = soplex->rhs(i);
   241     return res == soplex::infinity ? INF : res;
   241     return res == soplex::infinity ? INF : res;
   242   }
   242   }
   243 
   243 
   244   void LpSoplex::_setObjCoeffs(ExprIterator b, ExprIterator e) {
   244   void SoplexLp::_setObjCoeffs(ExprIterator b, ExprIterator e) {
   245     for (int j = 0; j < soplex->nCols(); ++j) {
   245     for (int j = 0; j < soplex->nCols(); ++j) {
   246       soplex->changeObj(j, 0.0);
   246       soplex->changeObj(j, 0.0);
   247     }
   247     }
   248     for (ExprIterator it = b; it != e; ++it) {
   248     for (ExprIterator it = b; it != e; ++it) {
   249       soplex->changeObj(it->first, it->second);
   249       soplex->changeObj(it->first, it->second);
   250     }
   250     }
   251   }
   251   }
   252 
   252 
   253   void LpSoplex::_getObjCoeffs(InsertIterator b) const {
   253   void SoplexLp::_getObjCoeffs(InsertIterator b) const {
   254     for (int j = 0; j < soplex->nCols(); ++j) {
   254     for (int j = 0; j < soplex->nCols(); ++j) {
   255       Value coef = soplex->obj(j);
   255       Value coef = soplex->obj(j);
   256       if (coef != 0.0) {
   256       if (coef != 0.0) {
   257         *b = std::make_pair(j, coef);
   257         *b = std::make_pair(j, coef);
   258         ++b;
   258         ++b;
   259       }
   259       }
   260     }
   260     }
   261   }
   261   }
   262 
   262 
   263   void LpSoplex::_setObjCoeff(int i, Value obj_coef) {
   263   void SoplexLp::_setObjCoeff(int i, Value obj_coef) {
   264     soplex->changeObj(i, obj_coef);
   264     soplex->changeObj(i, obj_coef);
   265   }
   265   }
   266 
   266 
   267   LpSoplex::Value LpSoplex::_getObjCoeff(int i) const {
   267   SoplexLp::Value SoplexLp::_getObjCoeff(int i) const {
   268     return soplex->obj(i);
   268     return soplex->obj(i);
   269   }
   269   }
   270 
   270 
   271   LpSoplex::SolveExitStatus LpSoplex::_solve() {
   271   SoplexLp::SolveExitStatus SoplexLp::_solve() {
   272 
   272 
   273     _clear_temporals();
   273     _clear_temporals();
   274 
   274 
   275     soplex::SPxSolver::Status status = soplex->solve();
   275     soplex::SPxSolver::Status status = soplex->solve();
   276 
   276 
   282     default:
   282     default:
   283       return UNSOLVED;
   283       return UNSOLVED;
   284     }
   284     }
   285   }
   285   }
   286 
   286 
   287   LpSoplex::Value LpSoplex::_getPrimal(int i) const {
   287   SoplexLp::Value SoplexLp::_getPrimal(int i) const {
   288     if (_primal_values.empty()) {
   288     if (_primal_values.empty()) {
   289       _primal_values.resize(soplex->nCols());
   289       _primal_values.resize(soplex->nCols());
   290       soplex::Vector pv(_primal_values.size(), &_primal_values.front());
   290       soplex::Vector pv(_primal_values.size(), &_primal_values.front());
   291       soplex->getPrimal(pv);
   291       soplex->getPrimal(pv);
   292     }
   292     }
   293     return _primal_values[i];
   293     return _primal_values[i];
   294   }
   294   }
   295 
   295 
   296   LpSoplex::Value LpSoplex::_getDual(int i) const {
   296   SoplexLp::Value SoplexLp::_getDual(int i) const {
   297     if (_dual_values.empty()) {
   297     if (_dual_values.empty()) {
   298       _dual_values.resize(soplex->nRows());
   298       _dual_values.resize(soplex->nRows());
   299       soplex::Vector dv(_dual_values.size(), &_dual_values.front());
   299       soplex::Vector dv(_dual_values.size(), &_dual_values.front());
   300       soplex->getDual(dv);
   300       soplex->getDual(dv);
   301     }
   301     }
   302     return _dual_values[i];
   302     return _dual_values[i];
   303   }
   303   }
   304 
   304 
   305   LpSoplex::Value LpSoplex::_getPrimalValue() const {
   305   SoplexLp::Value SoplexLp::_getPrimalValue() const {
   306     return soplex->objValue();
   306     return soplex->objValue();
   307   }
   307   }
   308 
   308 
   309   LpSoplex::VarStatus LpSoplex::_getColStatus(int i) const {
   309   SoplexLp::VarStatus SoplexLp::_getColStatus(int i) const {
   310     switch (soplex->getBasisColStatus(i)) {
   310     switch (soplex->getBasisColStatus(i)) {
   311     case soplex::SPxSolver::BASIC:
   311     case soplex::SPxSolver::BASIC:
   312       return BASIC;
   312       return BASIC;
   313     case soplex::SPxSolver::ON_UPPER:
   313     case soplex::SPxSolver::ON_UPPER:
   314       return UPPER;
   314       return UPPER;
   322       LEMON_ASSERT(false, "Wrong column status");
   322       LEMON_ASSERT(false, "Wrong column status");
   323       return VarStatus();
   323       return VarStatus();
   324     }
   324     }
   325   }
   325   }
   326 
   326 
   327   LpSoplex::VarStatus LpSoplex::_getRowStatus(int i) const {
   327   SoplexLp::VarStatus SoplexLp::_getRowStatus(int i) const {
   328     switch (soplex->getBasisRowStatus(i)) {
   328     switch (soplex->getBasisRowStatus(i)) {
   329     case soplex::SPxSolver::BASIC:
   329     case soplex::SPxSolver::BASIC:
   330       return BASIC;
   330       return BASIC;
   331     case soplex::SPxSolver::ON_UPPER:
   331     case soplex::SPxSolver::ON_UPPER:
   332       return UPPER;
   332       return UPPER;
   340       LEMON_ASSERT(false, "Wrong row status");
   340       LEMON_ASSERT(false, "Wrong row status");
   341       return VarStatus();
   341       return VarStatus();
   342     }
   342     }
   343   }
   343   }
   344 
   344 
   345   LpSoplex::Value LpSoplex::_getPrimalRay(int i) const {
   345   SoplexLp::Value SoplexLp::_getPrimalRay(int i) const {
   346     if (_primal_ray.empty()) {
   346     if (_primal_ray.empty()) {
   347       _primal_ray.resize(soplex->nCols());
   347       _primal_ray.resize(soplex->nCols());
   348       soplex::Vector pv(_primal_ray.size(), &_primal_ray.front());
   348       soplex::Vector pv(_primal_ray.size(), &_primal_ray.front());
   349       soplex->getDualfarkas(pv);
   349       soplex->getDualfarkas(pv);
   350     }
   350     }
   351     return _primal_ray[i];
   351     return _primal_ray[i];
   352   }
   352   }
   353 
   353 
   354   LpSoplex::Value LpSoplex::_getDualRay(int i) const {
   354   SoplexLp::Value SoplexLp::_getDualRay(int i) const {
   355     if (_dual_ray.empty()) {
   355     if (_dual_ray.empty()) {
   356       _dual_ray.resize(soplex->nRows());
   356       _dual_ray.resize(soplex->nRows());
   357       soplex::Vector dv(_dual_ray.size(), &_dual_ray.front());
   357       soplex::Vector dv(_dual_ray.size(), &_dual_ray.front());
   358       soplex->getDualfarkas(dv);
   358       soplex->getDualfarkas(dv);
   359     }
   359     }
   360     return _dual_ray[i];
   360     return _dual_ray[i];
   361   }
   361   }
   362 
   362 
   363   LpSoplex::ProblemType LpSoplex::_getPrimalType() const {
   363   SoplexLp::ProblemType SoplexLp::_getPrimalType() const {
   364     switch (soplex->status()) {
   364     switch (soplex->status()) {
   365     case soplex::SPxSolver::OPTIMAL:
   365     case soplex::SPxSolver::OPTIMAL:
   366       return OPTIMAL;
   366       return OPTIMAL;
   367     case soplex::SPxSolver::UNBOUNDED:
   367     case soplex::SPxSolver::UNBOUNDED:
   368       return UNBOUNDED;
   368       return UNBOUNDED;
   371     default:
   371     default:
   372       return UNDEFINED;
   372       return UNDEFINED;
   373     }
   373     }
   374   }
   374   }
   375 
   375 
   376   LpSoplex::ProblemType LpSoplex::_getDualType() const {
   376   SoplexLp::ProblemType SoplexLp::_getDualType() const {
   377     switch (soplex->status()) {
   377     switch (soplex->status()) {
   378     case soplex::SPxSolver::OPTIMAL:
   378     case soplex::SPxSolver::OPTIMAL:
   379       return OPTIMAL;
   379       return OPTIMAL;
   380     case soplex::SPxSolver::UNBOUNDED:
   380     case soplex::SPxSolver::UNBOUNDED:
   381       return UNBOUNDED;
   381       return UNBOUNDED;
   384     default:
   384     default:
   385       return UNDEFINED;
   385       return UNDEFINED;
   386     }
   386     }
   387   }
   387   }
   388 
   388 
   389   void LpSoplex::_setSense(Sense sense) {
   389   void SoplexLp::_setSense(Sense sense) {
   390     switch (sense) {
   390     switch (sense) {
   391     case MIN:
   391     case MIN:
   392       soplex->changeSense(soplex::SPxSolver::MINIMIZE);
   392       soplex->changeSense(soplex::SPxSolver::MINIMIZE);
   393       break;
   393       break;
   394     case MAX:
   394     case MAX:
   395       soplex->changeSense(soplex::SPxSolver::MAXIMIZE);
   395       soplex->changeSense(soplex::SPxSolver::MAXIMIZE);
   396     }
   396     }
   397   }
   397   }
   398 
   398 
   399   LpSoplex::Sense LpSoplex::_getSense() const {
   399   SoplexLp::Sense SoplexLp::_getSense() const {
   400     switch (soplex->spxSense()) {
   400     switch (soplex->spxSense()) {
   401     case soplex::SPxSolver::MAXIMIZE:
   401     case soplex::SPxSolver::MAXIMIZE:
   402       return MAX;
   402       return MAX;
   403     case soplex::SPxSolver::MINIMIZE:
   403     case soplex::SPxSolver::MINIMIZE:
   404       return MIN;
   404       return MIN;
   405     default:
   405     default:
   406       LEMON_ASSERT(false, "Wrong sense.");
   406       LEMON_ASSERT(false, "Wrong sense.");
   407       return LpSoplex::Sense();
   407       return SoplexLp::Sense();
   408     }
   408     }
   409   }
   409   }
   410 
   410 
   411   void LpSoplex::_clear() {
   411   void SoplexLp::_clear() {
   412     soplex->clear();
   412     soplex->clear();
   413     _col_names.clear();
   413     _col_names.clear();
   414     _col_names_ref.clear();
   414     _col_names_ref.clear();
   415     _row_names.clear();
   415     _row_names.clear();
   416     _row_names_ref.clear();
   416     _row_names_ref.clear();