Skip to content

Commit

Permalink
feat(encode): Allow setting the planning horizon through an env-param.
Browse files Browse the repository at this point in the history
  • Loading branch information
arbimo committed Dec 11, 2023
1 parent 739726c commit 650ef16
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion planning/planners/src/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ pub fn encode(pb: &FiniteProblem, metric: Option<Metric>) -> std::result::Result
.map(|(eff_id, prez, _)| {
let var = solver.model.new_optional_fvar(
ORIGIN * TIME_SCALE.get(),
HORIZON * TIME_SCALE.get(),
HORIZON.get() * TIME_SCALE.get(),
TIME_SCALE.get(),
*prez,
Container::Instance(eff_id.instance_id) / VarType::EffectEnd,
Expand Down
10 changes: 7 additions & 3 deletions planning/planners/src/encoding.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
use aries::core::Lit;
use aries::model::lang::FAtom;
use aries_planning::chronicles::*;
use env_param::EnvParam;
use std::collections::{BTreeSet, HashSet};

/// Temporal origin
pub const ORIGIN: i32 = 0;

/// The maximum duration of the plan.
pub static HORIZON: EnvParam<i32> = EnvParam::new("ARIES_PLANNING_HORIZON", "10000");

/// Identifier of a condition
#[derive(Ord, PartialOrd, Eq, PartialEq, Hash, Copy, Clone)]
pub struct CondID {
Expand Down Expand Up @@ -78,9 +85,6 @@ pub fn conditions(pb: &FiniteProblem) -> impl Iterator<Item = (CondID, Lit, &Con
})
}

pub const ORIGIN: i32 = 0;
pub const HORIZON: i32 = 999999;

pub struct TaskRef<'a> {
pub presence: Lit,
pub start: FAtom,
Expand Down

0 comments on commit 650ef16

Please sign in to comment.