Skip to content

Commit

Permalink
add new vartype
Browse files Browse the repository at this point in the history
  • Loading branch information
Yirmandias committed Sep 1, 2023
1 parent 6661879 commit 1451740
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
8 changes: 6 additions & 2 deletions planning/planners/src/solver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,12 @@ impl Heuristic<VarLabel> for ActivityNonTemporalFirstHeuristic {
match label.as_ref() {
None => 0,
Some(VarLabel(_, tpe)) => match tpe {
VarType::Presence | VarType::Reification | VarType::Parameter(_) => 0,
VarType::ChronicleStart | VarType::ChronicleEnd | VarType::TaskStart(_) | VarType::TaskEnd(_) => 1,
VarType::Presence | VarType::Reification | VarType::Parameter(_) | VarType::Arbitrary => 0,
VarType::ChronicleStart
| VarType::ChronicleEnd
| VarType::TaskStart(_)
| VarType::TaskEnd(_)
| VarType::InternalTimepoint => 1,
VarType::Horizon | VarType::EffectEnd | VarType::Cost => 2,
},
}
Expand Down
4 changes: 4 additions & 0 deletions planning/planning/src/chronicles/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,10 @@ pub enum VarType {
Parameter(String),
Reification,
Cost,
/// Internal timepoint that does not appear in the start and end timepoints, nor in the chronicle start and end.
InternalTimepoint,
/// Arbitrary variable
Arbitrary,
}

#[derive(Clone)]
Expand Down
2 changes: 2 additions & 0 deletions planning/planning/src/chronicles/printer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ impl<'a> Printer<'a> {
VarType::Parameter(name) => print!("{name}"),
VarType::Reification => print!("reif_{v:?}"),
VarType::Cost => print!("cost_{v:?}"),
VarType::Arbitrary => print!("arb_{v:?}"),
VarType::InternalTimepoint => print!("t_{v:?}"),
}
} else if v == VarRef::ZERO {
print!("0");
Expand Down
2 changes: 2 additions & 0 deletions solver/src/core/variable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ pub type IntCst = i32;

/// Overflow tolerant min value for integer constants.
/// It is used as a default for the lower bound of integer variable domains
//pub const INT_CST_MIN: IntCst = -1000 * 100 / 2 + 1;
pub const INT_CST_MIN: IntCst = IntCst::MIN / 2 + 1;

/// Overflow tolerant max value for integer constants.
/// It is used as a default for the upper bound of integer variable domains
//pub const INT_CST_MAX: IntCst = 1000 * 1000 / 2 - 1;
pub const INT_CST_MAX: IntCst = IntCst::MAX / 2 - 1;

create_ref_type!(VarRef);
Expand Down

0 comments on commit 1451740

Please sign in to comment.