@@ -54,6 +54,8 @@ function __map_optimizer_args(prob::Optimization.OptimizationCache, opt::BBO;
5454 abstol:: Union{Number, Nothing} = nothing ,
5555 reltol:: Union{Number, Nothing} = nothing ,
5656 verbose:: Bool = false ,
57+ num_dimensions:: Union{Number, Nothing} = nothing ,
58+ fitness_scheme:: Union{String, Nothing} = nothing ,
5759 kwargs... )
5860 if ! isnothing (reltol)
5961 @warn " common reltol is currently not used by $(opt) "
@@ -101,6 +103,16 @@ function __map_optimizer_args(prob::Optimization.OptimizationCache, opt::BBO;
101103 mapped_args = (; mapped_args... , TraceMode = :silent )
102104 end
103105
106+ if isa (prob. f, MultiObjectiveOptimizationFunction)
107+ if isnothing (num_dimensions) && isnothing (fitness_scheme)
108+ mapped_args = (; mapped_args... , NumDimensions = 2 , FitnessScheme = BlackBoxOptim. ParetoFitnessScheme {2} (is_minimizing= true ))
109+ elseif isnothing (num_dimensions)
110+ mapped_args = (; mapped_args... , NumDimensions = 2 , FitnessScheme = fitness_scheme)
111+ elseif isnothing (fitness_scheme)
112+ mapped_args = (; mapped_args... , NumDimensions = num_dimensions, FitnessScheme = BlackBoxOptim. ParetoFitnessScheme {2} (is_minimizing= true ))
113+ end
114+ end
115+
104116 return mapped_args
105117end
106118
@@ -177,12 +189,25 @@ function SciMLBase.__solve(cache::Optimization.OptimizationCache{
177189 _loss = θ -> cache. f (θ, cache. p)
178190 end
179191
180- opt_args = __map_optimizer_args (cache, cache. opt;
181- callback = cache. callback === Optimization. DEFAULT_CALLBACK ?
182- nothing : _cb,
183- cache. solver_args... ,
184- maxiters = maxiters,
185- maxtime = maxtime)
192+ if isa (cache. f, MultiObjectiveOptimizationFunction)
193+ opt_args = __map_optimizer_args (cache, cache. opt;
194+ callback = cache. callback === Optimization. DEFAULT_CALLBACK &&
195+ cache. data === Optimization. DEFAULT_DATA ?
196+ nothing : _cb,
197+ cache. solver_args... ,
198+ maxiters = maxiters,
199+ maxtime = maxtime,
200+ num_dimensions = isnothing (cache. num_dimensions) ? nothing : cache. num_dimensions,
201+ fitness_scheme = isnothing (cache. fitness_scheme) ? nothing : cache. fitness_scheme)
202+ else
203+ opt_args = __map_optimizer_args (cache, cache. opt;
204+ callback = cache. callback === Optimization. DEFAULT_CALLBACK &&
205+ cache. data === Optimization. DEFAULT_DATA ?
206+ nothing : _cb,
207+ cache. solver_args... ,
208+ maxiters = maxiters,
209+ maxtime = maxtime)
210+ end
186211
187212 opt_setup = BlackBoxOptim. bbsetup (_loss; opt_args... )
188213
0 commit comments