Crates.io | pddl_rs |
lib.rs | pddl_rs |
version | 0.3.1 |
source | src |
created_at | 2023-04-09 13:10:03.079796 |
updated_at | 2023-11-15 14:13:36.078985 |
description | PDDL parser |
homepage | |
repository | https://github.com/Hexorg/pddl_rs/ |
max_upload_size | |
id | 834188 |
size | 218,765 |
PDDL Planner based on Daniel L. Kovacs' BNF definition BNF Definition of PDDL. Includes basic planning algorithms inspired by PDDL4J library. Can solve simple planning problems.
From PDDL4J's Readme:
PDDL was originally developed by Drew McDermott and the 1998 planning competition committee. It was inspired by the need to encourage the empirical comparison of planning systems and the exchange of planning benchmarks within the community. Its development improved the communication of research results and triggered an explosion in performance, expressivity and robustness of planning systems.
PDDL has become a de facto standard language for describing planning domains, not only for the competition but more widely, as it offers an opportunity to carry out empirical evaluation of planning systems on a growing collection of generally adopted standard benchmark domains. The emergence of a language standard will have an impact on the entire field, influencing what is seen as central and what peripheral in the development of planning systems.
use std::fs;
use std::path::PathBuf;
use pddl_rs::{Sources, Objects, search::{a_star, AstarInternals}};
let domain_filename = PathBuf::from("sample_problems/simple_domain.pddl");
let problem_filename = PathBuf::from("sample_problems/simple_problem.pddl");
let sources = Sources::load(domain_filename, problem_filename);
let (domain, problem) = sources.parse();
let c_problem = sources.compile(&domain, &problem);
println!("Compiled problem needs {} bits of memory and uses {} actions.", c_problem.memory_size, c_problem.actions.len());
let mut args = AstarInternals::new(&c_problem.action_graph);
if let Some(solution) = a_star(&c_problem, Some(&domain), Some(&problem), &mut args) {
println!("Solution is {} actions long.", solution.len());
for action_id in &solution {
let action = c_problem.actions.get(*action_id as usize).unwrap();
println!("\t{}{:?}", domain.actions[action.domain_action_idx as usize].name(), action.args.iter().map(|(row, col)| problem.objects.get_object_name(*row,*col).1).collect::<Vec<&str>>());
}
}
The code is avilable on GitHub