plasmo-dev / Plasmo.jl

A Platform for Scalable Modeling and Optimization
Other
143 stars 20 forks source link

Setting `Max` instead of `Min` in objective makes `objective_value` negative #103

Open dlcole3 opened 3 months ago

dlcole3 commented 3 months ago

If you set the objective on a node to maximize instead of minimize, the objective value it returns will be negative. For example, in the code below, the objective value that is returned should be +2, but it is -2.

using Plasmo, HiGHS

g = OptiGraph()
set_optimizer(g, HiGHS.Optimizer)
@optinode(g, n)
@variable(n, x <= 2)
@objective(n, Max, x)
optimize!(g)
println(objective_value(g))
dlcole3 commented 2 weeks ago

Just double checked and this is still occurring in v0.6.0.

jalving commented 1 week ago

Thanks for checking this again. I'll get this fixed soon.