Skip to content

Commit

Permalink
Update simulation performance results for scheduler tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienmaillard committed Aug 21, 2023
1 parent 1655064 commit 9f29731
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void getNextSolution_initialPlanInOutput() {
Truth.assertThat(plan.get().getActivitiesByTime())
.comparingElementsUsing(equalExceptInName)
.containsExactlyElementsIn(expectedPlan.getActivitiesByTime());
assertEquals(2, problem.getSimulationFacade().countSimulationRestarts());
assertEquals(1, problem.getSimulationFacade().countSimulationRestarts());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public void getNextSolution_initialPlanInOutput() {
assertThat(plan.get().getActivitiesByTime())
.comparingElementsUsing(equalExceptInName)
.containsExactlyElementsIn(expectedPlan.getActivitiesByTime());
assertEquals(2, problem.getSimulationFacade().countSimulationRestarts());
assertEquals(1, problem.getSimulationFacade().countSimulationRestarts());
}

@Test
Expand Down Expand Up @@ -246,7 +246,7 @@ public void getNextSolution_coexistenceGoalOnActivityWorks() {
assertThat(plan.getActivitiesByTime())
.comparingElementsUsing(equalExceptInName)
.containsAtLeastElementsIn(expectedPlan.getActivitiesByTime());
assertEquals(5, problem.getSimulationFacade().countSimulationRestarts());
assertEquals(4, problem.getSimulationFacade().countSimulationRestarts());
}

/**
Expand Down Expand Up @@ -288,7 +288,7 @@ public void getNextSolution_coexistenceGoalOnActivityWorks_withInitialSimResults
assertThat(plan.getActivitiesByTime())
.comparingElementsUsing(equalExceptInName)
.containsAtLeastElementsIn(expectedPlan.getActivitiesByTime());
assertEquals(4, problem.getSimulationFacade().countSimulationRestarts());
assertEquals(3, problem.getSimulationFacade().countSimulationRestarts());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ public void testRecurrenceCutoffUncontrollable() {
assertTrue(TestUtility.activityStartingAtTime(plan,Duration.of(6, Duration.SECONDS), activityType));
assertFalse(TestUtility.activityStartingAtTime(plan,Duration.of(11, Duration.SECONDS), activityType));
assertFalse(TestUtility.activityStartingAtTime(plan,Duration.of(16, Duration.SECONDS), activityType));
assertEquals(13, problem.getSimulationFacade().countSimulationRestarts());
assertEquals(8, problem.getSimulationFacade().countSimulationRestarts());
}


Expand Down Expand Up @@ -644,7 +644,7 @@ public void testCardinalityUncontrollable() { //ruled unpredictable for now
.reduce(Duration.ZERO, Duration::plus);
assertTrue(size >= 3 && size <= 10);
assertTrue(totalDuration.dividedBy(Duration.SECOND) >= 16 && totalDuration.dividedBy(Duration.SECOND) <= 19);
assertEquals(17, problem.getSimulationFacade().countSimulationRestarts());
assertEquals(9, problem.getSimulationFacade().countSimulationRestarts());
}


Expand Down Expand Up @@ -698,7 +698,7 @@ public void testCoexistenceWindowCutoff() {
logger.debug(a.startOffset().toString() + ", " + a.duration().toString());
}
assertEquals(4, plan.get().getActivitiesByTime().size());
assertEquals(3, problem.getSimulationFacade().countSimulationRestarts());
assertEquals(2, problem.getSimulationFacade().countSimulationRestarts());
}

@Test
Expand Down Expand Up @@ -753,7 +753,7 @@ public void testCoexistenceJustFits() {
logger.debug(a.startOffset().toString() + ", " + a.duration().toString());
}
assertEquals(5, plan.get().getActivitiesByTime().size());
assertEquals(4, problem.getSimulationFacade().countSimulationRestarts());
assertEquals(3, problem.getSimulationFacade().countSimulationRestarts());
}

@Test
Expand Down Expand Up @@ -817,7 +817,7 @@ public void testCoexistenceUncontrollableCutoff() { //ruled unpredictable for no
assertEquals(2, plan.get().getActivitiesByTime()
.stream().filter($ -> $.duration().dividedBy(Duration.SECOND) == 2).toList()
.size());
assertEquals(6, problem.getSimulationFacade().countSimulationRestarts());
assertEquals(3, problem.getSimulationFacade().countSimulationRestarts());
}

@Test
Expand Down Expand Up @@ -1027,7 +1027,7 @@ public void testCoexistenceWindowsBisect() { //bad, should fail completely. wort
assertTrue(TestUtility.activityStartingAtTime(plan.get(), Duration.of(1, Duration.SECONDS), actTypeA));
assertTrue(TestUtility.activityStartingAtTime(plan.get(), Duration.of(8, Duration.SECONDS), actTypeA));
assertTrue(TestUtility.activityStartingAtTime(plan.get(), Duration.of(10, Duration.SECONDS), actTypeA));
assertEquals(4, problem.getSimulationFacade().countSimulationRestarts());
assertEquals(3, problem.getSimulationFacade().countSimulationRestarts());
}

@Test
Expand Down Expand Up @@ -1095,7 +1095,7 @@ public void testCoexistenceWindowsBisect2() { //corrected. Bisection does work s
assertFalse(TestUtility.activityStartingAtTime(plan.get(), Duration.of(5, Duration.SECONDS), actTypeA));
assertTrue(TestUtility.activityStartingAtTime(plan.get(), Duration.of(9, Duration.SECONDS), actTypeA));
assertFalse(TestUtility.activityStartingAtTime(plan.get(), Duration.of(14, Duration.SECONDS), actTypeA));
assertEquals(4, problem.getSimulationFacade().countSimulationRestarts());
assertEquals(3, problem.getSimulationFacade().countSimulationRestarts());
}

@Test
Expand Down Expand Up @@ -1150,7 +1150,7 @@ public void testCoexistenceUncontrollableJustFits() {
logger.debug(a.startOffset().toString() + ", " + a.duration().toString());
}
assertEquals(5, plan.get().getActivitiesByTime().size());
assertEquals(6, problem.getSimulationFacade().countSimulationRestarts());
assertEquals(3, problem.getSimulationFacade().countSimulationRestarts());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void testNonLinear(){
assertTrue(TestUtility.containsActivity(plan, planningHorizon.fromStart("PT0S"), planningHorizon.fromStart("PT1M29S"), problem.getActivityType("SolarPanelNonLinear")));
assertTrue(TestUtility.containsActivity(plan, planningHorizon.fromStart("PT16M40S"), planningHorizon.fromStart("PT18M9S"), problem.getActivityType("SolarPanelNonLinear")));
assertTrue(TestUtility.containsActivity(plan, planningHorizon.fromStart("PT33M20S"), planningHorizon.fromStart("PT34M49S"), problem.getActivityType("SolarPanelNonLinear")));
assertEquals(31, problem.getSimulationFacade().countSimulationRestarts());
assertEquals(13, problem.getSimulationFacade().countSimulationRestarts());
}

@Test
Expand Down Expand Up @@ -149,7 +149,7 @@ public void testTimeDependent(){
assertTrue(TestUtility.containsActivity(plan, planningHorizon.fromStart("PT33M20S"), planningHorizon.fromStart("PT36M47S"), problem.getActivityType("SolarPanelNonLinearTimeDependent")));
assertTrue(TestUtility.containsActivity(plan, planningHorizon.fromStart("PT0S"), planningHorizon.fromStart("PT2M21S"), problem.getActivityType("SolarPanelNonLinearTimeDependent")));
assertTrue(TestUtility.containsActivity(plan, planningHorizon.fromStart("PT16M40S"), planningHorizon.fromStart("PT17M18S"), problem.getActivityType("SolarPanelNonLinearTimeDependent")));
assertEquals(41, problem.getSimulationFacade().countSimulationRestarts());
assertEquals(21, problem.getSimulationFacade().countSimulationRestarts());
}

@Test
Expand Down Expand Up @@ -223,7 +223,7 @@ public void testScheduleExceptionThrowingTask(){
planningHorizon.fromStart("PT120S"),
planningHorizon.fromStart("PT120S"),
problem.getActivityType("LateRiser")));
assertEquals(4, problem.getSimulationFacade().countSimulationRestarts());
assertEquals(3, problem.getSimulationFacade().countSimulationRestarts());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public void activitiesAnchoredToPlan() {
final var actualSimResults = driver.getSimulationResultsUpTo(planStart, tenDays);

assertEqualsSimulationResults(expectedSimResults, actualSimResults);
assertEquals(2, driver.getCountSimulationRestarts());
assertEquals(1, driver.getCountSimulationRestarts());
}

@Test
Expand Down Expand Up @@ -578,7 +578,7 @@ public void decomposingActivitiesAndAnchors(){

// We have examined all the children
assertTrue(childSimulatedActivities.isEmpty());
assertEquals(2, driver.getCountSimulationRestarts());
assertEquals(1, driver.getCountSimulationRestarts());
}

@Test
Expand Down Expand Up @@ -623,7 +623,7 @@ public void naryTreeAnchorChain() {

assertEquals(3906, expectedSimResults.simulatedActivities.size());
assertEqualsSimulationResults(expectedSimResults, actualSimResults);
assertEquals(2, driver.getCountSimulationRestarts());
assertEquals(1, driver.getCountSimulationRestarts());
}
}

Expand Down

0 comments on commit 9f29731

Please sign in to comment.