| 28 | } |
| 29 | |
| 30 | void testPrimalDualObjective(Highs& h, |
| 31 | const double required_objective_function_value) { |
| 32 | const HighsInfo& info = h.getInfo(); |
| 33 | double objective_function_value = info.objective_function_value; |
| 34 | const HighsSolution& solution = h.getSolution(); |
| 35 | double alt_objective_function_value = |
| 36 | h.getModel().objectiveValue(solution.col_value); |
| 37 | double dual_objective_function_value; |
| 38 | REQUIRE(h.getDualObjectiveValue(dual_objective_function_value) == |
| 39 | HighsStatus::kOk); |
| 40 | double alt_objective_function_value_error = |
| 41 | fabs(objective_function_value - alt_objective_function_value); |
| 42 | if (dev_run) |
| 43 | printf( |
| 44 | "(Primal, Alt, Dual) objective = (%17.10g, %17.10g, %17.10g) alt error " |
| 45 | "= %17.10g; P-D error = %17.10g\n", |
| 46 | objective_function_value, alt_objective_function_value, |
| 47 | dual_objective_function_value, alt_objective_function_value_error, |
| 48 | info.primal_dual_objective_error); |
| 49 | REQUIRE(okValueDifference(objective_function_value, |
| 50 | required_objective_function_value)); |
| 51 | REQUIRE(okValueDifference(dual_objective_function_value, |
| 52 | required_objective_function_value)); |
| 53 | REQUIRE(okValueDifference(alt_objective_function_value, |
| 54 | required_objective_function_value)); |
| 55 | double optimality_tolerance; |
| 56 | h.getOptionValue("optimality_tolerance", optimality_tolerance); |
| 57 | REQUIRE(fabs(info.primal_dual_objective_error) < optimality_tolerance); |
| 58 | } |
| 59 | |
| 60 | TEST_CASE("qp-unbounded", "[qpsolver]") { |
| 61 | std::string filename; |
no test coverage detected