pub struct Task {
pub variables: Vec<Variable>,
pub operators: Vec<Operator>,
pub initial: State,
pub goal: Vec<Fact>,
pub axioms: Vec<Axiom>,
}Fields§
§variables: Vec<Variable>§operators: Vec<Operator>§initial: StateAs in Fast Downward, the values of derived variables here are their
defaults, which hold unless an axiom derives otherwise. Use
Task::initial_state for the state with axioms evaluated.
goal: Vec<Fact>§axioms: Vec<Axiom>Implementations§
Source§impl Task
impl Task
pub fn validate(&self) -> Result<(), TaskError>
pub fn num_variables(&self) -> usize
pub fn is_applicable(&self, op: OpId, state: &State) -> bool
Sourcepub fn apply(&self, op: OpId, state: &State) -> State
pub fn apply(&self, op: OpId, state: &State) -> State
The successor state. Effect conditions are evaluated in state;
derived variables are then re-evaluated.
Like Task::is_applicable and Task::is_goal, this reads derived
variables from state as given, so state must have them evaluated:
start from Task::initial_state (not Task::initial) or call
Task::evaluate_axioms first. States returned by apply are.
Sourcepub fn evaluate_axioms(&self, state: &mut State)
pub fn evaluate_axioms(&self, state: &mut State)
Recomputes all derived variables of state from its state variables:
each derived variable is reset to its default (its value in
Task::initial), then the axioms fire layer by layer until nothing
changes, as in Fast Downward. A variable keeps the first non-default
value derived for it.
This allocates nothing but rescans the rules of a layer until none fires; search code that needs speed on axiom-heavy tasks should index the rules itself.
Sourcepub fn initial_state(&self) -> State
pub fn initial_state(&self) -> State
The initial state with derived variables evaluated.
pub fn applicable_operators<'a>( &'a self, state: &'a State, ) -> impl Iterator<Item = OpId> + 'a
pub fn is_goal(&self, state: &State) -> bool
Sourcepub fn costs(&self) -> Vec<u64>
pub fn costs(&self) -> Vec<u64>
Operator costs indexed by operator id (the label cost function).
Sourcepub fn validate_plan(&self, plan: &[OpId]) -> Option<u64>
pub fn validate_plan(&self, plan: &[OpId]) -> Option<u64>
Checks that plan is applicable from the initial state and reaches the goal.
Returns the plan cost.