aerie icon indicating copy to clipboard operation
aerie copied to clipboard

Pathological performance of certain scheduling goals

Open mattdailis opened this issue 2 years ago • 0 comments

Checked for duplicates

Yes - I've already checked

Is this a regression?

No - This is a new bug

Version

1.12.0

Describe the bug

Certain scheduling goals have been taking a very long time to schedule. Here is the shape of one such goal:

Expand to see goal
var INSTRUMENT_Power_Cycle_ACTIVITY_TYPE_1: Goal = Goal.CoexistenceGoal({
    forEach: ActivityExpression.ofType(ActivityTypes.ACTIVITY_TYPE_1),
    activityTemplate: ActivityTemplates.POWER_ON({
        sensor: "LEFT"}),
    activityFinder: ActivityExpression.ofType(ActivityTypes.POWER_ON),
    startsAt: TimingConstraint.singleton(WindowProperty.END).plus(Temporal.Duration.from({ minutes: 10 }))
}).applyWhen(Discrete.Resource("/resource/1").equal("ON")).and( Goal.CoexistenceGoal({
  forEach: ActivityExpression.ofType(ActivityTypes.ACTIVITY_TYPE_1),
  activityTemplate: ActivityTemplates.POWER_ON({
      sensor: "RIGHT"}),
  activityFinder: ActivityExpression.ofType(ActivityTypes.POWER_ON),
  startsAt: TimingConstraint.singleton(WindowProperty.END).plus(Temporal.Duration.from({ seconds: 601 }))
}).applyWhen(Discrete.Resource("/resource/1").equal("ON"))).and(Goal.CoexistenceGoal({
    forEach: ActivityExpression.ofType(ActivityTypes.ACTIVITY_TYPE_1),
    activityTemplate:ActivityTemplates.POWER_OFF({
        Description: "Turn left instrument off prior to ACTIVITY_TYPE_1",
        sensor: "LEFT"
    }),
    activityFinder: ActivityExpression.ofType(ActivityTypes.POWER_OFF),
    startsAt: TimingConstraint.singleton(WindowProperty.START).minus(Temporal.Duration.from({ minutes: 10 }))
}).and(Goal.CoexistenceGoal({
  forEach: ActivityExpression.ofType(ActivityTypes.ACTIVITY_TYPE_1),
  activityTemplate:ActivityTemplates.POWER_OFF({
      Description: "Turn right instrument off prior to ACTIVITY_TYPE_1",
      sensor: "RIGHT"
  }),
  activityFinder: ActivityExpression.ofType(ActivityTypes.POWER_OFF),
  startsAt: TimingConstraint.singleton(WindowProperty.START).minus(Temporal.Duration.from({ seconds: 601 }))
})))

var Execute_ACTIVITY_TYPE_1: Goal = Goal.ActivityRecurrenceGoal({
      activityFinder: ActivityExpression.ofType(ActivityTypes.ACTIVITY_TYPE_1), 
      activityTemplate: ActivityTemplates.ACTIVITY_TYPE_1({
        param1: 0,
        param2: 1,
        param3: 2,
        param4: 3,
        param5: 4,
        param6: 5
      }),
      interval: Temporal.Duration.from({ days: 21 })
    }
)

export default (): Goal => {
    return Execute_ACTIVITY_TYPE_1.and(INSTRUMENT_Power_Cycle_ACTIVITY_TYPE_1)
}

This ticket is to track reproduction/investigation work towards understanding the root cause of this poor performance.

Reproduction

Reproduction steps to come.

Logs

No response

System Info

Running locally on a Mac (system specs to come)

Severity

Moderate

mattdailis avatar Oct 10 '23 01:10 mattdailis