Skip to content

Commit 2296b3c

Browse files
committed
Add test for new orderings
1 parent 387dd37 commit 2296b3c

File tree

1 file changed

+52
-1
lines changed

1 file changed

+52
-1
lines changed

check/TestHipo.cpp

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include <iostream>
1717
#include <vector>
1818

19-
const bool dev_run = false;
19+
const bool dev_run = true;
2020

2121
TEST_CASE("test-hipo-afiro", "[highs_hipo]") {
2222
// Test that hipo runs and finds correct solution for afiro
@@ -84,4 +84,55 @@ TEST_CASE("test-hipo-deterministic", "[highs_hipo]") {
8484
REQUIRE(solution_1.row_value == solution_2.row_value);
8585
REQUIRE(solution_1.col_dual == solution_2.col_dual);
8686
REQUIRE(solution_1.row_dual == solution_2.row_dual);
87+
}
88+
89+
TEST_CASE("test-hipo-orderings", "[highs_hipo]") {
90+
// Test that hipo orderings work correctly
91+
92+
std::string model = "adlittle.mps";
93+
const double expected_obj = 2.2549e5;
94+
95+
Highs highs;
96+
highs.setOptionValue("output_flag", dev_run);
97+
highs.setOptionValue("solver", kHipoString);
98+
highs.setOptionValue("timeless_log", kHighsOnString);
99+
100+
std::string filename = std::string(HIGHS_DIR) + "/check/instances/" + model;
101+
highs.readModel(filename);
102+
103+
// metis
104+
{
105+
highs.setOptionValue(kHipoOrderingString, kHipoMetisString);
106+
HighsStatus status = highs.run();
107+
REQUIRE(status == HighsStatus::kOk);
108+
109+
const double actual_obj = highs.getObjectiveValue();
110+
111+
REQUIRE(std::abs(actual_obj - expected_obj) / std::abs(expected_obj) <
112+
1e-4);
113+
}
114+
115+
// amd
116+
{
117+
highs.setOptionValue(kHipoOrderingString, kHipoAmdString);
118+
HighsStatus status = highs.run();
119+
REQUIRE(status == HighsStatus::kOk);
120+
121+
const double actual_obj = highs.getObjectiveValue();
122+
REQUIRE(std::abs(actual_obj - expected_obj) / std::abs(expected_obj) <
123+
1e-4);
124+
}
125+
126+
// rcm
127+
{
128+
highs.setOptionValue(kHipoOrderingString, kHipoRcmString);
129+
HighsStatus status = highs.run();
130+
REQUIRE(status == HighsStatus::kOk);
131+
132+
const double actual_obj = highs.getObjectiveValue();
133+
REQUIRE(std::abs(actual_obj - expected_obj) / std::abs(expected_obj) <
134+
1e-4);
135+
}
136+
137+
highs.resetGlobalScheduler(true);
87138
}

0 commit comments

Comments
 (0)