lanl-ansi / Alpine.jl

A Julia/JuMP-based Global Optimization Solver for Non-convex Programs
https://lanl-ansi.github.io/Alpine.jl/latest/
Other
244 stars 39 forks source link

NLobjective error #123

Closed krishpat closed 5 years ago

krishpat commented 5 years ago

Issue in Alpine v0.1.9

m = Model(solver=AlpineSolver(presolve_bt=0,nlp_solver = IpoptSolver(), mip_solver=CplexSolver(CPX_PARAM_SCRIND=0)))
@variable(m, -1 <= x[1:3] <= 1)
@NLobjective(m, Min, x[1])
@NLconstraint(m, x[1]^2 + x[2]^2 + x[3]^2 >= 3)
solve(m)

When I run the above problem, Alpine throws this error:

ERROR: AssertionError: expr.head == :call

This error does not appear if the objective is specified as @objective(m, Min, x[1])

harshangrjn commented 5 years ago

@krishpat Looks like when you do @objective, JuMP automatically assigns coefficient "1.0" to the linear variable x[1]. However when you do @NLobjective, JuMP doesn't assign "1.0" coefficient and hence you see this error. A quick fix for this assertion is to write your objective as @NLobjective(m, Min, 1*x[1]).

harshangrjn commented 5 years ago

@krishpat This has been fixed and merged to master.

krishpat commented 5 years ago

Thanks @harshangrjn. It works now.