diff --git a/src/test/java/org/moeaframework/benchmarks/BenchmarkProviderTest.java b/src/test/java/org/moeaframework/benchmarks/AbstractProblemTest.java similarity index 51% rename from src/test/java/org/moeaframework/benchmarks/BenchmarkProviderTest.java rename to src/test/java/org/moeaframework/benchmarks/AbstractProblemTest.java index 4e5a54b..e971190 100644 --- a/src/test/java/org/moeaframework/benchmarks/BenchmarkProviderTest.java +++ b/src/test/java/org/moeaframework/benchmarks/AbstractProblemTest.java @@ -17,38 +17,68 @@ */ package org.moeaframework.benchmarks; +import java.util.Arrays; import java.util.concurrent.TimeUnit; import org.junit.Assert; import org.junit.Assume; -import org.junit.Test; +import org.junit.Ignore; import org.moeaframework.algorithm.NSGAII; +import org.moeaframework.core.Settings; +import org.moeaframework.core.Solution; import org.moeaframework.core.population.NondominatedPopulation; import org.moeaframework.core.spi.ProblemFactory; +import org.moeaframework.core.variable.RealVariable; import org.moeaframework.problem.Problem; -/** - * Tests to ensure each benchmark problem can be instantiated with the MOEA Framework and reference sets exist. - */ -public class BenchmarkProviderTest { +@Ignore("abstract test class") +public class AbstractProblemTest { - protected void test(String problemName) { + protected void testSolve(String problemName) { try (Problem problem = ProblemFactory.getInstance().getProblem(problemName)) { - Assert.assertNotNull(problem); - Assert.assertEquals(problemName, problem.getName()); + Assert.assertNotNull("Problem not defined", problem); + Assert.assertEquals("Problem name must match", problemName, problem.getName()); NSGAII algorithm = new NSGAII(problem); algorithm.run(1000); NondominatedPopulation result = algorithm.getResult(); - Assert.assertNotNull(result); - Assert.assertFalse(result.isEmpty()); + Assert.assertNotNull("Expected non-null result", result); + Assert.assertFalse("Expected non-empty result", result.isEmpty()); } } protected void testReferenceSet(String problemName) { - Assert.assertNotNull("Missing reference set", ProblemFactory.getInstance().getReferenceSet(problemName)); + NondominatedPopulation referenceSet = ProblemFactory.getInstance().getReferenceSet(problemName); + Assert.assertNotNull("Expected reference set", referenceSet); + Assert.assertFalse("Expected non-empty reference set", referenceSet.isEmpty()); + } + + protected void testSolution(String problemName, double[] variables, double[] expectedObjectives, double[] expectedConstraints, boolean isFeasible) { + try (Problem problem = ProblemFactory.getInstance().getProblem(problemName)) { + Solution solution = problem.newSolution(); + RealVariable.setReal(solution, variables); + + problem.evaluate(solution); + + try { + Assert.assertArrayEquals("Objectives do not match", expectedObjectives, solution.getObjectiveValues(), Settings.EPS); + } catch (AssertionError e) { + System.out.println("Actual Objectives: " + Arrays.toString(solution.getObjectiveValues())); + throw e; + } + + try { + Assert.assertArrayEquals("Constraints do not match", expectedConstraints, solution.getConstraintValues(), Settings.EPS); + } catch (AssertionError e) { + System.out.println("Actual Constraints: " + Arrays.toString(solution.getConstraintValues())); + throw e; + } + + Assert.assertEquals("Feasibility does not match", isFeasible, solution.isFeasible()); + + } } protected void requiresMatlab() { @@ -69,52 +99,5 @@ protected void requiresMatlab() { Assume.assumeNoException("Caught exception when invoking process", e); } } - - @Test - public void testCarSideImpact() { - test("CarSideImpact"); - testReferenceSet("CarSideImpact"); - } - - @Test - public void testElectricMotor() { - test("ElectricMotor"); - testReferenceSet("ElectricMotor"); - } - - @Test - public void testGAA() { - test("GAA"); - testReferenceSet("GAA"); - } - - @Test - public void testHBV() { - test("HBV"); - testReferenceSet("HBV"); - } - - @Test - public void testLakeProblem() { - test("LakeProblem"); - testReferenceSet("LakeProblem"); - } - - @Test - public void testLRGV() { - test("LRGV"); - } - - @Test - public void testRadar() { - requiresMatlab(); - test("Radar"); - } - - @Test - public void testWDS() { - test("WDS(GOY)"); - testReferenceSet("WDS(GOY)"); - } } diff --git a/src/test/java/org/moeaframework/benchmarks/CarSideImpactTest.java b/src/test/java/org/moeaframework/benchmarks/CarSideImpactTest.java new file mode 100644 index 0000000..76ec4e4 --- /dev/null +++ b/src/test/java/org/moeaframework/benchmarks/CarSideImpactTest.java @@ -0,0 +1,52 @@ +/* Copyright 2009-2024 David Hadka and other contributors + * + * This file is part of the MOEA Framework. + * + * The MOEA Framework is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * The MOEA Framework is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with the MOEA Framework. If not, see . + */ +package org.moeaframework.benchmarks; + +import org.junit.Test; + +public class CarSideImpactTest extends AbstractProblemTest { + + @Test + public void testSolve() { + testSolve("CarSideImpact"); + } + + @Test + public void testReferenceSet() { + testReferenceSet("CarSideImpact"); + } + + @Test + public void testLowerBound() { + testSolution("CarSideImpact", + new double[] { 0.5, 0.45, 0.5, 0.5, 0.875, 0.4, 0.4 }, + new double[] { 15.576004000000003, 4.42725, 13.091381250000001 }, + new double[] { 1.07172109999999998, 0.23405105999999998, 0.20441605000000002, 0.48307069999999996, 29.380924, 32.569465, 39.67975, 4.42725, 10.1256125, 16.05715 }, + false); + } + + @Test + public void testUpperBound() { + testSolution("CarSideImpact", + new double[] { 1.5, 1.35, 1.5, 1.5, 2.625, 1.2, 1.2 }, + new double[] { 42.768012, 3.58525, 10.61064375 }, + new double[] { 0.39336829999999995, 0.17596818000000003, 0.16976335, 0.24501710000000013, 24.512772, 20.246884999999995, 26.319249999999997, 3.58525, 8.3069375, 12.914349999999999 }, + true); + } + +} diff --git a/src/test/java/org/moeaframework/benchmarks/ElectricMotorTest.java b/src/test/java/org/moeaframework/benchmarks/ElectricMotorTest.java new file mode 100644 index 0000000..b795864 --- /dev/null +++ b/src/test/java/org/moeaframework/benchmarks/ElectricMotorTest.java @@ -0,0 +1,52 @@ +/* Copyright 2009-2024 David Hadka and other contributors + * + * This file is part of the MOEA Framework. + * + * The MOEA Framework is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * The MOEA Framework is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with the MOEA Framework. If not, see . + */ +package org.moeaframework.benchmarks; + +import org.junit.Test; + +public class ElectricMotorTest extends AbstractProblemTest { + + @Test + public void testSolve() { + testSolve("ElectricMotor"); + } + + @Test + public void testReferenceSet() { + testReferenceSet("ElectricMotor"); + } + + @Test + public void testLowerBound() { + testSolution("ElectricMotor", + new double[] { 100.0, 0.01, 1.0, 0.01, 0.01, 5.0E-4, 0.001, 0.1, 100.0, 0.01, 1.0, 0.01, 0.01, 5.0E-4, 0.001, 0.1, 100.0, 0.01, 1.0, 0.01, 0.01, 5.0E-4, 0.001, 0.1, 100.0, 0.01, 1.0, 0.01, 0.01, 5.0E-4, 0.001, 0.1, 100.0, 0.01, 1.0, 0.01, 0.01, 5.0E-4, 0.001, 0.1, 100.0, 0.01, 1.0, 0.01, 0.01, 5.0E-4, 0.001, 0.1, 100.0, 0.01, 1.0, 0.01, 0.01, 5.0E-4, 0.001, 0.1, 100.0, 0.01, 1.0, 0.01, 0.01, 5.0E-4, 0.001, 0.1, 100.0, 0.01, 1.0, 0.01, 0.01, 5.0E-4, 0.001, 0.1, 100.0, 0.01, 1.0, 0.01, 0.01, 5.0E-4, 0.001, 0.1 }, + new double[] { -2.1178860361093237E-5, 0.9829575175304347, -2.1178860361093237E-5, 0.9829575175304347, -2.1178860361093237E-5, 0.9829575175304347, -2.1178860361093237E-5, 0.9829575175304347, -2.1178860361093237E-5, 0.9829575175304347, -2.1178860361093237E-5, 0.9829575175304347, -2.1178860361093237E-5, 0.9829575175304347, -2.1178860361093237E-5, 0.9829575175304347, -2.1178860361093237E-5, 0.9829575175304347, -2.1178860361093237E-5, 0.9829575175304347 }, + new double[] { 0.05000000000380373, 288.6959885484, 0.0, 0.0, 0.0, 0.0, 0.10000000000380374, 288.6959885484, 0.0, 0.0, 0.0, 0.0, 0.12500000000380374, 288.6959885484, 0.0, 0.0, 0.0, 0.0, 0.15000000000380373, 288.6959885484, 0.0, 0.0, 0.0, 0.0, 0.20000000000380375, 288.6959885484, 0.0, 0.0, 0.0, 0.0, 0.25000000000380374, 288.6959885484, 0.0, 0.0, 0.0, 0.0, 0.3000000000038037, 288.6959885484, 0.0, 0.0, 0.0, 0.0, 0.3500000000038037, 288.6959885484, 0.0, 0.0, 0.0, 0.0, 0.40000000000380376, 288.6959885484, 0.0, 0.0, 0.0, 0.0, 0.5000000000038037, 288.6959885484, 0.0, 0.0, 0.0, 0.0 }, + false); + } + + @Test + public void testUpperBound() { + testSolution("ElectricMotor", + new double[] { 1500.0, 1.0, 500.0, 1.0, 0.1, 0.1, 0.1, 6.0, 1500.0, 1.0, 500.0, 1.0, 0.1, 0.1, 0.1, 6.0, 1500.0, 1.0, 500.0, 1.0, 0.1, 0.1, 0.1, 6.0, 1500.0, 1.0, 500.0, 1.0, 0.1, 0.1, 0.1, 6.0, 1500.0, 1.0, 500.0, 1.0, 0.1, 0.1, 0.1, 6.0, 1500.0, 1.0, 500.0, 1.0, 0.1, 0.1, 0.1, 6.0, 1500.0, 1.0, 500.0, 1.0, 0.1, 0.1, 0.1, 6.0, 1500.0, 1.0, 500.0, 1.0, 0.1, 0.1, 0.1, 6.0, 1500.0, 1.0, 500.0, 1.0, 0.1, 0.1, 0.1, 6.0, 1500.0, 1.0, 500.0, 1.0, 0.1, 0.1, 0.1, 6.0 }, + new double[] { 0.08781367214553605, 0.9739676521739131, 0.08781367214553605, 0.9739676521739131, 0.08781367214553605, 0.9739676521739131, 0.08781367214553605, 0.9739676521739131, 0.08781367214553605, 0.9739676521739131, 0.08781367214553605, 0.9739676521739131, 0.08781367214553605, 0.9739676521739131, 0.08781367214553605, 0.9739676521739131, 0.08781367214553605, 0.9739676521739131, 0.08781367214553605, 0.9739676521739131 }, + new double[] { 0.04692963432538349, 372.03768, 0.0, 583388.4728341918, 0.0, 0.0, 0.0969296343253835, 372.03768, 0.0, 583388.4728341918, 0.0, 0.0, 0.12192963432538349, 372.03768, 0.0, 583388.4728341918, 0.0, 0.0, 0.14692963432538347, 372.03768, 0.0, 583388.4728341918, 0.0, 0.0, 0.1969296343253835, 372.03768, 0.0, 583388.4728341918, 0.0, 0.0, 0.24692963432538348, 372.03768, 0.0, 583388.4728341918, 0.0, 0.0, 0.2969296343253835, 372.03768, 0.0, 583388.4728341918, 0.0, 0.0, 0.3469296343253835, 372.03768, 0.0, 583388.4728341918, 0.0, 0.0, 0.39692963432538353, 372.03768, 0.0, 583388.4728341918, 0.0, 0.0, 0.4969296343253835, 372.03768, 0.0, 583388.4728341918, 0.0, 0.0 }, + false); + } + +} diff --git a/src/test/java/org/moeaframework/benchmarks/GAATest.java b/src/test/java/org/moeaframework/benchmarks/GAATest.java new file mode 100644 index 0000000..d6658a8 --- /dev/null +++ b/src/test/java/org/moeaframework/benchmarks/GAATest.java @@ -0,0 +1,52 @@ +/* Copyright 2009-2024 David Hadka and other contributors + * + * This file is part of the MOEA Framework. + * + * The MOEA Framework is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * The MOEA Framework is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with the MOEA Framework. If not, see . + */ +package org.moeaframework.benchmarks; + +import org.junit.Test; + +public class GAATest extends AbstractProblemTest { + + @Test + public void testSolve() { + testSolve("GAA"); + } + + @Test + public void testReferenceSet() { + testReferenceSet("GAA"); + } + + @Test + public void testLowerBound() { + testSolution("GAA", + new double[] { 0.24, 7.0, 0.0, 5.5, 19.0, 85.0, 14.0, 3.0, 0.46, 0.24, 7.0, 0.0, 5.5, 19.0, 85.0, 14.0, 3.0, 0.46, 0.24, 7.0, 0.0, 5.5, 19.0, 85.0, 14.0, 3.0, 0.46 }, + new double[] { 73.239998, 1880.3199970000003, 62.38500200000003, 2.1867999999999994, 480.173996, 41699.24730800003, 3032.0586889999995, 15.726500000000003, 189.25630300000014, 1.9229626863835638E-16 }, + new double[] { 0.33805332444444436 }, + false); + } + + @Test + public void testUpperBound() { + testSolution("GAA", + new double[] { 0.48, 11.0, 6.0, 5.968, 25.0, 110.0, 20.0, 3.75, 1.0, 0.48, 11.0, 6.0, 5.968, 25.0, 110.0, 20.0, 3.75, 1.0, 0.48, 11.0, 6.0, 5.968, 25.0, 110.0, 20.0, 3.75, 1.0 }, + new double[] { 75.19549799999994, 2097.8436029999993, 95.00900000000001, 2.078, 291.2477919999998, 47369.88729400002, 891.8127029999995, 17.929600000000004, 198.903706, 0.0 }, + new double[] { 2.3017063231666643 }, + false); + } + +} diff --git a/src/test/java/org/moeaframework/benchmarks/HBVTest.java b/src/test/java/org/moeaframework/benchmarks/HBVTest.java new file mode 100644 index 0000000..24160e7 --- /dev/null +++ b/src/test/java/org/moeaframework/benchmarks/HBVTest.java @@ -0,0 +1,52 @@ +/* Copyright 2009-2024 David Hadka and other contributors + * + * This file is part of the MOEA Framework. + * + * The MOEA Framework is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * The MOEA Framework is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with the MOEA Framework. If not, see . + */ +package org.moeaframework.benchmarks; + +import org.junit.Test; + +public class HBVTest extends AbstractProblemTest { + + @Test + public void testSolve() { + testSolve("HBV"); + } + + @Test + public void testReferenceSet() { + testReferenceSet("HBV"); + } + + @Test + public void testLowerBound() { + testSolution("HBV", + new double[] { 0.0, 0.5, 1.0, 10.0, 0.0, 0.3, 0.0, 0.0, 24.0, -3.0, 0.0, 0.0, 0.0, 0.0 }, + new double[] { 9.910673, 3.527903, 1.225312, 1.327312 }, + new double[] { }, + true); + } + + @Test + public void testUpperBound() { + testSolution("HBV", + new double[] { 100.0, 20.0, 100.0, 20000.0, 100.0, 1.0, 2000.0, 7.0, 120.0, 3.0, 20.0, 1.0, 0.8, 7.0 }, + new double[] { 0.9951112, 3.319143, 0.6665916, 0.9936301 }, + new double[] { }, + true); + } + +} diff --git a/src/test/java/org/moeaframework/benchmarks/LRGVTest.java b/src/test/java/org/moeaframework/benchmarks/LRGVTest.java new file mode 100644 index 0000000..b52c867 --- /dev/null +++ b/src/test/java/org/moeaframework/benchmarks/LRGVTest.java @@ -0,0 +1,47 @@ +/* Copyright 2009-2024 David Hadka and other contributors + * + * This file is part of the MOEA Framework. + * + * The MOEA Framework is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * The MOEA Framework is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with the MOEA Framework. If not, see . + */ +package org.moeaframework.benchmarks; + +import org.junit.Test; + +public class LRGVTest extends AbstractProblemTest { + + @Test + public void testSolve() { + testSolve("LRGV"); + } + + @Test + public void testLowerBound() { + testSolution("LRGV", + new double[] { 0.0, 0.0, 0.1, 0.1, 0.0, 0.0, 0.0, 0.0 }, + new double[] { 0.0678, 0.5427500000000001, 0.052332950946083, 0.0, 0.0, 8.237323224016374E-67 }, + new double[] { -0.6038095238095238, -0.4517676767676767, 0.0, 0.0 }, + false); + } + + @Test + public void testUpperBound() { + testSolution("LRGV", + new double[] { 1.0, 1.0, 1.0, 0.4, 3.0, 0.0, 3.0, 0.0 }, + new double[] { 0.14687273772049875, 1.0, 0.7396398491493245, 0.0012601974979137415, 7.8E-4, 8.237323224016374E-67 }, + new double[] { 0.0, 0.0, -0.0059376725451394385, 0.0 }, + false); + } + +} diff --git a/src/test/java/org/moeaframework/benchmarks/LakeProblemTest.java b/src/test/java/org/moeaframework/benchmarks/LakeProblemTest.java new file mode 100644 index 0000000..9f9180e --- /dev/null +++ b/src/test/java/org/moeaframework/benchmarks/LakeProblemTest.java @@ -0,0 +1,52 @@ +/* Copyright 2009-2024 David Hadka and other contributors + * + * This file is part of the MOEA Framework. + * + * The MOEA Framework is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * The MOEA Framework is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with the MOEA Framework. If not, see . + */ +package org.moeaframework.benchmarks; + +import org.junit.Test; + +public class LakeProblemTest extends AbstractProblemTest { + + @Test + public void testSolve() { + testSolve("LakeProblem"); + } + + @Test + public void testReferenceSet() { + testReferenceSet("LakeProblem"); + } + + @Test + public void testLowerBound() { + testSolution("LakeProblem", + new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }, + new double[] { 0.05773962737399343, 0.0, 1.0, 1.0 }, + new double[] { 0.0 }, + true); + } + + @Test + public void testUpperBound() { + testSolution("LakeProblem", + new double[] { 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1 }, + new double[] { 2.2865409710232774, 1.7347608882104941, 1.0, 0.06 }, + new double[] { 0.79 }, + false); + } + +} diff --git a/src/test/java/org/moeaframework/benchmarks/RadarTest.java b/src/test/java/org/moeaframework/benchmarks/RadarTest.java new file mode 100644 index 0000000..5baf8a3 --- /dev/null +++ b/src/test/java/org/moeaframework/benchmarks/RadarTest.java @@ -0,0 +1,34 @@ +/* Copyright 2009-2024 David Hadka and other contributors + * + * This file is part of the MOEA Framework. + * + * The MOEA Framework is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * The MOEA Framework is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with the MOEA Framework. If not, see . + */ +package org.moeaframework.benchmarks; + +import org.junit.Test; + +public class RadarTest extends AbstractProblemTest { + + @Test + public void testSolve() { + testSolve("Radar"); + } + + @Test + public void testReferenceSet() { + testReferenceSet("Radar"); + } + +} diff --git a/src/test/java/org/moeaframework/benchmarks/WDSTest.java b/src/test/java/org/moeaframework/benchmarks/WDSTest.java new file mode 100644 index 0000000..ce9d374 --- /dev/null +++ b/src/test/java/org/moeaframework/benchmarks/WDSTest.java @@ -0,0 +1,52 @@ +/* Copyright 2009-2024 David Hadka and other contributors + * + * This file is part of the MOEA Framework. + * + * The MOEA Framework is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * The MOEA Framework is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with the MOEA Framework. If not, see . + */ +package org.moeaframework.benchmarks; + +import org.junit.Test; + +public class WDSTest extends AbstractProblemTest { + + @Test + public void testSolve() { + testSolve("WDS(GOY)"); + } + + @Test + public void testReferenceSet() { + testReferenceSet("WDS(GOY)"); + } + + @Test + public void testLowerBound() { + testSolution("WDS(GOY)", + new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }, + new double[] { 0.17467288672924042, -6.119567394256592 }, + new double[] { -2390.6025390625 }, + false); + } + + @Test + public void testUpperBound() { + testSolution("WDS(GOY)", + new double[] { 7.999999999999999, 7.999999999999999, 7.999999999999999, 7.999999999999999, 7.999999999999999, 7.999999999999999, 7.999999999999999, 7.999999999999999, 7.999999999999999, 7.999999999999999, 7.999999999999999, 7.999999999999999, 7.999999999999999, 7.999999999999999, 7.999999999999999, 7.999999999999999, 7.999999999999999, 7.999999999999999, 7.999999999999999, 7.999999999999999, 7.999999999999999, 7.999999999999999, 7.999999999999999, 7.999999999999999, 7.999999999999999, 7.999999999999999, 7.999999999999999, 7.999999999999999, 7.999999999999999, 7.999999999999999 }, + new double[] { 0.3297256529331207, 0.7125067114830017 }, + new double[] { 0.0 }, + true); + } + +}