Skip to content

Commit

Permalink
Regression tests added runtests.jl
Browse files Browse the repository at this point in the history
Added regression tests to the tests for MOO.
  • Loading branch information
ParasPuneetSingh authored Aug 17, 2024
1 parent 7ce124b commit b02eb68
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/OptimizationEvolutionary/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ end
result = test_multi_objective(multi_objective_1, [0.25, 0.25])
@test result nothing
println("Solution for Sphere and Rastrigin: ", result)
@test result.u[1][1] 0.00908 atol=1e-3
@test result.u[1][2] 0.02312 atol=1e-3
end

# Test 2: Rosenbrock and Ackley Functions
Expand All @@ -104,6 +106,8 @@ end
result = test_multi_objective(multi_objective_2, [1.0, 1.0])
@test result nothing
println("Solution for Rosenbrock and Ackley: ", result)
@test result.u[2][1] 1.2428 atol=1e-3
@test result.u[2][2] 0.7091 atol=1e-3
end

# Test 3: ZDT1 Function
Expand All @@ -118,6 +122,8 @@ end
result = test_multi_objective(multi_objective_3, [0.5, 0.5])
@test result nothing
println("Solution for ZDT1: ", result)
@test result.u[1][1] -1.1669 atol=1e-3
@test result.u[1][2] 2.3492 atol=1e-3
end

# Test 4: DTLZ2 Function
Expand All @@ -130,6 +136,8 @@ end
result = test_multi_objective(multi_objective_4, [0.5, 0.5])
@test result nothing
println("Solution for DTLZ2: ", result)
@test result.u[1][1] -1.31011 atol=1e-3
@test result.u[2][1] -1.38852 atol=1e-3
end

# Test 5: Schaffer Function N.2
Expand All @@ -139,9 +147,11 @@ end
f2 = (x[1] - 2)^2
return [f1, f2]
end
result = test_multi_objective(multi_objective_5, [2.0])
result = test_multi_objective(multi_objective_5, [1.0])
@test result nothing
println("Solution for Schaffer N.2: ", result)
@test result.u[1][1] 1.00000 atol=1e-3
@test result.u[9][1] 1.44114 atol=1e-3
end

end
Expand Down

0 comments on commit b02eb68

Please sign in to comment.