pub fn solve<PS: planner::ProblemSpace>(
    ps: &PS,
    start: PS::State,
    goal: PS::State,
    callback: fn(Vec<PS::State>),
) {
    // initialize data - copy start & goal state into here...
    let mut node_data: collections::HashMap<PS::State, util::StateData> =
        collections::HashMap::new();
    node_data.insert(
        start,
        util::StateData {
            rhs: f64::INFINITY,
            g: f64::INFINITY,
        },
    );
    node_data.insert(
        goal,
        util::StateData {
            rhs: 0.0,
            g: f64::INFINITY,
        },
    );
    let eps = 2.0;

    let mut open: collections::BinaryHeap<util::HeapEntry<PS::State>> =
        collections::BinaryHeap::new();
    let mut closed: Vec<PS::State> = Vec::new();
    let mut incons: Vec<PS::State> = Vec::new();
    let node_0: util::HeapEntry<PS::State> = util::HeapEntry::new_entry(
        goal,
        key(&node_data[&goal], ps.heuristic(&goal, &start), eps),
    );
    open.push(node_0);

    // compute path
    compute_path(
        ps,
        start,
        goal,
        &mut node_data,
        &mut open,
        &mut closed,
        &mut incons,
        eps,
    );

    // publish sub-optimal result.
    publish_plan(ps, start, goal, node_data, callback);

    // TODO: implement the forever loop...
}
///
/// Given an problem space will try to find most efficient path from start to goal.
///
Given an problem space will try to find most efficient path from start to goal.
Given an problem space will try to find most efficient path from start to goal .
pub fn solve<PS: planner::ProblemSpace>(
    ps: &PS,
    start: PS::State,
    goal: PS::State,
    callback: fn(Vec<PS::State>),
) {
    // initialize data - copy start & goal state into here...
    let mut node_data: collections::HashMap<PS::State, util::StateData> =
        collections::HashMap::new();
    node_data.insert(
        start,
        util::StateData {
            rhs: f64::INFINITY,
            g: f64::INFINITY,
        },
    );
    node_data.insert(
        goal,
        util::StateData {
            rhs: 0.0,
            g: f64::INFINITY,
        },
    );
    let eps = 2.0;
    let mut open: collections::BinaryHeap<util::HeapEntry<PS::State>> =
        collections::BinaryHeap::new();
    let mut closed: Vec<PS::State> = Vec::new();
    let mut incons: Vec<PS::State> = Vec::new();
    let node_0: util::HeapEntry<PS::State> = util::HeapEntry::new_entry(
        goal,
        key(&node_data[&goal], ps.heuristic(&goal, &start), eps),
    );
    open.push(node_0);
    // compute path
    compute_path(
        ps,
        start,
        goal,
        &mut node_data,
        &mut open,
        &mut closed,
        &mut incons,
        eps,
    );
    // publish sub-optimal result.
    publish_plan(ps, start, goal, node_data, callback);
    // TODO: implement the forever loop...
}
pub fn solve < PS : planner :: ProblemSpace > ( ps : & PS , start : PS :: State , goal : PS :: State , callback : fn ( Vec < PS :: State > ) , ) { // initialize data - copy start & goal state into here... let mut node_data : collections :: HashMap < PS :: State , util :: StateData > = collections :: HashMap :: new ( ) ; node_data . insert ( start , util :: StateData { rhs : f64 :: INFINITY , g : f64 :: INFINITY , } , ) ; node_data . insert ( goal , util :: StateData { rhs : 0.0 , g : f64 :: INFINITY , } , ) ; let eps = 2.0 ; let mut open : collections :: BinaryHeap < util :: HeapEntry < PS :: State > > = collections :: BinaryHeap :: new ( ) ; let mut closed : Vec < PS :: State > = Vec :: new ( ) ; let mut incons : Vec < PS :: State > = Vec :: new ( ) ; let node_0 : util :: HeapEntry < PS :: State > = util :: HeapEntry :: new_entry ( goal , key ( & node_data [ & goal ] , ps . heuristic ( & goal , & start ) , eps ) , ) ; open . push ( node_0 ) ; // compute path compute_path ( ps , start , goal , & mut node_data , & mut open , & mut closed , & mut incons , eps , ) ; // publish sub-optimal result. publish_plan ( ps , start , goal , node_data , callback ) ; // TODO: implement the forever loop... }
Given an problem space will try to find most efficient path from start to goal.
Given an problem space will try to find most efficient path from start to goal .
ps
&PS
start
PS::State
goal
PS::State
callback
fn(Vec<PS::State>)
ps
&PS
start
PS::State
goal
PS::State
callback
fn(Vec<PS::State>)