anriseth / MultiJuMP.jl

MultiJuMP enables the user to easily run multiobjective optimisation problems and generate Pareto fronts.
Other
61 stars 11 forks source link

Basic usage of MultiJuMP #35

Closed orhanabar closed 5 years ago

orhanabar commented 5 years ago

I am planning to start working on multi objective optimization and found MultiJuMP. But the example on the readme page is throwing an error. It looks like it doesn’t recognize the main function of the optimization. Is it working with the newest version of JuMP after they made significant change?

using MultiJuMP, JuMP
using Clp: ClpSolver

const mmodel = multi_model(solver = ClpSolver(), linear = true)
const y = @variable(mmodel, 0 <= y <= 10.0)
const z = @variable(mmodel, 0 <= z <= 10.0)
@constraint(mmodel, y + z <= 15.0)

# objectives
const exp_obj1 = @expression(mmodel, -y +0.05 * z)
const exp_obj2 = @expression(mmodel, 0.05 * y - z)
const obj1 = SingleObjective(exp_obj1)
const obj2 = SingleObjective(exp_obj2)

# setting objectives in the data
const multim = get_multidata(mmodel)
multim.objectives = [obj1, obj2]

solve(mmodel, method = WeightedSum())

# Get the Utopia and Nadir points
utopiapoint = getutopia(multim)
nadirpoint = getnadir(multim)

Error is :

UndefVarError: multi_model not defined

Stacktrace:
 [1] top-level scope at In[38]:3
matbesancon commented 5 years ago

are you working with Julia 1.0 or greater? If not you might be on a previous version of MultiJuMP

orhanabar commented 5 years ago

Yes I am working on julia 1+. However, package is not updated for JuMP v0.19.0. When I downgrade JuMP to 0.18.5 it worked. When do you think you will update for the new release of JuMP?

matbesancon commented 5 years ago

we should first check that the features used in MultiJuMP (hooks) are still available in 0.19, if yes then we can adapt the code

matbesancon commented 5 years ago

closing this in favour of #37

JNSDVD commented 1 year ago

I have exactly the same problem/error and use exactly the same example.

Julia1.8.2 downgrade JuMP to 0.18.5 (did not work for me) MultiJuMP 0.5.0

But also the later combination of JuMP v0.21.2 & MultiJuMP v0.6.0 does not work for me and led to the same error.

Are there any ideas what I could do?