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