Skip to content

Commit

Permalink
Closed closed intervals in scheduling
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienmaillard committed Sep 28, 2023
1 parent fd6e586 commit 2ceb0d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ public static gov.nasa.jpl.aerie.constraints.model.ActivityInstance convertToCon
{
final var startT = Duration.of(startTime.until(driverActivity.start(), ChronoUnit.MICROS), MICROSECONDS);
final var endT = startT.plus(driverActivity.duration());
final var activityInterval = startT.isEqualTo(endT)
? Interval.between(startT, endT)
: Interval.betweenClosedOpen(startT, endT);
final var activityInterval = Interval.between(startT, endT);
return new gov.nasa.jpl.aerie.constraints.model.ActivityInstance(
id, driverActivity.type(), driverActivity.arguments(),
activityInterval);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,8 @@ public void testCoexistenceWindows() {

assertTrue(TestUtility.activityStartingAtTime(plan.get(), Duration.of(1, Duration.SECONDS), actTypeA));
assertTrue(TestUtility.activityStartingAtTime(plan.get(), Duration.of(14, Duration.SECONDS), actTypeA));
assertEquals(3, problem.getSimulationFacade().countSimulationRestarts());
assertTrue(TestUtility.activityStartingAtTime(plan.get(), Duration.of(12, Duration.SECONDS), actTypeA));
assertEquals(4, problem.getSimulationFacade().countSimulationRestarts());
}

@Test
Expand Down Expand Up @@ -971,12 +972,13 @@ public void testCoexistenceWindowsCutoffMidActivity() {
for(SchedulingActivityDirective a : plan.get().getActivitiesByTime()){
logger.debug(a.startOffset().toString() + ", " + a.duration().toString());
}

assertEquals(10, plan.get().getActivitiesById().size());
assertTrue(TestUtility.activityStartingAtTime(plan.get(), Duration.of(2, Duration.SECONDS), actTypeB));
assertTrue(TestUtility.activityStartingAtTime(plan.get(), Duration.of(10, Duration.SECONDS), actTypeB));
assertTrue(TestUtility.activityStartingAtTime(plan.get(), Duration.of(16, Duration.SECONDS), actTypeB));
assertTrue(TestUtility.activityStartingAtTime(plan.get(), Duration.of(23, Duration.SECONDS), actTypeB));
assertTrue(TestUtility.activityStartingAtTime(plan.get(), Duration.of(25, Duration.SECONDS), actTypeB));
assertEquals(5, problem.getSimulationFacade().countSimulationRestarts());
assertEquals(6, problem.getSimulationFacade().countSimulationRestarts());
}

@Test
Expand Down

0 comments on commit 2ceb0d9

Please sign in to comment.