anriseth / MultiJuMP.jl

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

Dispatch instead of symbol checking #23

Closed matbesancon closed 5 years ago

matbesancon commented 5 years ago

Related to the solverhook method doing dispatch manually over symbols, a simpler design could leverage Julia dispatch and types for methods:

abstract type MultiOptMethod end

"""
multi_solve(mt::MultiOptMethod) solves the multi-objective problem with method mt
"""
function multi_solve end

"""
epsilon-constraint method, parametrized over the epsilon value
"""
struct EpsMethod <: MultiOptMethod
   eps::Float64
end

mutable struct MultiData
# ...
mt::MultiOptMethod
end

function solvehook(m::Model,
                   inequalityconstraint::Bool = false, kwargs...)
# dispatches over method from MultiData
end
anriseth commented 5 years ago

Good idea. The original approach was pretty un-Julian :p

matbesancon commented 5 years ago

fixed by #27