Skip to content

Commit

Permalink
make pub some fn and const
Browse files Browse the repository at this point in the history
  • Loading branch information
Yirmandias committed Oct 13, 2023
1 parent 71a1b5f commit b7378bc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
14 changes: 7 additions & 7 deletions planning/planners/src/solver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ use std::sync::Arc;
use std::time::Instant;

/// If set to true, prints the result of the initial propagation at each depth.
static PRINT_INITIAL_PROPAGATION: EnvParam<bool> = EnvParam::new("ARIES_PRINT_INITIAL_PROPAGATION", "false");
pub static PRINT_INITIAL_PROPAGATION: EnvParam<bool> = EnvParam::new("ARIES_PRINT_INITIAL_PROPAGATION", "false");

/// If set to true, will print the raw model (before preprocessing)
static PRINT_RAW_MODEL: EnvParam<bool> = EnvParam::new("ARIES_PRINT_RAW_MODEL", "false");
pub static PRINT_RAW_MODEL: EnvParam<bool> = EnvParam::new("ARIES_PRINT_RAW_MODEL", "false");

static PRINT_PLANNER_OUTPUT: EnvParam<bool> = EnvParam::new("ARIES_PRINT_PLANNER_OUTPUT", "true");
pub static PRINT_PLANNER_OUTPUT: EnvParam<bool> = EnvParam::new("ARIES_PRINT_PLANNER_OUTPUT", "true");

/// If set to true, will print the preprocessed model
static PRINT_MODEL: EnvParam<bool> = EnvParam::new("ARIES_PRINT_MODEL", "false");
pub static PRINT_MODEL: EnvParam<bool> = EnvParam::new("ARIES_PRINT_MODEL", "false");

pub type SolverResult<Sol> = aries::solver::parallel::SolverResult<Sol>;

Expand Down Expand Up @@ -160,7 +160,7 @@ pub fn solve(
/// Note that is meant to facilitate debugging of the planner during development.
///
/// Returns true if the propagation succeeded.
fn propagate_and_print(pb: &FiniteProblem) -> bool {
pub fn propagate_and_print(pb: &FiniteProblem) -> bool {
let Ok(EncodedProblem { model, .. }) = encode(pb, None) else {
if PRINT_PLANNER_OUTPUT.get() {
println!("==> Invalid model");
Expand Down Expand Up @@ -213,9 +213,9 @@ pub fn init_solver(model: Model<VarLabel>) -> Box<Solver> {
}

/// Default set of strategies for HTN problems
const HTN_DEFAULT_STRATEGIES: [Strat; 3] = [Strat::Causal, Strat::ActivityNonTemporalFirst, Strat::Forward];
pub const HTN_DEFAULT_STRATEGIES: [Strat; 3] = [Strat::Causal, Strat::ActivityNonTemporalFirst, Strat::Forward];
/// Default set of strategies for generative (flat) problems.
const GEN_DEFAULT_STRATEGIES: [Strat; 2] = [Strat::Activity, Strat::ActivityNonTemporalFirst];
pub const GEN_DEFAULT_STRATEGIES: [Strat; 2] = [Strat::Activity, Strat::ActivityNonTemporalFirst];

#[derive(Copy, Clone, Debug)]
pub enum Strat {
Expand Down
11 changes: 7 additions & 4 deletions planning/planning/src/classical/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use aries::utils::enumerate;
use aries::utils::input::Sym;
use std::collections::HashMap;
use std::convert::TryFrom;
use std::ops::Deref;
use streaming_iterator::StreamingIterator;

pub mod heuristics;
Expand Down Expand Up @@ -105,7 +104,7 @@ fn holed_sv_to_pred(
}

pub fn from_chronicles(chronicles: &crate::chronicles::Problem) -> Result<LiftedProblem> {
let symbols = chronicles.context.model.get_symbol_table().deref().clone();
let symbols = chronicles.context.model.get_symbol_table().clone();

let world = World::new(symbols, &chronicles.context.fluents)?;
let mut state = world.make_new_state();
Expand All @@ -126,7 +125,9 @@ pub fn from_chronicles(chronicles: &crate::chronicles::Problem) -> Result<Lifted
eff.effective_start() == ctx.origin(),
"Effect not at start in initial chronicle",
);
let EffectOp::Assign(eff_value) = eff.operation else { bail!("Not an assignment")};
let EffectOp::Assign(eff_value) = eff.operation else {
bail!("Not an assignment")
};
let lit = sv_to_lit(eff.variable(), eff_value, &world, ctx)?;
state.set(lit);
}
Expand Down Expand Up @@ -215,7 +216,9 @@ pub fn from_chronicles(chronicles: &crate::chronicles::Problem) -> Result<Lifted
eff.effective_start() == template.chronicle.end + Time::EPSILON,
"Effect is not active at action's end",
);
let EffectOp::Assign(eff_value) = eff.operation else { bail!("Not an assignment")};
let EffectOp::Assign(eff_value) = eff.operation else {
bail!("Not an assignment")
};
let pred = holed_sv_to_pred(eff.variable(), eff_value, &correspondance)?;
schema.eff.push(pred);
}
Expand Down
1 change: 0 additions & 1 deletion planning/planning/src/parsing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use aries::utils::input::{ErrLoc, Loc, Sym};
use itertools::Itertools;
use std::collections::{HashMap, HashSet};
use std::convert::TryFrom;
use std::ops::Deref;
use std::str::FromStr;
use std::sync::Arc;

Expand Down

0 comments on commit b7378bc

Please sign in to comment.