diff --git a/scheduler-driver/src/main/java/gov/nasa/jpl/aerie/scheduler/solver/PrioritySolver.java b/scheduler-driver/src/main/java/gov/nasa/jpl/aerie/scheduler/solver/PrioritySolver.java index f6118ee737..faeff1a479 100644 --- a/scheduler-driver/src/main/java/gov/nasa/jpl/aerie/scheduler/solver/PrioritySolver.java +++ b/scheduler-driver/src/main/java/gov/nasa/jpl/aerie/scheduler/solver/PrioritySolver.java @@ -454,7 +454,7 @@ private void rollback(Goal goal){ plan.remove(insertedActivities); evalForGoal.removeAssociation(associatedActivities); evalForGoal.removeAssociation(insertedActivities); - evalForGoal.setScore(-(evalForGoal.getNbConflictsDetected().get())); + evalForGoal.setScore(-(evalForGoal.getNbConflictsDetected().orElse(1))); } private void satisfyCompositeGoal(CompositeAndGoal goal) { @@ -467,6 +467,13 @@ private void satisfyCompositeGoal(CompositeAndGoal goal) { if (evaluation.forGoal(subgoal).getScore() == 0) { logger.info("AND goal " + goal.getName() + ": subgoal " + subgoal.getName() + " has been satisfied, moving on to next subgoal"); nbGoalSatisfied++; + } else { + logger.info("AND goal " + goal.getName() + ": subgoal " + subgoal.getName() + " has NOT been satisfied"); + if(goal.shouldRollbackIfUnsatisfied()){ + logger.info("AND goal " + goal.getName() + ": stopping goal satisfaction after first failure, use shouldRollbackIfUnsatisfied() on AND goal to maximize satisfaction instead of early termination"); + break; + } + logger.info("AND goal " + goal.getName() + ": moving on to next subgoal (trying to maximize satisfaction)"); } } final var goalIsSatisfied = (nbGoalSatisfied == goal.getSubgoals().size());