How to display the best fintess for each iteration
licheng0794 opened this issue · 4 comments
For any optimization algorithms, we expect to show the fitness value for each iteration. How could we do that for Metaheuristics.jl? I tried to find in Options but I cannot find it. Thank you.
I tested debug in Options using the example from the API documents. It does work well.
However, I tested it for my own function, which includes an ODE solver. It did not work. Not sure what the problem is. The code is below.
function fitness_obj(X)
X = [round(x,digits=5) for x in X]
println(X)
outV = VHRSteady(X) # my own function
abs(outV[1] - targetoutflow[2]) + abs(outV[2] - targetoutflow[3]) + 10*abs(outV[3] - targetoutflow[4]) + abs(outV[5] -
targetoutflow[5])
end
using Metaheuristics
Metaoptimize = Metaheuristics.optimize
MetaOptions = Metaheuristics.Options
options = MetaOptions(f_calls_limit = 1000, debug=true);
Xrange = zeros(12,2)
Xrange[:,1] = [0.01, 0.26, 0.09, 0.5, 0.01, 0.01, 0.2, 0.2, 0.05, 2, 50, 500]
Xrange[:,2] = [0.03, 0.35, 0.13, 0.65, 0.21, 0.55, 1, 1.5, 0.5, 3.5, 100, 1000]
status = Metaoptimize(fitness_obj, Xrange, ECA(options = options))
No debug information was printed! Any suggestion?
I found the reason. The debug information is only shown after one interation not one evaluation. Thank you.
Nice!