Skip to content

Fix propagation of goal constraints in some cases

Tjerk Vreeken requested to merge goal-constraint-propagation into master

What follows is an example which would go wrong. There are three goals defined for the same state/function_key, at different priorities.

Priority Min Max
1 0 10
2 1
3 2

In priority 2 and 3, the upper bound for priority is missing. Because the affected lines checked for the existence of has_target_max on the goal, priority 1 and 2 would run correctly. However, when coming through these lines in priority 3, existing_constraint.goal.has_target_max would evaluate to False (because no upper bound was specified), even though the state itself was limited to 10.

By avoiding checking the original goal, and only referring to the range set on the state constraint itself, we fix this, and propagate the upper bound of 10 to all lower priority goals.

Merge request reports