Skip to content

Commit ac0f630

Browse files
Update objective function tests in runtests.jl
Added objective tests for the testset.
1 parent 44d25b9 commit ac0f630

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/OptimizationEvolutionary/test/runtests.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ end
9494
println("Solution for Sphere and Rastrigin: ", result)
9595
@test result.u[1][1] 7.88866e-5 atol=1e-3
9696
@test result.u[1][2] 4.96471e-5 atol=1e-3
97+
@test result.objective[1] 8.6879e-9 atol=1e-3
9798
end
9899

99100
# Test 2: Rosenbrock and Ackley Functions
@@ -108,6 +109,7 @@ end
108109
println("Solution for Rosenbrock and Ackley: ", result)
109110
@test result.u[10][1] 1.0 atol=1e-3
110111
@test result.u[10][2] 0.999739 atol=1e-3
112+
@test result.objective[2] 3.625384 atol=1e-3
111113
end
112114

113115
# Test 3: ZDT1 Function
@@ -124,6 +126,7 @@ end
124126
println("Solution for ZDT1: ", result)
125127
@test result.u[1][1] -0.365434 atol=1e-3
126128
@test result.u[1][2] 1.22128 atol=1e-3
129+
@test result.objective[1] -0.365434 atol=1e-3
127130
end
128131

129132
# Test 4: DTLZ2 Function
@@ -138,6 +141,7 @@ end
138141
println("Solution for DTLZ2: ", result)
139142
@test result.u[1][1] 0.899183 atol=1e-3
140143
@test result.u[2][1] 0.713992 atol=1e-3
144+
@test result.objective[1] 0.1599915 atol=1e-3
141145
end
142146

143147
# Test 5: Schaffer Function N.2
@@ -152,6 +156,7 @@ end
152156
println("Solution for Schaffer N.2: ", result)
153157
@test result.u[19][1] 0.252635 atol=1e-3
154158
@test result.u[9][1] 1.0 atol=1e-3
159+
@test result.objective[1] 1.0 atol=1e-3
155160
end
156161

157162
end

0 commit comments

Comments
 (0)