Parenthesis sometimes missing
Downsite opened this issue · 6 comments
Hi,
after the latest update, I sometimes get an error like this:
37 nlp_eq2.. sqr((2) * (x3) * (x3) + (-1.328171015325041) * (x3) + -2.076874228151837e-10) + sqr((+(-2.076874228151837e-10
**** $445
**** 445 More than one operator in a row. You need to use parenthesis
**** if you want to use such statements. For example
**** x := x + - not y; -> x := x + (- (not y));
**** sum(i$not x, ..) -> sum(i$(not x),..)
I assume that there is a small bug when writing from the Julia expression to the GAMS representation.
Double values maybe should always have parenthesis?
Oh, thanks for reporting! Will fix it right away.
This should be fixed with v0.5.1. Sorry for this inconvenience! Please check if this is fixed for you and then close this issue if so - as I haven't checked your particular model.
I appriciate the fast reponse!
I updated to v0.5.1 with GAMS 46.2.0, but still have the issue.
I found a simple problem that reproduces the issue, maybe you can check it out.
My current status:
Pkg.status(["JuMP","MathOptInterface","GAMS"])
Status `~/.julia/environments/v1.10/Project.toml`
[1ca51c6a] GAMS v0.5.1
[4076af6c] JuMP v1.20.0
[b8f27783] MathOptInterface v1.27.1
the test problem:
using JuMP
using GAMS
model2 = Model()
set_optimizer(model2, optimizer_with_attributes(GAMS.Optimizer, "Solver" => "Baron"))
set_optimizer_attribute(model2, "SysDir", "/opt/gams/gams46.2_linux_x64_64_sfx")
@variable(model2, -1.0 <= x <= 1.0)
@variable(model2, must_have_eq, Bin, start = 0)
@constraint(model2, con, 0 <= x^3 + (1.0 - must_have_eq) * 100.0)
optimize!(model2)
results for me in
24 eq1.. 0 - (power(x1, 3) + -100 * x2 + 100) =L= 0;
**** $445
**** 445 More than one operator in a row. You need to use parenthesis
**** if you want to use such statements.
Thanks, I can reproduce the issue and will add the model to the tests. Sorry for this.
Fixed with v0.5.2.
This fixed the issue for me, glad it was helpful to fix the issue and thanks again for the quick respones.