From 44b4a861bd2a35c78cac8963f41d0a1d59a666d8 Mon Sep 17 00:00:00 2001 From: Paras Puneet Singh <136245940+ParasPuneetSingh@users.noreply.github.com> Date: Wed, 26 Jun 2024 17:35:57 +0530 Subject: [PATCH] Updated loss function in OptimizationEvolutionary.jl The _loss function accommodates the MultiObjectiveOptimizationFunction in the __solve method. --- .../src/OptimizationEvolutionary.jl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/OptimizationEvolutionary/src/OptimizationEvolutionary.jl b/lib/OptimizationEvolutionary/src/OptimizationEvolutionary.jl index f31cf348c..ee8e32ebc 100644 --- a/lib/OptimizationEvolutionary/src/OptimizationEvolutionary.jl +++ b/lib/OptimizationEvolutionary/src/OptimizationEvolutionary.jl @@ -125,8 +125,13 @@ function SciMLBase.__solve(cache::OptimizationCache{ f = cache.f _loss = function (θ) - x = f(θ, cache.p, cur...) - return first(x) + if isa(f, MultiObjectiveOptimizationFunction) + x = f(θ, cache.p, cur...) + return x + else + x = f(θ, cache.p, cur...) + return first(x) + end end opt_args = __map_optimizer_args(cache, cache.opt; callback = _cb, cache.solver_args...,