lemon/soplex.cc
changeset 947 0dba9b96550a
parent 540 9db62975c32b
child 746 e4554cd6b2bf
equal deleted inserted replaced
3:1ca68c92d842 4:9d63dce1b140
    18 
    18 
    19 #include <iostream>
    19 #include <iostream>
    20 #include <lemon/soplex.h>
    20 #include <lemon/soplex.h>
    21 
    21 
    22 #include <soplex.h>
    22 #include <soplex.h>
       
    23 #include <spxout.h>
    23 
    24 
    24 
    25 
    25 ///\file
    26 ///\file
    26 ///\brief Implementation of the LEMON-SOPLEX lp solver interface.
    27 ///\brief Implementation of the LEMON-SOPLEX lp solver interface.
    27 namespace lemon {
    28 namespace lemon {
    28 
    29 
    29   SoplexLp::SoplexLp() {
    30   SoplexLp::SoplexLp() {
    30     soplex = new soplex::SoPlex;
    31     soplex = new soplex::SoPlex;
       
    32     messageLevel(MESSAGE_NOTHING);
    31   }
    33   }
    32 
    34 
    33   SoplexLp::~SoplexLp() {
    35   SoplexLp::~SoplexLp() {
    34     delete soplex;
    36     delete soplex;
    35   }
    37   }
    45     _col_names_ref = lp._col_names_ref;
    47     _col_names_ref = lp._col_names_ref;
    46 
    48 
    47     _row_names = lp._row_names;
    49     _row_names = lp._row_names;
    48     _row_names_ref = lp._row_names_ref;
    50     _row_names_ref = lp._row_names_ref;
    49 
    51 
       
    52     messageLevel(MESSAGE_NOTHING);
    50   }
    53   }
    51 
    54 
    52   void SoplexLp::_clear_temporals() {
    55   void SoplexLp::_clear_temporals() {
    53     _primal_values.clear();
    56     _primal_values.clear();
    54     _dual_values.clear();
    57     _dual_values.clear();
   269   }
   272   }
   270 
   273 
   271   SoplexLp::SolveExitStatus SoplexLp::_solve() {
   274   SoplexLp::SolveExitStatus SoplexLp::_solve() {
   272 
   275 
   273     _clear_temporals();
   276     _clear_temporals();
       
   277     
       
   278     _applyMessageLevel();
   274 
   279 
   275     soplex::SPxSolver::Status status = soplex->solve();
   280     soplex::SPxSolver::Status status = soplex->solve();
   276 
   281 
   277     switch (status) {
   282     switch (status) {
   278     case soplex::SPxSolver::OPTIMAL:
   283     case soplex::SPxSolver::OPTIMAL:
   417     cols.clear();
   422     cols.clear();
   418     rows.clear();
   423     rows.clear();
   419     _clear_temporals();
   424     _clear_temporals();
   420   }
   425   }
   421 
   426 
       
   427   void SoplexLp::_messageLevel(MessageLevel level) {
       
   428     switch (level) {
       
   429     case MESSAGE_NOTHING:
       
   430       _message_level = -1;
       
   431       break;
       
   432     case MESSAGE_ERROR:
       
   433       _message_level = soplex::SPxOut::ERROR;
       
   434       break;
       
   435     case MESSAGE_WARNING:
       
   436       _message_level = soplex::SPxOut::WARNING;
       
   437       break;
       
   438     case MESSAGE_NORMAL:
       
   439       _message_level = soplex::SPxOut::INFO2;
       
   440       break;
       
   441     case MESSAGE_VERBOSE:
       
   442       _message_level = soplex::SPxOut::DEBUG;
       
   443       break;
       
   444     }
       
   445   }
       
   446 
       
   447   void SoplexLp::_applyMessageLevel() {
       
   448     soplex::Param::setVerbose(_message_level);
       
   449   }
       
   450 
   422 } //namespace lemon
   451 } //namespace lemon
   423 
   452