Skip to content

Commit bd41f37

Browse files
authored
Merge pull request #59 from sandialabs/dev-weh
Suppressing gurobi license server output
2 parents dad2172 + 7a6c1bf commit bd41f37

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

Diff for: lib/coek/coek/solvers/gurobi/gurobi.cpp

+15-3
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,11 @@ int GurobiSolver::solve(Model& model)
136136
{
137137
auto _model = model.repn.get();
138138

139-
env = new GRBEnv();
139+
env = new GRBEnv(true);
140+
auto it = integer_options().find("OutputFlag");
141+
if (it != integer_options().end())
142+
env->set(GRB_IntParam_OutputFlag, it->second);
143+
env->start();
140144
gmodel = new GRBModel(*env);
141145

142146
assert(_model->objectives.size() == 1);
@@ -225,7 +229,11 @@ int GurobiSolver::solve(CompactModel& compact_model)
225229
{
226230
std::cout << "STARTING GUROBI" << std::endl << std::flush;
227231

228-
env = new GRBEnv();
232+
env = new GRBEnv(true);
233+
auto it = integer_options().find("OutputFlag");
234+
if (it != integer_options().end())
235+
env->set(GRB_IntParam_OutputFlag, it->second);
236+
env->start();
229237
gmodel = new GRBModel(*env);
230238

231239
std::cout << "BUILDING GUROBI MODEL" << std::endl << std::flush;
@@ -348,7 +356,11 @@ int GurobiSolver::resolve()
348356
auto _model = model.repn.get();
349357

350358
if (initial_solve()) {
351-
env = new GRBEnv();
359+
env = new GRBEnv(true);
360+
auto it = integer_options().find("OutputFlag");
361+
if (it != integer_options().end())
362+
env->set(GRB_IntParam_OutputFlag, it->second);
363+
env->start();
352364
gmodel = new GRBModel(*env);
353365

354366
assert(_model->objectives.size() == 1);

0 commit comments

Comments
 (0)