From 258c74cd75c298ab9b02fbcfc0da6fef1402fe10 Mon Sep 17 00:00:00 2001 From: jajhall Date: Fri, 15 Nov 2024 23:10:28 +0000 Subject: [PATCH] Investigating --- check/TestCheckSolution.cpp | 2 +- check/TestHighsIntegers.cpp | 1 + check/TestMipSolver.cpp | 8 ++++---- src/util/HighsCDouble.h | 9 ++++++++- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/check/TestCheckSolution.cpp b/check/TestCheckSolution.cpp index e24499f3b6..a4bc79ae87 100644 --- a/check/TestCheckSolution.cpp +++ b/check/TestCheckSolution.cpp @@ -1,4 +1,4 @@ -//#include +// #include #include #include "HCheckConfig.h" diff --git a/check/TestHighsIntegers.cpp b/check/TestHighsIntegers.cpp index 5d1aece96b..aff8449ed8 100644 --- a/check/TestHighsIntegers.cpp +++ b/check/TestHighsIntegers.cpp @@ -43,6 +43,7 @@ TEST_CASE("HighsIntegers", "[util]") { TEST_CASE("HighsCdouble-ceil", "[util]") { // For fix-2041 HighsCDouble a = 1e-23; + a = 1e-12; double ceil_a; double double_a; ceil_a = double(ceil(a)); diff --git a/check/TestMipSolver.cpp b/check/TestMipSolver.cpp index cfbe1ffbf2..ecb3502316 100644 --- a/check/TestMipSolver.cpp +++ b/check/TestMipSolver.cpp @@ -679,16 +679,16 @@ TEST_CASE("IP-infeasible-unbounded", "[highs_test_mip_solver]") { highs.run(); HighsModelStatus required_model_status; if (k == 0) { - // Presolve off + // Presolve off if (l == 0) { - // MIP solver proves infeasiblilty + // MIP solver proves infeasiblilty required_model_status = HighsModelStatus::kInfeasible; } else { - // Relaxation is unbounded, but origin is feasible + // Relaxation is unbounded, but origin is feasible required_model_status = HighsModelStatus::kUnbounded; } } else { - // Presolve on, and identifies primal infeasible or unbounded + // Presolve on, and identifies primal infeasible or unbounded required_model_status = HighsModelStatus::kUnboundedOrInfeasible; } REQUIRE(highs.getModelStatus() == required_model_status); diff --git a/src/util/HighsCDouble.h b/src/util/HighsCDouble.h index b02622d162..741809b079 100644 --- a/src/util/HighsCDouble.h +++ b/src/util/HighsCDouble.h @@ -300,7 +300,14 @@ class HighsCDouble { double ceil_x = std::ceil(double(x)); HighsCDouble res; - two_sum(res.hi, res.lo, ceil_x, std::ceil(double(x - ceil_x))); + HighsCDouble x_m_ceil_x = x - ceil_x; + double double_x_m_ceil_x = double(x_m_ceil_x); + double ceil_double_x_m_ceil_x = std::ceil(double_x_m_ceil_x); + HighsCDouble local_res; + + two_sum(local_res.hi, local_res.lo, ceil_x, ceil_double_x_m_ceil_x); + res = local_res; + // two_sum(res.hi, res.lo, ceil_x, std::ceil(double(x - ceil_x))); return res; }