Commit 347eddd6 authored by Max Lyon's avatar Max Lyon

add optimality gap as termination criterion to gurobi solver

parent 37de038a
......@@ -97,7 +97,8 @@ GUROBISolver::
solve(NProblemInterface* _problem,
const std::vector<NConstraintInterface *> &_constraints,
const std::vector<PairIndexVtype> &_discrete_constraints,
const double _time_limit)
const double _time_limit,
const double _gap)
{
DEB_enter_func;
try
......@@ -237,6 +238,8 @@ solve(NProblemInterface* _problem,
GurobiHelper::outputModelToMpsGz(model, problem_output_path_);
}
#endif//COMISO_QT_AVAILABLE
if (_gap > 0.0)
model.getEnv().set(GRB_DoubleParam_MIPGap, _gap);
model.optimize();
}
else
......
......@@ -46,7 +46,9 @@ public:
bool solve(NProblemInterface* _problem, // problem instance
const std::vector<NConstraintInterface*>& _constraints, // linear constraints
const std::vector<PairIndexVtype>& _discrete_constraints, // discrete constraints
const double _time_limit = 60 ); // time limit in seconds
const double _time_limit = 60, // time limit in seconds
const double _gap = 0.0); // stops when solution with optimality gap
// lower than _gab is reached
bool solve(NProblemInterface* _problem, // problem instance
const std::vector<NConstraintInterface*>& _constraints, // linear constraints
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment