anriseth / MultiJuMP.jl

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

Works for linear, integer problems? #20

Closed matbesancon closed 5 years ago

matbesancon commented 5 years ago

Does the package work with linear objectives? The examples only use Ipopt as a solver and non-linear problems.

using MultiJuMP: SingleObjective, MultiModel, getMultiData

const mmodel = MultiModel(solver = ClpSolver())
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 = getMultiData(mmodel)
multim.objectives = [obj1, obj2]

solve(mmodel)

Error:

Unexpected object -y + 0.05 z in nonlinear expression.
Stacktrace

If it does, a linear / integer example might be interesting. If not, then a note could be added in the README (happy to make a PR in both cases)

anriseth commented 5 years ago

The way I set this up back in the day assumes a nonlinear objective. Feel free to submit a PR to the README.

It may not be too difficult to extend it to other types of objectives and constraints, in case anyone would like to do that :)