aerie icon indicating copy to clipboard operation
aerie copied to clipboard

Activity recurrence goals allow too large an interval

Open DavidLegg opened this issue 2 years ago • 3 comments

Checked for duplicates

Yes - I've already checked

Is this a regression?

No - This is a new bug

Version

1.13 - commit 67800ea

Describe the bug

Activity recurrence goals allow for consecutive activities that are up to twice the interval size apart when checking for conflicts.

Reproduction

Load the banananation model in a local simulation, and create a one-day plan with it, starting exactly at midnight for ease of seeing the timing window boundaries.

Add the following scheduling goal:

export default (): Goal => {
  return Goal.ActivityRecurrenceGoal({
    activityTemplate: ActivityTemplates.BiteBanana({
      biteSize: 0.2
    }),
    interval: Temporal.Duration.from({ hours: 1 })
  })
}

Run scheduling. You should see a BiteBanana activity scheduled every hour, on the hour.

Delete one of the activities. Now re-run scheduling or analyze goals. Both report that the scheduling goal is fully satisfied. image This is wrong according to the documentation, as there's a two-hour gap between activities, twice the required interval. It's consistent with the interpretation that "every 1-hour slice has at least 1 activity", if slices include their endpoints.

Now move the activity after the one you deleted forward by any amount. Analyze scheduling goals, and it reports a failure: image

Re-run scheduling goals, and it inserts two new activities: image This is consistent with the documentation, but it's not consistent with the alternate interpretation proposed above.

Logs

No response

System Info

Running Aerie locally

Severity

Moderate

Workaround

Manually add missing activity

DavidLegg avatar Sep 07 '23 02:09 DavidLegg

@DavidLegg and I started to talk about that. Posting some diagrams we made before it is lost forever. Screenshot 2023-09-18 at 4 19 56 PM

adrienmaillard avatar Sep 18 '23 23:09 adrienmaillard

I believe the problem comes from the fact that we get all the conflicts at once during the one conflict evaluation and that each conflict is independent and does not know about how other conflicts have been solved. Let's say that each activity is given a 1-hour window, it is possible that other constraints makes it so that the first activity is at time 0 and the second is at time 2-hour. This is the fundamental problem of this goal.

adrienmaillard avatar Jul 16 '24 21:07 adrienmaillard

one way to deal with this would be to reinstate post conflict evaluation and get only one conflict at a time

adrienmaillard avatar Jul 16 '24 21:07 adrienmaillard