Skip to content

Commit

Permalink
Move reference sets to resource
Browse files Browse the repository at this point in the history
  • Loading branch information
dhadka committed Nov 27, 2023
1 parent bc1fea6 commit 29f171a
Show file tree
Hide file tree
Showing 19 changed files with 25 additions and 27 deletions.
16 changes: 6 additions & 10 deletions src/main/java/org/moeaframework/benchmarks/BenchmarkProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,16 @@ public class BenchmarkProvider extends RegisteredProblemProvider {
public BenchmarkProvider() {
super();

register("GAA", () -> new GAA(), locateReferenceSet(GAA.class, "GAA.reference"));
register("CarSideImpact", () -> new CarSideImpact(), locateReferenceSet(CarSideImpact.class, "CarSideImpact.reference"));
register("ElectricMotor", () -> new ElectricMotor(), locateReferenceSet(ElectricMotor.class, "ElectricMotor.reference"));
register("HBV", () -> new HBV(), locateReferenceSet(HBV.class, "HBV.reference"));
register("GAA", () -> new GAA(), "./pf/GAA.reference");
register("CarSideImpact", () -> new CarSideImpact(), "./pf/CarSideImpact.reference");
register("ElectricMotor", () -> new ElectricMotor(), "./pf/ElectricMotor.reference");
register("HBV", () -> new HBV(), "./pf/HBV.reference");
register("LRGV", () -> new LRGV(), null);
register("LakeProblem", () -> new LakeProblem(), locateReferenceSet(LakeProblem.class, "LakeProblem.reference"));
register("LakeProblem", () -> new LakeProblem(), "./pf/LakeProblem.reference");

for (WDSInstance variant : WDSInstance.values()) {
register("WDS(" + variant.getName() + ")", () -> new WDS(variant), locateReferenceSet(WDS.class, variant.getName() + ".reference"));
register("WDS(" + variant.getName() + ")", () -> new WDS(variant), "./pf/" + variant.getName() + ".reference");
}
}

private static String locateReferenceSet(Class<?> problem, String filename) {
return problem.getPackageName().replace(".", "/") + "/" + filename;
}

}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,56 +12,58 @@
*/
public class BenchmarkProviderTest {

protected void test(String problemName) {
protected void test(String problemName, boolean hasReferenceSet) {
new Executor()
.withAlgorithm("NSGAII")
.withProblem(problemName)
.withMaxEvaluations(200)
.run();

Assert.assertNotNull("Missing reference set",
ProblemFactory.getInstance().getReferenceSet(problemName));
if (hasReferenceSet) {
Assert.assertNotNull("Missing reference set",
ProblemFactory.getInstance().getReferenceSet(problemName));
}
}

@Test
public void testCarSideImpact() {
test("CarSideImpact");
test("CarSideImpact", true);
}

@Test
public void testElectricMotor() {
test("ElectricMotor");
test("ElectricMotor", true);
}

@Test
public void testGAA() {
test("GAA");
test("GAA", true);
}

@Test
public void testHBV() {
test("HBV");
test("HBV", true);
}

// @Test
// public void testLakeProblem() {
// test("LakeProblem");
// }
@Test
public void testLakeProblem() {
test("LakeProblem", true);
}

// @Test
// public void testLRGV() {
// test("LRGV");
// }
@Test
public void testLRGV() {
test("LRGV", false);
}

@Test
@Ignore("requires matlab")
public void testRadar() {
test("Radar");
test("Radar", false);
}

@Test
public void testWDS() {
test("WDS(GOY)");
test("WDS(GOY)", true);
}

}

0 comments on commit 29f171a

Please sign in to comment.