From 2ceb0d9f520b249a514c142043deeb18f3a6acfc Mon Sep 17 00:00:00 2001 From: maillard Date: Thu, 21 Sep 2023 16:57:44 -0700 Subject: [PATCH] Closed closed intervals in scheduling --- .../scheduler/simulation/SimulationResultsConverter.java | 4 +--- .../java/gov/nasa/jpl/aerie/scheduler/TestApplyWhen.java | 8 +++++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scheduler-driver/src/main/java/gov/nasa/jpl/aerie/scheduler/simulation/SimulationResultsConverter.java b/scheduler-driver/src/main/java/gov/nasa/jpl/aerie/scheduler/simulation/SimulationResultsConverter.java index d7f1bf34eb..0be3a6cead 100644 --- a/scheduler-driver/src/main/java/gov/nasa/jpl/aerie/scheduler/simulation/SimulationResultsConverter.java +++ b/scheduler-driver/src/main/java/gov/nasa/jpl/aerie/scheduler/simulation/SimulationResultsConverter.java @@ -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); diff --git a/scheduler-driver/src/test/java/gov/nasa/jpl/aerie/scheduler/TestApplyWhen.java b/scheduler-driver/src/test/java/gov/nasa/jpl/aerie/scheduler/TestApplyWhen.java index dada4b93e5..6b71101e41 100644 --- a/scheduler-driver/src/test/java/gov/nasa/jpl/aerie/scheduler/TestApplyWhen.java +++ b/scheduler-driver/src/test/java/gov/nasa/jpl/aerie/scheduler/TestApplyWhen.java @@ -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 @@ -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