17 unstable releases (7 breaking)

0.8.0 Jun 7, 2024
0.7.2 Mar 9, 2024
0.6.1 Dec 24, 2023
0.5.0 Aug 11, 2023
0.3.3 Mar 21, 2023

#98 in Programming languages

48 downloads per month
Used in 2 crates

MIT/Apache

3.5MB
70K SLoC

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);

Dependencies

~4–9MB
~87K SLoC