MCPcopy Create free account
hub / github.com/ERGO-Code/HiGHS / testDualObjective

Function testDualObjective

check/TestLpSolvers.cpp:9–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7const bool dev_run = false;
8
9void testDualObjective(const std::string model) {
10 HighsStatus return_status;
11
12 Highs highs;
13 highs.setOptionValue("output_flag", dev_run);
14 std::string model_file =
15 std::string(HIGHS_DIR) + "/check/instances/" + model + ".mps";
16 highs.readModel(model_file);
17 return_status = highs.run();
18 REQUIRE(return_status == HighsStatus::kOk);
19 double dual_objective;
20 return_status = highs.getDualObjectiveValue(dual_objective);
21 REQUIRE(return_status == HighsStatus::kOk);
22 double primal_objective = highs.getInfo().objective_function_value;
23 double relative_primal_dual_gap =
24 std::fabs(primal_objective - dual_objective) /
25 std::max(1.0, std::fabs(primal_objective));
26 REQUIRE(relative_primal_dual_gap < 1e-12);
27
28 highs.resetGlobalScheduler(true);
29}
30
31TEST_CASE("mip-with-lp-solver", "[highs_lp_solver]") {
32 // When solving the relaxation of a MIP. Exposed #1406

Callers 1

TestLpSolvers.cppFile · 0.85

Calls 6

getDualObjectiveValueMethod · 0.80
resetGlobalSchedulerMethod · 0.80
setOptionValueMethod · 0.45
readModelMethod · 0.45
runMethod · 0.45
getInfoMethod · 0.45

Tested by

no test coverage detected