Skip to content

Commit

Permalink
[issue1150] Allow prevail conditions with effects in potential optimi…
Browse files Browse the repository at this point in the history
…zer.

Previously, potential optimizer expected prevail conditions to be encoded as a precondition without an effect. It now accepts tasks where the prevail condition also occurs as an effect. This way task transformations that violate this assumption can be used.
  • Loading branch information
FlorianPommerening authored Sep 5, 2024
1 parent f2f132d commit eecab21
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/search/potentials/potential_optimizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,16 @@ void PotentialOptimizer::construct_lp() {
int post = effect.get_fact().get_value();
int pre_lp = lp_var_ids[var_id][pre];
int post_lp = lp_var_ids[var_id][post];
assert(pre_lp != post_lp);
coefficients.emplace_back(pre_lp, 1);
coefficients.emplace_back(post_lp, -1);
if (pre_lp != post_lp) {
/*
Prevail conditions with pre = post can occur in transformed
tasks, see issue1150. We ignore them since they cancel out and
LPConstraints may not have two coefficients for the same
variable.
*/
coefficients.emplace_back(pre_lp, 1);
coefficients.emplace_back(post_lp, -1);
}
}
sort(coefficients.begin(), coefficients.end());
for (const auto &coeff : coefficients)
Expand Down

0 comments on commit eecab21

Please sign in to comment.