Skip to content

Commit

Permalink
refactor(planning): can disable penalty on numeric fluents
Browse files Browse the repository at this point in the history
  • Loading branch information
Shi-Raida committed Dec 11, 2024
1 parent cc9a949 commit 7eb0505
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions planning/planners/src/encode/symmetry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use crate::Model;
pub static SYMMETRY_BREAKING: EnvParam<SymmetryBreakingType> = EnvParam::new("ARIES_LCP_SYMMETRY_BREAKING", "psp");
pub static USELESS_SUPPORTS: EnvParam<bool> = EnvParam::new("ARIES_USELESS_SUPPORTS", "true");
pub static DETRIMENTAL_SUPPORTS: EnvParam<bool> = EnvParam::new("ARIES_DETRIMENTAL_SUPPORTS", "true");
pub static PENALIZE_NUMERIC_SUPPORTS: EnvParam<bool> = EnvParam::new("ARIES_PENALIZE_NUMERIC_SUPPORTS", "true");
pub static PSP_ABSTRACTION_HIERARCHY: EnvParam<bool> = EnvParam::new("ARIES_PSP_ABSTRACTION_HIERARCHY", "true");

/// The type of symmetry breaking to apply to problems.
Expand Down Expand Up @@ -89,6 +90,7 @@ fn add_plan_space_symmetry_breaking(pb: &FiniteProblem, model: &mut Model, encod
let discard_useless_supports = USELESS_SUPPORTS.get();
let discard_detrimental_supports = DETRIMENTAL_SUPPORTS.get();
let sort_by_hierarchy_level = PSP_ABSTRACTION_HIERARCHY.get();
let penalize_numeric_supports = PENALIZE_NUMERIC_SUPPORTS.get();

let template_id = |instance_id: usize| match pb.chronicles[instance_id].origin {
ChronicleOrigin::FreeAction { template_id, .. } => Some(template_id),
Expand Down Expand Up @@ -196,8 +198,11 @@ fn add_plan_space_symmetry_breaking(pb: &FiniteProblem, model: &mut Model, encod
let sort_key = |c: &CondID| {
// penalize conditions on numeric fluents because the encoding
// makes it hard to distinguish actual supports, they should be considered last
let penalty = if is_num(c) { 1024 } else { 0 };
// let penalty = 0;
let penalty = if penalize_numeric_supports && is_num(c) {
1024
} else {
0
};
// get the level, reserving the lvl 0 for non-templates
if let Some(template) = template_id(c.instance_id) {
let lvl = pb.meta.action_hierarchy[&template];
Expand Down

0 comments on commit 7eb0505

Please sign in to comment.