-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Open
Labels
BugLang: C++Native implementation issueNative implementation issueOS: MacMacOSMacOSSolver: MathOptMathOpt related issueMathOpt related issue
Milestone
Description
What version of OR-Tools and what language are you using?
Version: main
Language: C++
Which solver are you using (e.g. CP-SAT, Routing Solver, GLOP, BOP, Gurobi)
MathOpt
What operating system (Linux, Windows, ...) and version?
mostly Macos
What did you do?
build then run MathOpt test
What did you expect to see
tests pass
What did you see instead?
trace often on amd64 macos runners:
[ RUN ] QuadraticExpressionTest.EvaluateOnlyLinearExpression
ortools/math_opt/cpp/variable_and_expressions_test.cc:3128: Failure
Value of: expr.Evaluate(variable_values)
Expected: is equal to 15.4
Actual: 15.399999999999999 (of type double)
Stack trace:
0x1035d4bc0: testing::internal::HandleExceptionsInMethodIfSupported<>()
0x1035d4a34: testing::Test::Run()
0x1035d5ecc: testing::TestInfo::Run()
0x1035d70cc: testing::TestSuite::Run()
... Google Test internal frames ...
ortools/math_opt/cpp/variable_and_expressions_test.cc:3129: Failure
Value of: expr.EvaluateWithDefaultZero(variable_values)
Expected: is equal to 15.4
Actual: 15.399999999999999 (of type double)
Stack trace:
0x1035d4bc0: testing::internal::HandleExceptionsInMethodIfSupported<>()
0x1035d4a34: testing::Test::Run()
0x1035d5ecc: testing::TestInfo::Run()
0x1035d70cc: testing::TestSuite::Run()
... Google Test internal frames ...
also on arm64 macos bazel
[ RUN ] QuadraticExpressionTest.OutputStreaming
ortools/math_opt/cpp/variable_and_expressions_test.cc:3293: Failure
Expected equality of these values:
to_string(QuadraticExpression( {{a, b, -1.2}, {a, a, -1.3}, {b, b, 1.0}}, {{a, 1.4}}, 1.5))
Which is: "-1.3*a\xC2\xB2 - 1.2*a*b + b\xC2\xB2 + 1.3999999999999999*a + 1.5"
As Text: "-1.3*a² - 1.2*a*b + b² + 1.3999999999999999*a + 1.5"
"-1.3*a² - 1.2*a*b + b² + 1.4*a + 1.5"
Which is: "-1.3*a\xC2\xB2 - 1.2*a*b + b\xC2\xB2 + 1.4*a + 1.5"
As Text: "-1.3*a² - 1.2*a*b + b² + 1.4*a + 1.5"
Stack trace:
0x102b9bf41: testing::internal::HandleExceptionsInMethodIfSupported<>()
0x102b9be74: testing::Test::Run()
0x102b9ced0: testing::TestInfo::Run()
0x102b9df95: testing::TestSuite::Run()
... Google Test internal frames ...
Make sure you include information that can help us debug (full error message, model Proto).
Anything else we should know about your project / environment
or-tools/ortools/math_opt/cpp/variable_and_expressions_test.cc
Lines 3118 to 3135 in ba49213
| TEST(QuadraticExpressionTest, EvaluateOnlyLinearExpression) { | |
| ModelStorage storage; | |
| const Variable a(&storage, storage.AddVariable("a")); | |
| const Variable b(&storage, storage.AddVariable("b")); | |
| const QuadraticExpression expr({}, {{a, 1.2}}, 3.4); | |
| { | |
| VariableMap<double> variable_values; | |
| variable_values[a] = 10.0; | |
| variable_values[b] = 11.0; | |
| EXPECT_THAT(expr.Evaluate(variable_values), 10 * 1.2 + 3.4); | |
| EXPECT_THAT(expr.EvaluateWithDefaultZero(variable_values), 10 * 1.2 + 3.4); | |
| } | |
| { | |
| VariableMap<double> variable_values; | |
| EXPECT_THAT(expr.EvaluateWithDefaultZero(variable_values), 3.4); | |
| } | |
| } |
Metadata
Metadata
Assignees
Labels
BugLang: C++Native implementation issueNative implementation issueOS: MacMacOSMacOSSolver: MathOptMathOpt related issueMathOpt related issue