8 #ifndef LIMBO_SOLVERS_API_LPSOLVEAPI_H
9 #define LIMBO_SOLVERS_API_LPSOLVEAPI_H
68 ,
m_bbRule(NODE_PSEUDONONINTSELECT|NODE_RCOSTFIXING)
72 ,
m_presolve(PRESOLVE_ROWS+PRESOLVE_COLS+PRESOLVE_LINDEP+PRESOLVE_SOS+PRESOLVE_REDUCEMIP+PRESOLVE_KNAPSACK
73 +PRESOLVE_ELIMEQ2+PRESOLVE_IMPLIEDFREE+PRESOLVE_REDUCEGCD+PRESOLVE_PROBEFIX+PRESOLVE_PROBEREDUCE
74 +PRESOLVE_ROWDOMINATE+PRESOLVE_MERGEROWS+PRESOLVE_COLFIXDUAL
87 set_presolve(lp,
m_presolve, get_presolveloops(lp));
108 template <
typename T,
typename V>
141 bool defaultParam =
false;
149 std::vector<int> vIdx;
151 std::vector<double> vValue;
157 set_lp_name(
m_lpModel, (
char*)
"LPSolveLinearApi");
164 variable_type var (i);
188 vIdx.push_back(it->variable().id()+1);
189 vValue.push_back(it->coefficient());
208 for (
typename std::vector<term_type>::const_iterator it = constr.
expression().
terms().begin(), ite = constr.
expression().
terms().end(); it != ite; ++it)
210 vIdx.push_back(it->variable().id()+1);
211 vValue.push_back(it->coefficient());
214 limboAssertMsg(set_rowex(
m_lpModel, i+1, vIdx.size(), &vValue[0], &vIdx[0]),
"failed to set constraint for LP");
215 switch (constr.
sense())
235 #ifdef DEBUG_LPSOLVEAPI
236 write_lp(
m_lpModel, (
char*)
"problem.lp");
250 #ifdef DEBUG_LPSOLVEAPI
253 std::ofstream out (
"problem.sol");
254 limboAssertMsg(out.good(),
"failed to open %s for write",
"problem.sol");
255 out <<
"# Solution for model " << get_lp_name(
m_lpModel) <<
"\n";
256 out <<
"# Objective value = " << get_objective(
m_lpModel) <<
"\n";
Describe properties of a variable.
SolverProperty
Some enums used in solver.
LPSolveParameters()
constructor
SolverProperty optimizeType() const
Basic utilities such as variables and linear expressions in solvers.
model_type * m_model
model for the problem
std::string const & constraintName(constraint_type const &constr) const
SolverProperty variableNumericType(variable_type const &var)
V variable_value_type
V variable.
limbo::solvers::SolverProperty getSolveStatus(int status)
convert lpsolve status to limbo::solvers status
T coefficient_value_type
T coefficient.
expression_type const & objective() const
LPSolveLinearApi(model_type *model)
constructor
Describe linear constraint.
lprec * m_lpModel
model for LPSolve
std::vector< constraint_type > const & constraints() const
LinearModel< T, V > model_type
linear model type for the problem
unsigned int numVariables() const
virtual ~LPSolveParameters()
destructor
~LPSolveLinearApi()
destructor
int m_bbRule
branch and bound rule
LPSolve API with limbo::solvers::LinearModel.
void setPresolve(int v)
set presolve strategy
expression_type const & expression() const
variable_type variable(unsigned int id) const
void setVerbose(int v)
set verbose level
int m_verbose
verbose level
int m_presolve
presolve strategy
Base class for custom LPSolve parameters.
std::string variableName(variable_type const &var) const
coefficient_value_type rightHandSide() const
SolverProperty operator()(parameter_type *param=NULL)
API to run the algorithm.
std::vector< term_type > const & terms() const
void setVariableSolution(variable_type const &var, variable_value_type v)
variable_value_type variableLowerBound(variable_type const &var)
model to describe an optimization problem
LPSolveLinearApi & operator=(LPSolveLinearApi const &rhs)
assignment, forbidden
variable_value_type variableUpperBound(variable_type const &var)
#define limboAssertMsg(condition, args...)
custom assertion with message
void setBbRule(int v)
set branch and bound rule
virtual void operator()(lprec *lp) const
customize environment