When constructing the LP for potential heuristics, we have an assertion that prevail conditions are encoded as a precondition without an effect (instead of a precondition with an effect that sets the same fact again). This is important because if we loop over effects and look up the corresponding precondition, we would not get a self loop. For the LP, every outgoing edge occurs in the constraint with coefficient +1 and every incoming edge with -1, so a self loop cancels out. If we are not skipping self loops, however, we end up adding the same variable once with coefficient +1 and once with -1, which is not allowed in the interface of the solver and can lead to segfaults.
For the root task, the assertion is valid, because we parse it in way that prevail conditions are represented only as a precondition. But if the potential optimizer is used on a transformed task, the assertion can fail.
Instead of asserting that the precondition of a variable is different from its effect, we can just check for this and skip the effect if it corresponds to a prevail condition.
|