Skip to content

Commit

Permalink
Update __loss function OptimizationMetaheuristics.jl
Browse files Browse the repository at this point in the history
Loss function updated to handle MOO.
  • Loading branch information
ParasPuneetSingh authored Aug 20, 2024
1 parent 0cc91e8 commit 0a01e9d
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,14 @@ function SciMLBase.__solve(cache::OptimizationCache{
maxiters = Optimization._check_and_convert_maxiters(cache.solver_args.maxiters)
maxtime = Optimization._check_and_convert_maxtime(cache.solver_args.maxtime)

f=cache.f
_loss = function (θ)
x = cache.f(θ, cache.p)
return first(x)
if isa(f,MultiObjectiveOptimizationFunction)
return cache.f(θ, cache.p)
else
x = cache.f(θ, cache.p)
return first(x)
end
end

if !isnothing(cache.lb) & !isnothing(cache.ub)
Expand Down

0 comments on commit 0a01e9d

Please sign in to comment.