jmejia8 / Metaheuristics.jl

High-performance metaheuristics for optimization coded purely in Julia.
https://jmejia8.github.io/Metaheuristics.jl/stable/
Other
255 stars 26 forks source link

xfgh_solution vs xFgh_solution vs xf_solution #88

Closed jbiffl closed 1 year ago

jbiffl commented 1 year ago

I keep running into method errors like this one

no method matching compare(::Metaheuristics.xfgh_solution{Vector{Float64}}, ::Metaheuristics.xfgh_solution{Vector{Float64}})

and I am having trouble figuring out what the differences between xfgh_solution and xFgh_solution and xf_solution are and how each type is generated/what it means. I was unable to find anything in documentation about this internal type system, and I'm not sure why Metaheuristics.is_better() has dispatches for xf_solution, xfgh_solution, and xFgh_solution types, but Metaheuristics.compare() only has a dispatch for xFgh_solution which does not work with xfgh_solution.

Any information you can provide on the differences between these seemingly similar types would be very helpful.

Thanks!

jmejia8 commented 1 year ago

Hi!

Struct xf_solution is to save decision $x$ and function value $f(x)$ of single-objective unconstrained problems, xfgh_solution for single-objective and constrained. Finally, xFgh_solution for multi-objective problems.

jbiffl commented 1 year ago

Thanks a lot for the answer! That makes sense now.

Are multi-objective algorithms are only compatible with multi-objective problems then? E.g. for an objective function which has a programmatically generated set of objectives I would need to use a different algorithm for cases where there is only a single objective than when there are multiple objectives.

jmejia8 commented 1 year ago

MO algorithms work better for MO problems. They can also solve single-objective problems with a proper definition of an objective function (convert the number fx into a vector [fx]). Of course, the selection of an optimization algorithm is depending on the optimization problem.

jbiffl commented 1 year ago

Thank you for clarifying, that seems reasonable.