diff --git a/src/Test/test_nonlinear.jl b/src/Test/test_nonlinear.jl index 1d746a3665..83f0440721 100644 --- a/src/Test/test_nonlinear.jl +++ b/src/Test/test_nonlinear.jl @@ -76,10 +76,10 @@ function MOI.constraint_expr(::HS071, i::Int) ) elseif i == 2 return :( - x[$(MOI.VariableIndex(1))]^2 + - x[$(MOI.VariableIndex(2))]^2 + - x[$(MOI.VariableIndex(3))]^2 + - x[$(MOI.VariableIndex(4))]^2 == 40.0 + x[$(MOI.VariableIndex(1))]^2.0 + + x[$(MOI.VariableIndex(2))]^2.0 + + x[$(MOI.VariableIndex(3))]^2.0 + + x[$(MOI.VariableIndex(4))]^2.0 == 40.0 ) else error("Out of bounds constraint.") diff --git a/src/nlp.jl b/src/nlp.jl index 2a5b307674..7eb32e996e 100644 --- a/src/nlp.jl +++ b/src/nlp.jl @@ -1074,7 +1074,7 @@ julia> MOI.constraint_expr(evaluator, 1) :(x[MOI.VariableIndex(1)] * x[MOI.VariableIndex(2)] * x[MOI.VariableIndex(3)] * x[MOI.VariableIndex(4)] >= 25.0) julia> MOI.constraint_expr(evaluator, 2) -:(x[MOI.VariableIndex(1)] ^ 2 + x[MOI.VariableIndex(2)] ^ 2 + x[MOI.VariableIndex(3)] ^ 2 + x[MOI.VariableIndex(4)] ^ 2 == 40.0) +:(x[MOI.VariableIndex(1)] ^ 2.0 + x[MOI.VariableIndex(2)] ^ 2.0 + x[MOI.VariableIndex(3)] ^ 2.0 + x[MOI.VariableIndex(4)] ^ 2.0 == 40.0) ``` """ function constraint_expr end diff --git a/test/FileFormats/MOF/MOF.jl b/test/FileFormats/MOF/MOF.jl index 2e4297503b..7e77143a7d 100644 --- a/test/FileFormats/MOF/MOF.jl +++ b/test/FileFormats/MOF/MOF.jl @@ -308,7 +308,7 @@ function test_nonlinear_readingwriting() block = MOI.get(model2, MOI.NLPBlock()) MOI.initialize(block.evaluator, [:ExprGraph]) @test MOI.constraint_expr(block.evaluator, 1) == - :(2 * x[$x] + sin(x[$x])^2 - x[$y] == 1.0) + :(2.0 * x[$x] + sin(x[$x])^2.0 - x[$y] == 1.0) _validate(TEST_MOF_FILE) return end diff --git a/test/FileFormats/MOF/nlp.mof.json b/test/FileFormats/MOF/nlp.mof.json index e5df6fbaa1..24debfebd6 100644 --- a/test/FileFormats/MOF/nlp.mof.json +++ b/test/FileFormats/MOF/nlp.mof.json @@ -81,7 +81,7 @@ }, "set": { "type": "GreaterThan", - "lower": 25 + "lower": 25.0 } }, { @@ -96,28 +96,28 @@ "type": "^", "args": [ "var_1", - 2 + 2.0 ] }, { "type": "^", "args": [ "var_2", - 2 + 2.0 ] }, { "type": "^", "args": [ "var_3", - 2 + 2.0 ] }, { "type": "^", "args": [ "var_4", - 2 + 2.0 ] }, { @@ -145,7 +145,7 @@ }, "set": { "type": "EqualTo", - "value": 40 + "value": 40.0 } }, { diff --git a/test/Test/runtests.jl b/test/Test/runtests.jl index cadb2d98ff..7233a7fb5f 100644 --- a/test/Test/runtests.jl +++ b/test/Test/runtests.jl @@ -229,7 +229,7 @@ function test_HS071_evaluator() @test MOI.constraint_expr(evaluator, 1) == :($(x[1]) * $(x[2]) * $(x[3]) * $(x[4]) >= 25.0) @test MOI.constraint_expr(evaluator, 2) == - :($(x[1])^2 + $(x[2])^2 + $(x[3])^2 + $(x[4])^2 == 40.0) + :($(x[1])^2.0 + $(x[2])^2.0 + $(x[3])^2.0 + $(x[4])^2.0 == 40.0) return end