Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CoMISo
CoMISo
Commits
347eddd6
Commit
347eddd6
authored
Jan 17, 2018
by
Max Lyon
Browse files
add optimality gap as termination criterion to gurobi solver
parent
37de038a
Changes
2
Hide whitespace changes
Inline
Side-by-side
NSolver/GUROBISolver.cc
View file @
347eddd6
...
@@ -97,7 +97,8 @@ GUROBISolver::
...
@@ -97,7 +97,8 @@ GUROBISolver::
solve
(
NProblemInterface
*
_problem
,
solve
(
NProblemInterface
*
_problem
,
const
std
::
vector
<
NConstraintInterface
*>
&
_constraints
,
const
std
::
vector
<
NConstraintInterface
*>
&
_constraints
,
const
std
::
vector
<
PairIndexVtype
>
&
_discrete_constraints
,
const
std
::
vector
<
PairIndexVtype
>
&
_discrete_constraints
,
const
double
_time_limit
)
const
double
_time_limit
,
const
double
_gap
)
{
{
DEB_enter_func
;
DEB_enter_func
;
try
try
...
@@ -237,6 +238,8 @@ solve(NProblemInterface* _problem,
...
@@ -237,6 +238,8 @@ solve(NProblemInterface* _problem,
GurobiHelper
::
outputModelToMpsGz
(
model
,
problem_output_path_
);
GurobiHelper
::
outputModelToMpsGz
(
model
,
problem_output_path_
);
}
}
#endif//COMISO_QT_AVAILABLE
#endif//COMISO_QT_AVAILABLE
if
(
_gap
>
0.0
)
model
.
getEnv
().
set
(
GRB_DoubleParam_MIPGap
,
_gap
);
model
.
optimize
();
model
.
optimize
();
}
}
else
else
...
...
NSolver/GUROBISolver.hh
View file @
347eddd6
...
@@ -46,7 +46,9 @@ public:
...
@@ -46,7 +46,9 @@ public:
bool
solve
(
NProblemInterface
*
_problem
,
// problem instance
bool
solve
(
NProblemInterface
*
_problem
,
// problem instance
const
std
::
vector
<
NConstraintInterface
*>&
_constraints
,
// linear constraints
const
std
::
vector
<
NConstraintInterface
*>&
_constraints
,
// linear constraints
const
std
::
vector
<
PairIndexVtype
>&
_discrete_constraints
,
// discrete 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
bool
solve
(
NProblemInterface
*
_problem
,
// problem instance
const
std
::
vector
<
NConstraintInterface
*>&
_constraints
,
// linear constraints
const
std
::
vector
<
NConstraintInterface
*>&
_constraints
,
// linear constraints
...
...
Write
Preview
Supports
Markdown
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