Skip to content

Commit 7e20f77

Browse files
committed
Several changes
1. More careful return of pre-computed values from available() 2. Adding diagnostic output when getting an unexpected termination condition
1 parent e28ff5e commit 7e20f77

File tree

5 files changed

+8
-3
lines changed

5 files changed

+8
-3
lines changed

lib/coek/coek/coek.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,5 @@
3939
#endif
4040

4141
#include "coek/solvers/solver.hpp"
42+
#include "coek/solvers/solver_results.hpp"
4243
#include "coek/util/sequence.hpp"

lib/coek/coek/solvers/gurobi/gurobi.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ GurobiSolver::~GurobiSolver()
142142

143143
bool GurobiSolver::available()
144144
{
145-
if (license_status == gurobi_license_status::available)
146-
return true;
145+
if (license_status != gurobi_license_status::unknown)
146+
return license_status == gurobi_license_status::available;
147147

148148
try {
149149
auto _env = new GRBEnv(true);

lib/coek/test/coek_gurobi_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ int main()
126126
else {
127127
// SECTION("simplelp1")
128128
{
129-
std::cout << "simplelp1" << std::endl;
129+
std::cout << "simplelp1 - license issue" << std::endl;
130130
auto solver = test_solver();
131131
auto test = test::model("simplelp1");
132132
auto m = test->model;

lib/coek/test/solver/test_examples.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,8 @@ TEST_CASE("gurobi_examples", "[solvers][gurobi]")
332332
auto ok
333333
= (res->termination_condition == coek::TerminationCondition::solver_not_available)
334334
or (res->termination_condition == coek::TerminationCondition::license_problems);
335+
if (not ok)
336+
std::cout << "Unexpected termination condition: " << coek::to_string(res->termination_condition) << std::endl;
335337
REQUIRE(ok == true);
336338
}
337339
// GCOVR_EXCL_STOP

lib/coek/test/solver/test_gurobi.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ TEST_CASE("gurobi_checks", "[solvers][gurobi]")
110110
auto ok
111111
= (res->termination_condition == coek::TerminationCondition::solver_not_available)
112112
or (res->termination_condition == coek::TerminationCondition::license_problems);
113+
if (not ok)
114+
std::cout << "Unexpected termination condition: " << coek::to_string(res->termination_condition) << std::endl;
113115
REQUIRE(ok == true);
114116
}
115117
// GCOVR_EXCL_STOP

0 commit comments

Comments
 (0)