Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
CoMISo
CoMISo
Commits
15434636
Commit
15434636
authored
Sep 12, 2016
by
Jan Dreier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
final commit by me
parent
d032ecd5
Pipeline
#2752
failed with stage
in 5 minutes and 7 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
NSolver/GUROBISolver.cc
NSolver/GUROBISolver.cc
+3
-3
NSolver/GUROBISolver.hh
NSolver/GUROBISolver.hh
+9
-3
No files found.
NSolver/GUROBISolver.cc
View file @
15434636
...
...
@@ -82,10 +82,10 @@ class MyGRBCallback : public GRBCallback
{
private:
std
::
vector
<
GRBVar
>
&
xvars_
;
My
CallbackBase
&
callback_
;
GUROBI
CallbackBase
&
callback_
;
public:
MyGRBCallback
(
std
::
vector
<
GRBVar
>
&
_xvars
,
My
CallbackBase
&
_callback
)
:
MyGRBCallback
(
std
::
vector
<
GRBVar
>
&
_xvars
,
GUROBI
CallbackBase
&
_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
,
My
CallbackBase
*
_callback
,
GUROBI
CallbackBase
*
_callback
,
bool
_silent
)
{
DEB_enter_func
;
...
...
NSolver/GUROBISolver.hh
View file @
15434636
...
...
@@ -36,7 +36,7 @@ namespace COMISO {
//== CLASS DEFINITION =========================================================
class
My
CallbackBase
class
GUROBI
CallbackBase
{
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
My
CallbackBase
*
_callback
=
NULL
,
// a callback to add lazy constraints
GUROBI
CallbackBase
*
_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
My
CallbackBase
*
_callback
=
NULL
,
// a callback to add lazy constraints
GUROBI
CallbackBase
*
_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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment