-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2053 from ERGO-Code/fix-1873
Added blending and lexicographic handling of multiple linear objectives
- Loading branch information
Showing
27 changed files
with
1,087 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
#include "HCheckConfig.h" | ||
#include "catch.hpp" | ||
#include "util/HighsCDouble.h" | ||
#include "util/HighsRandom.h" | ||
|
||
void testCeil(HighsCDouble x) { | ||
double ceil_x; | ||
double double_x; | ||
ceil_x = double(ceil(x)); | ||
double_x = double(x); | ||
REQUIRE(ceil_x >= double_x); | ||
REQUIRE(ceil(x) >= x); | ||
} | ||
|
||
void testFloor(HighsCDouble x) { | ||
double floor_x; | ||
double double_x; | ||
floor_x = double(floor(x)); | ||
double_x = double(x); | ||
REQUIRE(floor_x <= double_x); | ||
REQUIRE(floor(x) <= x); | ||
} | ||
|
||
TEST_CASE("HighsCDouble-ceil", "[util]") { | ||
HighsCDouble x; | ||
x = -1e-34; | ||
testCeil(x); | ||
x = -1e-32; | ||
testCeil(x); | ||
x = -1e-30; | ||
testCeil(x); | ||
x = -1e-23; | ||
testCeil(x); | ||
x = -1e-12; | ||
testCeil(x); | ||
x = -1e-1; | ||
testCeil(x); | ||
x = -0.99; | ||
testCeil(x); | ||
|
||
x = 0.99; | ||
testCeil(x); | ||
x = 1e-1; | ||
testCeil(x); | ||
x = 1e-12; | ||
testCeil(x); | ||
// This and rest failed in #2041 | ||
x = 1e-23; | ||
testCeil(x); | ||
x = 1e-30; | ||
testCeil(x); | ||
x = 1e-32; | ||
testCeil(x); | ||
x = 1e-34; | ||
testCeil(x); | ||
|
||
HighsRandom rand; | ||
for (HighsInt k = 0; k < 1000; k++) { | ||
double man = rand.fraction(); | ||
HighsInt power = 2 - rand.integer(5); | ||
double exp = std::pow(10, power); | ||
x = man * exp; | ||
testCeil(x); | ||
} | ||
} | ||
|
||
TEST_CASE("HighsCDouble-floor", "[util]") { | ||
HighsCDouble x; | ||
|
||
x = 1e-34; | ||
testFloor(x); | ||
x = 1e-32; | ||
testFloor(x); | ||
x = 1e-30; | ||
testFloor(x); | ||
x = 1e-23; | ||
testFloor(x); | ||
x = 1e-12; | ||
testFloor(x); | ||
x = 1e-1; | ||
testFloor(x); | ||
x = 0.99; | ||
testFloor(x); | ||
|
||
x = -0.99; | ||
testFloor(x); | ||
x = -1e-1; | ||
testFloor(x); | ||
x = -1e-12; | ||
testFloor(x); | ||
// This and rest failed in #2041 | ||
x = -1e-23; | ||
testFloor(x); | ||
x = -1e-30; | ||
testFloor(x); | ||
x = -1e-32; | ||
testFloor(x); | ||
x = -1e-34; | ||
testFloor(x); | ||
|
||
HighsRandom rand; | ||
for (HighsInt k = 0; k < 1000; k++) { | ||
double man = rand.fraction(); | ||
HighsInt power = 2 - rand.integer(5); | ||
double exp = std::pow(10, power); | ||
x = man * exp; | ||
testFloor(x); | ||
} | ||
} |
Oops, something went wrong.