pub fn solve<PS: planner::ProblemSpace + planner::Lifelong>(
    ps: &mut PS,
    start: PS::State,
    goal: PS::State,
    rx: mpsc::Receiver<(PS::State, PS::State)>,
    callback: fn(Vec<PS::State>),
) {
    // TODO: add key_modifier parameter.
    let mut start_int: PS::State = start;
    let mut open: collections::BinaryHeap<util::HeapEntry<PS::State>> =
        collections::BinaryHeap::new();
    let mut data: collections::HashMap<PS::State, util::StateData> = collections::HashMap::new();

    data.insert(
        start_int,
        util::StateData {
            g: f64::INFINITY,
            rhs: f64::INFINITY,
        },
    );
    data.insert(
        goal,
        util::StateData {
            g: f64::INFINITY,
            rhs: 0.0,
        },
    );
    open.push(util::HeapEntry::new_entry(
        goal,
        key(&data[&goal], ps.heuristic(&goal, &start_int)),
    ));

    compute_path(ps, start_int, goal, &mut data, &mut open);
    publish_path(ps, start_int, goal, &mut data, callback);
    loop {
        let (u, new_start) = rx.recv().unwrap();
        if new_start == goal {
            break;
        }
        start_int = new_start;
        ps.update(&u);
        update_state(ps, u, start_int, goal, &mut data, &mut open);
        compute_path(ps, start_int, goal, &mut data, &mut open);
        publish_path(ps, start_int, goal, &mut data, callback);
    }
}
///
/// Find a plan to get from start to goal, given a problem space.
///
/// *Note*: This will run forever! Signal that you reach the goal state to let it terminate.
///
// TODO: "hide" the threading part behind a trait.
Find a plan to get from start to goal, given a problem space.
Note*: This will run forever. Signal that you reach the goal state to let it terminate.

"hide" the threading part behind a trait.
Find a plan to get from start to goal given a problem space . Note * : This will run forever . Signal that you reach the goal state to let it terminate . " hide " the threading part behind a trait .
pub fn solve<PS: planner::ProblemSpace + planner::Lifelong>(
    ps: &mut PS,
    start: PS::State,
    goal: PS::State,
    rx: mpsc::Receiver<(PS::State, PS::State)>,
    callback: fn(Vec<PS::State>),
) {
    // TODO: add key_modifier parameter.
    let mut start_int: PS::State = start;
    let mut open: collections::BinaryHeap<util::HeapEntry<PS::State>> =
        collections::BinaryHeap::new();
    let mut data: collections::HashMap<PS::State, util::StateData> = collections::HashMap::new();
    data.insert(
        start_int,
        util::StateData {
            g: f64::INFINITY,
            rhs: f64::INFINITY,
        },
    );
    data.insert(
        goal,
        util::StateData {
            g: f64::INFINITY,
            rhs: 0.0,
        },
    );
    open.push(util::HeapEntry::new_entry(
        goal,
        key(&data[&goal], ps.heuristic(&goal, &start_int)),
    ));
    compute_path(ps, start_int, goal, &mut data, &mut open);
    publish_path(ps, start_int, goal, &mut data, callback);
    loop {
        let (u, new_start) = rx.recv().unwrap();
        if new_start == goal {
            break;
        }
        start_int = new_start;
        ps.update(&u);
        update_state(ps, u, start_int, goal, &mut data, &mut open);
        compute_path(ps, start_int, goal, &mut data, &mut open);
        publish_path(ps, start_int, goal, &mut data, callback);
    }
}
pub fn solve < PS : planner :: ProblemSpace + planner :: Lifelong > ( ps : & mut PS , start : PS :: State , goal : PS :: State , rx : mpsc :: Receiver < ( PS :: State , PS :: State ) > , callback : fn ( Vec < PS :: State > ) , ) { // TODO: add key_modifier parameter. let mut start_int : PS :: State = start ; let mut open : collections :: BinaryHeap < util :: HeapEntry < PS :: State > > = collections :: BinaryHeap :: new ( ) ; let mut data : collections :: HashMap < PS :: State , util :: StateData > = collections :: HashMap :: new ( ) ; data . insert ( start_int , util :: StateData { g : f64 :: INFINITY , rhs : f64 :: INFINITY , } , ) ; data . insert ( goal , util :: StateData { g : f64 :: INFINITY , rhs : 0.0 , } , ) ; open . push ( util :: HeapEntry :: new_entry ( goal , key ( & data [ & goal ] , ps . heuristic ( & goal , & start_int ) ) , ) ) ; compute_path ( ps , start_int , goal , & mut data , & mut open ) ; publish_path ( ps , start_int , goal , & mut data , callback ) ; loop { let ( u , new_start ) = rx . recv ( ) . unwrap ( ) ; if new_start == goal { break ; } start_int = new_start ; ps . update ( & u ) ; update_state ( ps , u , start_int , goal , & mut data , & mut open ) ; compute_path ( ps , start_int , goal , & mut data , & mut open ) ; publish_path ( ps , start_int , goal , & mut data , callback ) ; } }
Find a plan to get from start to goal, given a problem space.
Find a plan to get from start to goal given a problem space .
ps
&mut PS
start
PS::State
goal
PS::State
rx
mpsc::Receiver<(PS::State, PS::State)>
callback
fn(Vec<PS::State>)
ps
&mut PS
start
PS::State
goal
PS::State
rx
mpsc::Receiver<(PS::State, PS::State)>
callback
fn(Vec<PS::State>)