Skip to content

Commit

Permalink
Convert method return values to named tuples for ease of accessing
Browse files Browse the repository at this point in the history
members
  • Loading branch information
aahaselgrove committed Sep 30, 2019
1 parent e3d98b1 commit 0cd421d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/cmaes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 6 additions & 1 deletion src/es.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 7 additions & 1 deletion src/ga.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 0cd421d

Please sign in to comment.