Skip to content

Commit 8bf85d4

Browse files
committed
Formatted
1 parent 0a8f562 commit 8bf85d4

File tree

7 files changed

+130
-149
lines changed

7 files changed

+130
-149
lines changed

check/TestBasisSolves.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -628,13 +628,12 @@ TEST_CASE("scaling-kappa", "[highs_basis_solves]") {
628628
// model = "avgas";
629629
// model = "adlittle";
630630
// model = "25fv47";
631-
model = "etamacro";
631+
model = "etamacro";
632632
std::string filename =
633633
std::string(HIGHS_DIR) + "/check/instances/" + model + ".mps";
634634
// Read the LP given by filename
635635
highs.readModel(filename);
636-
highs.setOptionValue("simplex_scale_strategy",
637-
kSimplexScaleStrategyCost);
636+
highs.setOptionValue("simplex_scale_strategy", kSimplexScaleStrategyCost);
638637
// kSimplexScaleStrategyMaxValueMatrixAndCost);
639638
highs.run();
640639
}

check/TestMipSolver.cpp

Lines changed: 34 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,24 +1123,25 @@ TEST_CASE("mip-sub-solver-time", "[highs_test_mip_solver]") {
11231123
REQUIRE(h.getModelStatus() == HighsModelStatus::kOptimal);
11241124
}
11251125

1126-
void getFixedLpRun(Highs& h,
1127-
const std::string& message,
1128-
const HighsModelStatus required_model_status,
1129-
const bool output_flag) {
1126+
void getFixedLpRun(Highs& h, const std::string& message,
1127+
const HighsModelStatus required_model_status,
1128+
const bool output_flag) {
11301129
h.setOptionValue("output_flag", output_flag);
1131-
std:string presolve;
1130+
std:
1131+
string presolve;
11321132
h.getOptionValue("presolve", presolve);
11331133
if (output_flag)
1134-
printf("\n============================================================"
1135-
"\n %s: presolve = %s"
1136-
"\n============================================================\n",
1137-
message.c_str(), presolve.c_str());
1134+
printf(
1135+
"\n============================================================"
1136+
"\n %s: presolve = %s"
1137+
"\n============================================================\n",
1138+
message.c_str(), presolve.c_str());
11381139
REQUIRE(h.run() == HighsStatus::kOk);
11391140
REQUIRE(h.getModelStatus() == required_model_status);
11401141
if (output_flag)
11411142
printf("\nSimplex iteration count = %d\n",
1142-
int(h.getInfo().simplex_iteration_count));
1143-
h.setOptionValue("output_flag", dev_run);
1143+
int(h.getInfo().simplex_iteration_count));
1144+
h.setOptionValue("output_flag", dev_run);
11441145
}
11451146

11461147
TEST_CASE("get-fixed-lp", "[highs_test_mip_solver]") {
@@ -1163,9 +1164,8 @@ TEST_CASE("get-fixed-lp", "[highs_test_mip_solver]") {
11631164
REQUIRE(h.readModel(model_file) == HighsStatus::kOk);
11641165
REQUIRE(h.getFixedLp(fixed_lp) == HighsStatus::kError);
11651166

1166-
getFixedLpRun(h, "Solving the original MIP",
1167-
HighsModelStatus::kOptimal,
1168-
output_flag);
1167+
getFixedLpRun(h, "Solving the original MIP", HighsModelStatus::kOptimal,
1168+
output_flag);
11691169
double mip_optimal_objective = h.getInfo().objective_function_value;
11701170
HighsSolution solution = h.getSolution();
11711171

@@ -1184,10 +1184,9 @@ TEST_CASE("get-fixed-lp", "[highs_test_mip_solver]") {
11841184
h.changeColsBounds(num_set_entries, col_set.data(), fixed_value.data(),
11851185
fixed_value.data());
11861186
h.setOptionValue("presolve", kHighsOffString);
1187-
getFixedLpRun(h,
1188-
"Solving the externally fixed LP using the MIP solution as retained",
1189-
HighsModelStatus::kOptimal,
1190-
output_flag);
1187+
getFixedLpRun(
1188+
h, "Solving the externally fixed LP using the MIP solution as retained",
1189+
HighsModelStatus::kOptimal, output_flag);
11911190
REQUIRE(objectiveOk(mip_optimal_objective,
11921191
h.getInfo().objective_function_value, dev_run));
11931192
// In calling changeColsBounds, the incumbent solution was always
@@ -1206,51 +1205,42 @@ TEST_CASE("get-fixed-lp", "[highs_test_mip_solver]") {
12061205
// optimal, so no simplex iterations are required
12071206
h.clearSolver();
12081207
h.setSolution(solution);
1209-
getFixedLpRun(h,
1210-
"Solving the externally fixed LP using the MIP solution as passed",
1211-
HighsModelStatus::kOptimal,
1212-
output_flag);
1208+
getFixedLpRun(
1209+
h, "Solving the externally fixed LP using the MIP solution as passed",
1210+
HighsModelStatus::kOptimal, output_flag);
12131211
REQUIRE(objectiveOk(mip_optimal_objective,
12141212
h.getInfo().objective_function_value, dev_run));
12151213
REQUIRE(h.getInfo().simplex_iteration_count == 0);
12161214

12171215
// Now re-load the MIP, re-solve, and get the fixed LP
12181216
REQUIRE(h.passModel(mip) == HighsStatus::kOk);
1219-
getFixedLpRun(h,
1220-
"Solving the original MIP",
1221-
HighsModelStatus::kOptimal,
1222-
false);
1217+
getFixedLpRun(h, "Solving the original MIP", HighsModelStatus::kOptimal,
1218+
false);
12231219
REQUIRE(objectiveOk(mip_optimal_objective,
12241220
h.getInfo().objective_function_value, dev_run));
12251221

12261222
// Get the fixed LP
12271223
REQUIRE(h.getFixedLp(fixed_lp) == HighsStatus::kOk);
12281224

12291225
REQUIRE(h.passModel(fixed_lp) == HighsStatus::kOk);
1230-
getFixedLpRun(h,
1231-
"Solving the extracted fixed LP from a logical basis",
1232-
HighsModelStatus::kOptimal,
1233-
output_flag);
1226+
getFixedLpRun(h, "Solving the extracted fixed LP from a logical basis",
1227+
HighsModelStatus::kOptimal, output_flag);
12341228
REQUIRE(objectiveOk(mip_optimal_objective,
12351229
h.getInfo().objective_function_value, dev_run));
12361230

12371231
h.clearSolver();
12381232
h.setOptionValue("presolve", kHighsOnString);
1239-
getFixedLpRun(h,
1240-
"Solving the extracted fixed LP from a logical basis",
1241-
HighsModelStatus::kOptimal,
1242-
output_flag);
1233+
getFixedLpRun(h, "Solving the extracted fixed LP from a logical basis",
1234+
HighsModelStatus::kOptimal, output_flag);
12431235
REQUIRE(objectiveOk(mip_optimal_objective,
12441236
h.getInfo().objective_function_value, dev_run));
12451237
h.setOptionValue("presolve", kHighsOffString);
12461238

12471239
// Now run from saved solution (without presolve)
12481240
h.clearSolver();
12491241
h.setSolution(solution);
1250-
getFixedLpRun(h,
1251-
"Solving the extracted fixed LP with saved solution",
1252-
HighsModelStatus::kOptimal,
1253-
output_flag);
1242+
getFixedLpRun(h, "Solving the extracted fixed LP with saved solution",
1243+
HighsModelStatus::kOptimal, output_flag);
12541244
REQUIRE(objectiveOk(mip_optimal_objective,
12551245
h.getInfo().objective_function_value, dev_run));
12561246
REQUIRE(h.getInfo().simplex_iteration_count == 0);
@@ -1262,21 +1252,17 @@ TEST_CASE("get-fixed-lp", "[highs_test_mip_solver]") {
12621252
std::vector<HighsVarType> integrality = h.getLp().integrality_;
12631253
for (HighsInt iCol = 0; iCol < fixed_lp.num_col_; iCol++) {
12641254
if (integrality[iCol] != HighsVarType::kContinuous) {
1265-
solution.col_value[iCol] -= 0.01;
1266-
break;
1255+
solution.col_value[iCol] -= 0.01;
1256+
break;
12671257
}
12681258
}
1269-
getFixedLpRun(h,
1270-
"Solving the original MIP so solution can be set",
1271-
HighsModelStatus::kOptimal,
1272-
false);
1259+
getFixedLpRun(h, "Solving the original MIP so solution can be set",
1260+
HighsModelStatus::kOptimal, false);
12731261
h.setSolution(solution);
12741262
REQUIRE(h.getFixedLp(fixed_lp) == HighsStatus::kWarning);
12751263
REQUIRE(h.passModel(fixed_lp) == HighsStatus::kOk);
1276-
getFixedLpRun(h,
1277-
"Solving the extracted LP fixed to be infeasible",
1278-
HighsModelStatus::kInfeasible,
1279-
output_flag);
1264+
getFixedLpRun(h, "Solving the extracted LP fixed to be infeasible",
1265+
HighsModelStatus::kInfeasible, output_flag);
12801266
REQUIRE(h.getModelStatus() == HighsModelStatus::kInfeasible);
12811267
}
12821268

highs/lp_data/HConst.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ enum class HighsLogType { kInfo = 1, kDetailed, kVerbose, kWarning, kError };
5151

5252
enum SimplexScaleStrategy {
5353
kSimplexScaleStrategyMin = -1,
54-
kSimplexScaleStrategyCost = kSimplexScaleStrategyMin, // -1
55-
kSimplexScaleStrategyOff, // 0
56-
kSimplexScaleStrategyChoose, // 1
57-
kSimplexScaleStrategyEquilibration, // 2
58-
kSimplexScaleStrategyForcedEquilibration, // 3
59-
kSimplexScaleStrategyMaxValue, // 4
60-
kSimplexScaleStrategyMaxValueMatrixAndCost, // 5
54+
kSimplexScaleStrategyCost = kSimplexScaleStrategyMin, // -1
55+
kSimplexScaleStrategyOff, // 0
56+
kSimplexScaleStrategyChoose, // 1
57+
kSimplexScaleStrategyEquilibration, // 2
58+
kSimplexScaleStrategyForcedEquilibration, // 3
59+
kSimplexScaleStrategyMaxValue, // 4
60+
kSimplexScaleStrategyMaxValueMatrixAndCost, // 5
6161
kSimplexScaleStrategyMax = kSimplexScaleStrategyMaxValueMatrixAndCost
6262
};
6363

highs/lp_data/HighsLpUtils.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,8 @@ bool lpDimensionsOk(std::string message, const HighsLp& lp,
205205
ok = legal_a_matrix_num_row && ok;
206206

207207
HighsInt scale_strategy = (HighsInt)lp.scale_.strategy;
208-
bool legal_scale_strategy =
209-
kSimplexScaleStrategyMin <= scale_strategy &&
210-
scale_strategy <= kSimplexScaleStrategyMax;
208+
bool legal_scale_strategy = kSimplexScaleStrategyMin <= scale_strategy &&
209+
scale_strategy <= kSimplexScaleStrategyMax;
211210
if (!legal_scale_strategy)
212211
highsLogUser(
213212
log_options, HighsLogType::kError,

highs/simplex/HApp.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,9 +424,11 @@ inline HighsStatus solveLpSimplex(HighsLpSolverObject& solver_object) {
424424
(scaled_model_status != HighsModelStatus::kObjectiveTarget);
425425
assert(force_phase2 == !force_phase1);
426426
if (kSimplexScaleDevReport) {
427-
printf("\n====================\n"
428-
"Model %s requires the unscaled LP to be solved with scaled NLA\n"
429-
"====================\n\n", ekk_lp.model_name_.c_str());
427+
printf(
428+
"\n====================\n"
429+
"Model %s requires the unscaled LP to be solved with scaled NLA\n"
430+
"====================\n\n",
431+
ekk_lp.model_name_.c_str());
430432
}
431433
return_status = ekk_instance.solve(force_phase2);
432434
solved_unscaled_lp = true;

highs/simplex/HEkk.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3612,8 +3612,6 @@ HighsStatus HEkk::returnFromSolve(const HighsStatus return_status) {
36123612

36133613
void HEkk::testBasisCondition(const HighsLp& lp,
36143614
const std::string& message) const {
3615-
return;
3616-
/*
36173615
double exact_kappa_tt = -timer_->read();
36183616
bool exact = true;
36193617
double exact_kappa = this->computeBasisCondition(lp, exact);
@@ -3627,7 +3625,6 @@ void HEkk::testBasisCondition(const HighsLp& lp,
36273625
"getKappa,%s,%g,%g,%g,%g,%s,%s\n", lp.model_name_.c_str(),
36283626
exact_kappa, exact_kappa_tt, approx_kappa, approx_kappa_tt,
36293627
message.c_str(), lp.origin_name_.c_str());
3630-
*/
36313628
}
36323629

36333630
double HEkk::computeBasisCondition(const HighsLp& lp, const bool exact) const {

0 commit comments

Comments
 (0)