From b7378bc7f97af5c497423324febb817aaa721280 Mon Sep 17 00:00:00 2001 From: Yirmandias Date: Fri, 13 Oct 2023 18:14:57 +0200 Subject: [PATCH] make pub some fn and const --- planning/planners/src/solver.rs | 14 +++++++------- planning/planning/src/classical/mod.rs | 11 +++++++---- planning/planning/src/parsing/mod.rs | 1 - 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/planning/planners/src/solver.rs b/planning/planners/src/solver.rs index 16d6bd59..a1711360 100644 --- a/planning/planners/src/solver.rs +++ b/planning/planners/src/solver.rs @@ -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 = EnvParam::new("ARIES_PRINT_INITIAL_PROPAGATION", "false"); +pub static PRINT_INITIAL_PROPAGATION: EnvParam = EnvParam::new("ARIES_PRINT_INITIAL_PROPAGATION", "false"); /// If set to true, will print the raw model (before preprocessing) -static PRINT_RAW_MODEL: EnvParam = EnvParam::new("ARIES_PRINT_RAW_MODEL", "false"); +pub static PRINT_RAW_MODEL: EnvParam = EnvParam::new("ARIES_PRINT_RAW_MODEL", "false"); -static PRINT_PLANNER_OUTPUT: EnvParam = EnvParam::new("ARIES_PRINT_PLANNER_OUTPUT", "true"); +pub static PRINT_PLANNER_OUTPUT: EnvParam = EnvParam::new("ARIES_PRINT_PLANNER_OUTPUT", "true"); /// If set to true, will print the preprocessed model -static PRINT_MODEL: EnvParam = EnvParam::new("ARIES_PRINT_MODEL", "false"); +pub static PRINT_MODEL: EnvParam = EnvParam::new("ARIES_PRINT_MODEL", "false"); pub type SolverResult = aries::solver::parallel::SolverResult; @@ -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"); @@ -213,9 +213,9 @@ pub fn init_solver(model: Model) -> Box { } /// 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 { diff --git a/planning/planning/src/classical/mod.rs b/planning/planning/src/classical/mod.rs index b64609d5..aa49b038 100644 --- a/planning/planning/src/classical/mod.rs +++ b/planning/planning/src/classical/mod.rs @@ -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; @@ -105,7 +104,7 @@ fn holed_sv_to_pred( } pub fn from_chronicles(chronicles: &crate::chronicles::Problem) -> Result { - 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(); @@ -126,7 +125,9 @@ pub fn from_chronicles(chronicles: &crate::chronicles::Problem) -> Result Result