From 0cd421d0c206ded341cc458edef01e6e15275ce0 Mon Sep 17 00:00:00 2001 From: Andrew Haselgrove Date: Wed, 25 Sep 2019 16:58:55 +1000 Subject: [PATCH] Convert method return values to named tuples for ease of accessing members --- src/cmaes.jl | 6 +++++- src/es.jl | 7 ++++++- src/ga.jl | 8 +++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/cmaes.jl b/src/cmaes.jl index 39c25c6..8ec454c 100644 --- a/src/cmaes.jl +++ b/src/cmaes.jl @@ -84,5 +84,9 @@ function cmaes( objfun::Function, individual::T; verbose && println("BEST: $(fitness[1]): $(σ)") end - return population[1], fitness[1], itr + return ( + bestIndividual=population[1], + bestFitness=fitness[1], + itr=itr + ) end diff --git a/src/es.jl b/src/es.jl index 11c0234..d1f3bd2 100644 --- a/src/es.jl +++ b/src/es.jl @@ -110,5 +110,10 @@ function es( objfun::Function, individual::T; verbose && println("BEST: $(fitness[1]): $(stgpop[1])") end - return population[1], fitness[1], itr, store + return ( + bestIndividual=population[1], + bestFitness=fitness[1], + itr=itr, + store=store + ) end diff --git a/src/ga.jl b/src/ga.jl index 6120ef8..4b631e3 100644 --- a/src/ga.jl +++ b/src/ga.jl @@ -134,5 +134,11 @@ function ga(objfun::Function, individual::T; end end - return population[bestIndividual], bestFitness, itr, fittol, store + return ( + bestIndividual=population[bestIndividual], + bestFitness=bestFitness, + itr=itr, + fittol=fittol, + store=store + ) end