Bonmin
1.7
|
A very simple class to provide a common interface for solving MIPs with Cplex and Cbc. More...
#include <BonSubMipSolver.hpp>
Public Types | |
enum | MILP_solve_strategy { FindGoodSolution, GetOptimum } |
Public Member Functions | |
SubMipSolver (BabSetupBase &b, const std::string &prefix) | |
Constructor. | |
SubMipSolver (const SubMipSolver ©) | |
Copy Constructor. | |
~SubMipSolver () | |
void | setLpSolver (OsiSolverInterface *lp) |
Assign lp solver. | |
void | setStrategy (CbcStrategyDefault *strategy) |
Assign a strategy. | |
const double * | getLastSolution () |
get the solution found in last local search (return NULL if no solution). | |
double | getLowerBound () |
void | solve (double cutoff, int loglevel, double maxTime) |
void | find_good_sol (double cutoff, int loglevel, double maxTime) |
update cutoff and perform a local search to a good solution. | |
void | optimize (double cutoff, int loglevel, double maxTime) |
update cutoff and optimize MIP. | |
void | optimize_with_lazy_constraints (double cutoff, int loglevel, double maxTime, const OsiCuts &cs) |
update cutoff, put OA constraints in cs as lazy constraints and optimize MIP. | |
double | lowBound () |
Returns lower bound. | |
bool | optimal () |
returns optimality status. | |
int | nodeCount () |
Returns number of nodes in last solve. | |
int | iterationCount () |
Returns number of simplex iterations in last solve. | |
OsiSolverInterface * | solver () |
Static Public Member Functions | |
static void | registerOptions (Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions) |
Register options for that Oa based cut generation method. | |
Private Attributes | |
OsiClpSolverInterface * | clp_ |
If lp solver is clp (then have to use Cbc) (not owned). | |
OsiCpxSolverInterface * | cpx_ |
If mip solver is cpx this is it (owned). | |
double | lowBound_ |
lower bound obtained | |
bool | optimal_ |
Is optimality proven? | |
double * | integerSolution_ |
Has an integer solution? then it is here. | |
CbcStrategyDefault * | strategy_ |
Strategy for solving sub mips with cbc. | |
int | nodeCount_ |
number of nodes in last mip solved. | |
int | iterationCount_ |
number of simplex iteration in last mip solved. | |
MILP_solve_strategy | milp_strat_ |
MILP search strategy. | |
double | gap_tol_ |
setting for gap tolerance. | |
bool | ownClp_ |
say if owns copy of clp_. |
A very simple class to provide a common interface for solving MIPs with Cplex and Cbc.
Definition at line 29 of file BonSubMipSolver.hpp.
Definition at line 32 of file BonSubMipSolver.hpp.
Bonmin::SubMipSolver::SubMipSolver | ( | BabSetupBase & | b, |
const std::string & | prefix | ||
) |
Constructor.
Bonmin::SubMipSolver::SubMipSolver | ( | const SubMipSolver & | copy | ) |
Copy Constructor.
Bonmin::SubMipSolver::~SubMipSolver | ( | ) |
void Bonmin::SubMipSolver::setLpSolver | ( | OsiSolverInterface * | lp | ) |
Assign lp solver.
void Bonmin::SubMipSolver::setStrategy | ( | CbcStrategyDefault * | strategy | ) |
Assign a strategy.
const double* Bonmin::SubMipSolver::getLastSolution | ( | ) | [inline] |
get the solution found in last local search (return NULL if no solution).
Definition at line 50 of file BonSubMipSolver.hpp.
References integerSolution_.
double Bonmin::SubMipSolver::getLowerBound | ( | ) | [inline] |
Definition at line 55 of file BonSubMipSolver.hpp.
References lowBound_.
void Bonmin::SubMipSolver::solve | ( | double | cutoff, |
int | loglevel, | ||
double | maxTime | ||
) | [inline] |
Definition at line 60 of file BonSubMipSolver.hpp.
References find_good_sol(), FindGoodSolution, milp_strat_, and optimize().
void Bonmin::SubMipSolver::find_good_sol | ( | double | cutoff, |
int | loglevel, | ||
double | maxTime | ||
) |
update cutoff and perform a local search to a good solution.
Referenced by solve().
void Bonmin::SubMipSolver::optimize | ( | double | cutoff, |
int | loglevel, | ||
double | maxTime | ||
) |
update cutoff and optimize MIP.
Referenced by solve().
void Bonmin::SubMipSolver::optimize_with_lazy_constraints | ( | double | cutoff, |
int | loglevel, | ||
double | maxTime, | ||
const OsiCuts & | cs | ||
) |
update cutoff, put OA constraints in cs as lazy constraints and optimize MIP.
double Bonmin::SubMipSolver::lowBound | ( | ) | [inline] |
bool Bonmin::SubMipSolver::optimal | ( | ) | [inline] |
int Bonmin::SubMipSolver::nodeCount | ( | ) | [inline] |
Returns number of nodes in last solve.
Definition at line 99 of file BonSubMipSolver.hpp.
References nodeCount_.
int Bonmin::SubMipSolver::iterationCount | ( | ) | [inline] |
Returns number of simplex iterations in last solve.
Definition at line 105 of file BonSubMipSolver.hpp.
References iterationCount_.
OsiSolverInterface* Bonmin::SubMipSolver::solver | ( | ) |
static void Bonmin::SubMipSolver::registerOptions | ( | Ipopt::SmartPtr< Bonmin::RegisteredOptions > | roptions | ) | [static] |
Register options for that Oa based cut generation method.
OsiClpSolverInterface* Bonmin::SubMipSolver::clp_ [private] |
If lp solver is clp (then have to use Cbc) (not owned).
Definition at line 117 of file BonSubMipSolver.hpp.
OsiCpxSolverInterface* Bonmin::SubMipSolver::cpx_ [private] |
If mip solver is cpx this is it (owned).
Definition at line 119 of file BonSubMipSolver.hpp.
double Bonmin::SubMipSolver::lowBound_ [private] |
lower bound obtained
Definition at line 121 of file BonSubMipSolver.hpp.
Referenced by getLowerBound(), and lowBound().
bool Bonmin::SubMipSolver::optimal_ [private] |
double* Bonmin::SubMipSolver::integerSolution_ [private] |
Has an integer solution? then it is here.
Definition at line 125 of file BonSubMipSolver.hpp.
Referenced by getLastSolution().
CbcStrategyDefault* Bonmin::SubMipSolver::strategy_ [private] |
Strategy for solving sub mips with cbc.
Definition at line 127 of file BonSubMipSolver.hpp.
int Bonmin::SubMipSolver::nodeCount_ [private] |
number of nodes in last mip solved.
Definition at line 129 of file BonSubMipSolver.hpp.
Referenced by nodeCount().
int Bonmin::SubMipSolver::iterationCount_ [private] |
number of simplex iteration in last mip solved.
Definition at line 131 of file BonSubMipSolver.hpp.
Referenced by iterationCount().
double Bonmin::SubMipSolver::gap_tol_ [private] |
setting for gap tolerance.
Definition at line 135 of file BonSubMipSolver.hpp.
bool Bonmin::SubMipSolver::ownClp_ [private] |
say if owns copy of clp_.
Definition at line 137 of file BonSubMipSolver.hpp.