File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -87,19 +87,23 @@ using Test
87
87
end
88
88
89
89
fitness_progress_history = []
90
+ fitness_progress_history_orig = []
90
91
function cb (state, fitness)
91
- push! (fitness_progress_history, deepcopy (state))
92
+ push! (fitness_progress_history, state. objective)
93
+ push! (fitness_progress_history, BlackBoxOptim. best_fitness (state. original))
92
94
return false
93
95
end
94
96
95
97
mof_1 = MultiObjectiveOptimizationFunction (multi_obj_func_1)
96
98
prob_1 = Optimization. OptimizationProblem (mof_1, u0; lb = lb, ub = ub)
97
99
sol_1 = solve (prob_1, opt, NumDimensions = 2 ,
98
- FitnessScheme = ParetoFitnessScheme {2} (is_minimizing = true ), callback= cb)
100
+ FitnessScheme = ParetoFitnessScheme {2} (is_minimizing = true ),
101
+ callback= cb)
99
102
100
103
fp1 = fitness_progress_history[1 ]
101
- @test BlackBoxOptim. best_fitness (fp1. original). orig == fp1. objective
102
- @test length (fp1. objective) == 2
104
+ fp2 = fitness_progress_history[2 ]
105
+ @test fp2. orig == fp1
106
+ @test length (fp1) == 2
103
107
104
108
@test sol_1 ≠ nothing
105
109
println (" Solution for Sphere and Rastrigin: " , sol_1)
You can’t perform that action at this time.
0 commit comments