Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Test/test_nonlinear.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
2 changes: 1 addition & 1 deletion src/nlp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion test/FileFormats/MOF/MOF.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions test/FileFormats/MOF/nlp.mof.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
},
"set": {
"type": "GreaterThan",
"lower": 25
"lower": 25.0
}
},
{
Expand All @@ -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
]
},
{
Expand Down Expand Up @@ -145,7 +145,7 @@
},
"set": {
"type": "EqualTo",
"value": 40
"value": 40.0
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion test/Test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading