dypdl-heuristic-search

Crates.iodypdl-heuristic-search
lib.rsdypdl-heuristic-search
version0.8.0
sourcesrc
created_at2023-02-20 21:16:50.507654
updated_at2024-06-07 19:12:32.237431
descriptionHeuristic search solvers for Dynamic Programming Description Language (DyPDL).
homepagehttps://didp.ai
repositoryhttps://github.com/domain-independent-dp/didp-rs
max_upload_size
id790160
size1,081,937
Jasper Chen (chyr98)

documentation

README

Actions Status crates.io minimum rustc 1.65 License License: MIT

dypdl-heuristic-search

dypdl-heuristic-search is a library of heuristic search solvers for DyPDL.

API Documentation

Example

use dypdl::prelude::*;
use dypdl_heuristic_search::{CabsParameters, create_dual_bound_cabs, FEvaluatorType};
use std::rc::Rc;

let mut model = Model::default();
let variable = model.add_integer_variable("variable", 0).unwrap();
model.add_base_case(
    vec![Condition::comparison_i(ComparisonOperator::Ge, variable, 1)]
).unwrap();
let mut increment = Transition::new("increment");
increment.set_cost(IntegerExpression::Cost + 1);
increment.add_effect(variable, variable + 1).unwrap();
model.add_forward_transition(increment.clone()).unwrap();
model.add_dual_bound(IntegerExpression::from(0)).unwrap();

let model = Rc::new(model);
let parameters = CabsParameters::default();
let f_evaluator_type = FEvaluatorType::Plus;

let mut solver = create_dual_bound_cabs(model, parameters, f_evaluator_type);
let solution = solver.search().unwrap();
assert_eq!(solution.cost, Some(1));
assert_eq!(solution.transitions, vec![increment]);
assert!(!solution.is_infeasible);
Commit count: 422

cargo fmt