@@ -16,31 +16,31 @@ TEST_CASE("pdlp-distillation-lp", "[pdlp]") {
1616 double optimal_objective;
1717 special_lps.distillationLp (lp, require_model_status, optimal_objective);
1818
19- Highs highs ;
20- highs .setOptionValue (" output_flag" , dev_run);
21- const HighsInfo& info = highs .getInfo ();
22- const HighsOptions& options = highs .getOptions ();
23- REQUIRE (highs .passModel (lp) == HighsStatus::kOk );
24- highs .setOptionValue (" solver" , kPdlpString );
25- highs .setOptionValue (" presolve" , kHighsOffString );
26- highs .setOptionValue (" kkt_tolerance" , kkt_tolerance);
19+ Highs h ;
20+ h .setOptionValue (" output_flag" , dev_run);
21+ const HighsInfo& info = h .getInfo ();
22+ const HighsOptions& options = h .getOptions ();
23+ REQUIRE (h .passModel (lp) == HighsStatus::kOk );
24+ h .setOptionValue (" solver" , kPdlpString );
25+ h .setOptionValue (" presolve" , kHighsOffString );
26+ h .setOptionValue (" kkt_tolerance" , kkt_tolerance);
2727 HighsStatus run_status = HighsStatus::kOk ;
2828 bool optimal = true ;
2929
3030 const HighsInt pdlp_iteration_count_optimal = 160 ;
31- run_status = highs .run ();
32- if (dev_run) highs .writeSolution (" " , 1 );
31+ run_status = h .run ();
32+ if (dev_run) h .writeSolution (" " , 1 );
3333 REQUIRE (std::abs (info.objective_function_value - optimal_objective) <
3434 double_equal_tolerance);
3535 if (optimal) {
3636 REQUIRE (run_status == HighsStatus::kOk );
37- REQUIRE (highs .getModelStatus () == HighsModelStatus::kOptimal );
37+ REQUIRE (h .getModelStatus () == HighsModelStatus::kOptimal );
3838 } else {
3939 REQUIRE (run_status == HighsStatus::kWarning );
40- REQUIRE (highs .getModelStatus () == HighsModelStatus::kUnknown );
40+ REQUIRE (h .getModelStatus () == HighsModelStatus::kUnknown );
4141 }
4242
43- HighsInt pdlp_iteration_count = highs .getInfo ().pdlp_iteration_count ;
43+ HighsInt pdlp_iteration_count = h .getInfo ().pdlp_iteration_count ;
4444 REQUIRE (pdlp_iteration_count > 0 );
4545 REQUIRE (pdlp_iteration_count == pdlp_iteration_count_optimal);
4646
@@ -49,19 +49,18 @@ TEST_CASE("pdlp-distillation-lp", "[pdlp]") {
4949 //
5050 // Now that PDLP hot starts, have to clear the solution
5151 //
52- highs .clearSolver ();
52+ h .clearSolver ();
5353
54- highs.setOptionValue (" pdlp_iteration_limit" ,
55- pdlp_iteration_count_optimal / 2 );
56- run_status = highs.run ();
54+ h.setOptionValue (" pdlp_iteration_limit" , pdlp_iteration_count_optimal / 2 );
55+ run_status = h.run ();
5756
5857 REQUIRE (run_status == HighsStatus::kWarning );
59- REQUIRE (highs .getModelStatus () == HighsModelStatus::kIterationLimit );
60- pdlp_iteration_count = highs .getInfo ().pdlp_iteration_count ;
58+ REQUIRE (h .getModelStatus () == HighsModelStatus::kIterationLimit );
59+ pdlp_iteration_count = h .getInfo ().pdlp_iteration_count ;
6160 REQUIRE (pdlp_iteration_count > 0 );
6261 REQUIRE (pdlp_iteration_count == (pdlp_iteration_count_optimal / 2 ) - 1 );
6362
64- highs .resetGlobalScheduler (true );
63+ h .resetGlobalScheduler (true );
6564}
6665#else
6766// CUPDLP_GPU
@@ -73,47 +72,47 @@ TEST_CASE("pdlp-distillation-lp", "[pdlp]") {
7372 double optimal_objective;
7473 special_lps.distillationLp (lp, require_model_status, optimal_objective);
7574
76- Highs highs ;
77- highs .setOptionValue (" output_flag" , dev_run);
78- const HighsInfo& info = highs .getInfo ();
79- const HighsOptions& options = highs .getOptions ();
80- REQUIRE (highs .passModel (lp) == HighsStatus::kOk );
81- highs .setOptionValue (" solver" , kPdlpString );
82- highs .setOptionValue (" presolve" , kHighsOffString );
83- highs .setOptionValue (" kkt_tolerance" , kkt_tolerance);
75+ Highs h ;
76+ h .setOptionValue (" output_flag" , dev_run);
77+ const HighsInfo& info = h .getInfo ();
78+ const HighsOptions& options = h .getOptions ();
79+ REQUIRE (h .passModel (lp) == HighsStatus::kOk );
80+ h .setOptionValue (" solver" , kPdlpString );
81+ h .setOptionValue (" presolve" , kHighsOffString );
82+ h .setOptionValue (" kkt_tolerance" , kkt_tolerance);
8483 HighsStatus run_status = HighsStatus::kOk ;
8584 bool optimal = true ;
8685
87- run_status = highs .run ();
88- if (dev_run) highs .writeSolution (" " , 1 );
86+ run_status = h .run ();
87+ if (dev_run) h .writeSolution (" " , 1 );
8988 REQUIRE (std::abs (info.objective_function_value - optimal_objective) <
9089 double_equal_tolerance);
9190 if (optimal) {
9291 REQUIRE (run_status == HighsStatus::kOk );
93- REQUIRE (highs .getModelStatus () == HighsModelStatus::kOptimal );
92+ REQUIRE (h .getModelStatus () == HighsModelStatus::kOptimal );
9493 } else {
9594 REQUIRE (run_status == HighsStatus::kWarning );
96- REQUIRE (highs .getModelStatus () == HighsModelStatus::kUnknown );
95+ REQUIRE (h .getModelStatus () == HighsModelStatus::kUnknown );
9796 }
9897
9998 // IG todo add iteration count
100- // HighsInt pdlp_iteration_count = highs .getInfo().pdlp_iteration_count;
99+ // HighsInt pdlp_iteration_count = h .getInfo().pdlp_iteration_count;
101100 // REQUIRE(pdlp_iteration_count > 0);
102101 // REQUIRE(pdlp_iteration_count == 160);
103102
104103 // Now run with half the iteration count as the limit to test
105104 // iteration limit termination
106105
107- // highs .setOptionValue("pdlp_iteration_limit", pdlp_iteration_count / 2);
108- // run_status = highs .run();
106+ // h .setOptionValue("pdlp_iteration_limit", pdlp_iteration_count / 2);
107+ // run_status = h .run();
109108
110109 // REQUIRE(run_status == HighsStatus::kWarning);
111- // REQUIRE(highs .getModelStatus() == HighsModelStatus::kIterationLimit);
112- // pdlp_iteration_count = highs .getInfo().pdlp_iteration_count;
110+ // REQUIRE(h .getModelStatus() == HighsModelStatus::kIterationLimit);
111+ // pdlp_iteration_count = h .getInfo().pdlp_iteration_count;
113112 // REQUIRE(pdlp_iteration_count > 0);
114113 // REQUIRE(pdlp_iteration_count == 79);
115114
116- highs .resetGlobalScheduler (true );
115+ h .resetGlobalScheduler (true );
117116}
118117#endif
119118
@@ -125,28 +124,28 @@ TEST_CASE("pdlp-3d-lp", "[pdlp]") {
125124 double optimal_objective;
126125 special_lps.ThreeDLp (lp, require_model_status, optimal_objective);
127126
128- Highs highs ;
129- highs .setOptionValue (" output_flag" , dev_run);
130- const HighsInfo& info = highs .getInfo ();
131- const HighsOptions& options = highs .getOptions ();
132- REQUIRE (highs .passModel (lp) == HighsStatus::kOk );
133- highs .setOptionValue (" solver" , kPdlpString );
134- highs .setOptionValue (" presolve" , kHighsOffString );
135- highs .setOptionValue (" kkt_tolerance" , kkt_tolerance);
136- HighsStatus run_status = highs .run ();
137- if (dev_run) highs .writeSolution (" " , 1 );
127+ Highs h ;
128+ h .setOptionValue (" output_flag" , dev_run);
129+ const HighsInfo& info = h .getInfo ();
130+ const HighsOptions& options = h .getOptions ();
131+ REQUIRE (h .passModel (lp) == HighsStatus::kOk );
132+ h .setOptionValue (" solver" , kPdlpString );
133+ h .setOptionValue (" presolve" , kHighsOffString );
134+ h .setOptionValue (" kkt_tolerance" , kkt_tolerance);
135+ HighsStatus run_status = h .run ();
136+ if (dev_run) h .writeSolution (" " , 1 );
138137 REQUIRE (std::abs (info.objective_function_value - optimal_objective) <
139138 double_equal_tolerance);
140139 const bool optimal = true ;
141140 if (optimal) {
142141 REQUIRE (run_status == HighsStatus::kOk );
143- REQUIRE (highs .getModelStatus () == HighsModelStatus::kOptimal );
142+ REQUIRE (h .getModelStatus () == HighsModelStatus::kOptimal );
144143 } else {
145144 REQUIRE (run_status == HighsStatus::kWarning );
146- REQUIRE (highs .getModelStatus () == HighsModelStatus::kUnknown );
145+ REQUIRE (h .getModelStatus () == HighsModelStatus::kUnknown );
147146 }
148147
149- highs .resetGlobalScheduler (true );
148+ h .resetGlobalScheduler (true );
150149}
151150
152151TEST_CASE (" pdlp-boxed-row-lp" , " [pdlp]" ) {
@@ -162,27 +161,27 @@ TEST_CASE("pdlp-boxed-row-lp", "[pdlp]") {
162161 lp.a_matrix_ .index_ = {0 , 1 , 0 , 1 };
163162 lp.a_matrix_ .value_ = {1 , 1 , 1 , -1 };
164163 double optimal_objective = -16 ;
165- Highs highs ;
166- highs .setOptionValue (" output_flag" , dev_run);
167- const HighsInfo& info = highs .getInfo ();
168- REQUIRE (highs .passModel (lp) == HighsStatus::kOk );
169- highs .setOptionValue (" solver" , kPdlpString );
170- highs .setOptionValue (" presolve" , kHighsOffString );
171- highs .setOptionValue (" kkt_tolerance" , kkt_tolerance);
172- HighsStatus run_status = highs .run ();
173- if (dev_run) highs .writeSolution (" " , 1 );
164+ Highs h ;
165+ h .setOptionValue (" output_flag" , dev_run);
166+ const HighsInfo& info = h .getInfo ();
167+ REQUIRE (h .passModel (lp) == HighsStatus::kOk );
168+ h .setOptionValue (" solver" , kPdlpString );
169+ h .setOptionValue (" presolve" , kHighsOffString );
170+ h .setOptionValue (" kkt_tolerance" , kkt_tolerance);
171+ HighsStatus run_status = h .run ();
172+ if (dev_run) h .writeSolution (" " , 1 );
174173 REQUIRE (std::abs (info.objective_function_value - optimal_objective) <
175174 double_equal_tolerance);
176175 const bool optimal = true ;
177176 if (optimal) {
178177 REQUIRE (run_status == HighsStatus::kOk );
179- REQUIRE (highs .getModelStatus () == HighsModelStatus::kOptimal );
178+ REQUIRE (h .getModelStatus () == HighsModelStatus::kOptimal );
180179 } else {
181180 REQUIRE (run_status == HighsStatus::kWarning );
182- REQUIRE (highs .getModelStatus () == HighsModelStatus::kUnknown );
181+ REQUIRE (h .getModelStatus () == HighsModelStatus::kUnknown );
183182 }
184183
185- highs .resetGlobalScheduler (true );
184+ h .resetGlobalScheduler (true );
186185}
187186
188187TEST_CASE (" pdlp-infeasible-lp" , " [pdlp]" ) {
@@ -197,17 +196,17 @@ TEST_CASE("pdlp-infeasible-lp", "[pdlp]") {
197196 lp.a_matrix_ .start_ = {0 , 1 , 2 };
198197 lp.a_matrix_ .index_ = {0 , 0 };
199198 lp.a_matrix_ .value_ = {1 , 1 };
200- Highs highs ;
201- highs .setOptionValue (" output_flag" , dev_run);
202- REQUIRE (highs .passModel (lp) == HighsStatus::kOk );
203- highs .setOptionValue (" solver" , kPdlpString );
204- highs .setOptionValue (" presolve" , kHighsOffString );
205- highs .setOptionValue (" kkt_tolerance" , kkt_tolerance);
206- REQUIRE (highs .run () == HighsStatus::kOk );
207- if (dev_run) highs .writeSolution (" " , 1 );
208- REQUIRE (highs .getModelStatus () == HighsModelStatus::kUnboundedOrInfeasible );
209-
210- highs .resetGlobalScheduler (true );
199+ Highs h ;
200+ h .setOptionValue (" output_flag" , dev_run);
201+ REQUIRE (h .passModel (lp) == HighsStatus::kOk );
202+ h .setOptionValue (" solver" , kPdlpString );
203+ h .setOptionValue (" presolve" , kHighsOffString );
204+ h .setOptionValue (" kkt_tolerance" , kkt_tolerance);
205+ REQUIRE (h .run () == HighsStatus::kOk );
206+ if (dev_run) h .writeSolution (" " , 1 );
207+ REQUIRE (h .getModelStatus () == HighsModelStatus::kUnboundedOrInfeasible );
208+
209+ h .resetGlobalScheduler (true );
211210}
212211
213212TEST_CASE (" pdlp-unbounded-lp" , " [pdlp]" ) {
@@ -222,22 +221,22 @@ TEST_CASE("pdlp-unbounded-lp", "[pdlp]") {
222221 lp.a_matrix_ .start_ = {0 , 1 , 2 };
223222 lp.a_matrix_ .index_ = {0 , 0 };
224223 lp.a_matrix_ .value_ = {1 , 1 };
225- Highs highs ;
226- highs .setOptionValue (" output_flag" , dev_run);
227- REQUIRE (highs .passModel (lp) == HighsStatus::kOk );
228- highs .setOptionValue (" solver" , kPdlpString );
229- highs .setOptionValue (" presolve" , kHighsOffString );
230- highs .setOptionValue (" kkt_tolerance" , kkt_tolerance);
231- REQUIRE (highs .run () == HighsStatus::kOk );
232- if (dev_run) highs .writeSolution (" " , 1 );
224+ Highs h ;
225+ h .setOptionValue (" output_flag" , dev_run);
226+ REQUIRE (h .passModel (lp) == HighsStatus::kOk );
227+ h .setOptionValue (" solver" , kPdlpString );
228+ h .setOptionValue (" presolve" , kHighsOffString );
229+ h .setOptionValue (" kkt_tolerance" , kkt_tolerance);
230+ REQUIRE (h .run () == HighsStatus::kOk );
231+ if (dev_run) h .writeSolution (" " , 1 );
233232 const bool not_unbounded = false ;
234233 if (not_unbounded) {
235- REQUIRE (highs .getModelStatus () == HighsModelStatus::kUnboundedOrInfeasible );
234+ REQUIRE (h .getModelStatus () == HighsModelStatus::kUnboundedOrInfeasible );
236235 } else {
237- REQUIRE (highs .getModelStatus () == HighsModelStatus::kUnbounded );
236+ REQUIRE (h .getModelStatus () == HighsModelStatus::kUnbounded );
238237 }
239238
240- highs .resetGlobalScheduler (true );
239+ h .resetGlobalScheduler (true );
241240}
242241
243242void pdlpRestart (const std::string& model) {
@@ -252,13 +251,13 @@ void pdlpRestart(const std::string& model) {
252251 const bool was_optimal = h.getModelStatus () == HighsModelStatus::kOptimal ;
253252 h.setOptionValue (" presolve" , kHighsOffString );
254253 run_status = h.run ();
254+ h.resetGlobalScheduler (true );
255255}
256256
257257TEST_CASE (" pdlp-restart" , " [pdlp]" ) {
258258 pdlpRestart (" adlittle" );
259259 // pdlpRestart("shell");
260260 // pdlpRestart("25fv47");
261- highs.resetGlobalScheduler (true );
262261}
263262
264263TEST_CASE (" pdlp-restart-lp" , " [pdlp]" ) {
@@ -286,7 +285,7 @@ TEST_CASE("pdlp-restart-lp", "[pdlp]") {
286285
287286 h.setOptionValue (" presolve" , kHighsOffString );
288287 run_status = h.run ();
289- highs .resetGlobalScheduler (true );
288+ h .resetGlobalScheduler (true );
290289}
291290
292291TEST_CASE (" pdlp-restart-add-row" , " [pdlp]" ) {
@@ -330,7 +329,7 @@ TEST_CASE("pdlp-restart-add-row", "[pdlp]") {
330329 h.setSolution (solution);
331330 run_status = h.run ();
332331 if (dev_run) h.writeSolution (" " , 1 );
333- highs .resetGlobalScheduler (true );
332+ h .resetGlobalScheduler (true );
334333}
335334
336335TEST_CASE (" hi-pdlp" , " [pdlp]" ) {
@@ -360,5 +359,5 @@ TEST_CASE("hi-pdlp", "[pdlp]") {
360359 h.setOptionValue (" pdlp_features_off" , kPdlpAllFeaturesOff );
361360 run_status = h.run ();
362361 }
363- highs .resetGlobalScheduler (true );
362+ h .resetGlobalScheduler (true );
364363}
0 commit comments