Commit 15434636 authored by Jan Dreier's avatar Jan Dreier

final commit by me

parent d032ecd5
......@@ -82,10 +82,10 @@ class MyGRBCallback : public GRBCallback
{
private:
std::vector<GRBVar> &xvars_;
MyCallbackBase &callback_;
GUROBICallbackBase &callback_;
public:
MyGRBCallback(std::vector<GRBVar> &_xvars, MyCallbackBase &_callback) :
MyGRBCallback(std::vector<GRBVar> &_xvars, GUROBICallbackBase &_callback) :
xvars_(_xvars),
callback_(_callback)
{
......@@ -179,7 +179,7 @@ solve(NProblemInterface* _problem,
std::vector<NConstraintInterface*>& _constraints,
std::vector<PairIndexVtype>& _discrete_constraints,
const double _time_limit,
MyCallbackBase* _callback,
GUROBICallbackBase* _callback,
bool _silent)
{
DEB_enter_func;
......
......@@ -36,7 +36,7 @@ namespace COMISO {
//== CLASS DEFINITION =========================================================
class MyCallbackBase
class GUROBICallbackBase
{
public:
virtual void callback_solution(double value, const std::vector<double> &_x, std::vector<NConstraintInterface*> &_constraints, bool& terminate) = 0;
......@@ -69,18 +69,24 @@ public:
std::vector<NConstraintInterface*>& _constraints, // linear constraints
std::vector<PairIndexVtype>& _discrete_constraints, // discrete constraints
const double _time_limit = 60, // time limit in seconds
MyCallbackBase* _callback = NULL, // a callback to add lazy constraints
GUROBICallbackBase* _callback = NULL, // a callback to add lazy constraints
bool _silent = false); // discard output if true
bool solve(NProblemInterface* _problem, // problem instance
std::vector<NConstraintInterface*>& _constraints, // linear constraints
const double _time_limit = 60, // time limit in seconds
MyCallbackBase* _callback = NULL, // a callback to add lazy constraints
GUROBICallbackBase* _callback = NULL, // a callback to add lazy constraints
bool _silent = false) // time limit in seconds
{
std::vector<PairIndexVtype> dc;
return solve(_problem, _constraints, dc, _time_limit, _callback, _silent);
}
/*
* I modified the code such that the state of the gurobi optzimization is stored within
* this object, so one can resolve the problem with additional constraints.
* this functionality, however, is not used anymore in any of my code.
*/
bool solveAgainWithMoreConstraints(
std::vector<NConstraintInterface*>& _constraints, // linear constraints
bool _silent = false); // discard output if true
......
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