Skip to main content

Intersection

Struct Intersection 

Source
pub struct Intersection {
    pub robots: Vec<Robot>,
    pub blocks: Vec<Block>,
    pub safety: f64,
    pub parameter_bounds: [(f64, f64); 2],
    pub time_cost: f64,
}
Expand description

The intersection scene.

Fields§

§robots: Vec<Robot>

The robots, in planning priority order.

§blocks: Vec<Block>

The buildings at the corners.

§safety: f64

The minimum distance between two robots.

§parameter_bounds: [(f64, f64); 2]

The bounds of each (b_i, h_i) pair: the paper’s b ∈ [1, 6], h ∈ [0.5, 5].

§time_cost: f64

The cost of one time step, moving or waiting, in length units. Default 1.

Implementations§

Source§

impl Intersection

Source

pub fn crossing(robots: usize) -> Self

A four-way crossing of roads 8 wide with buildings at the corners and up to eight robots driving straight across on the right-hand lanes: robots 0–3 come from the west, east, south and north; robots 4–7 follow them on the same lanes, 8 units behind.

§Panics

Panics if robots is not in 1..=8.

Source

pub fn bounds(&self) -> Bounds

The search box of the parameter vector (b_1, h_1, …, b_N, h_N).

Source

pub fn plan(&self, x: &[f64]) -> Option<Vec<Vec<Point>>>

The coordinated trajectories (one position per time step, until each robot’s goal) for parameters x, or None if some robot found no collision-free plan.

Source

pub fn trajectory_cost(&self, trajectory: &[Point]) -> f64

The cost of one trajectory: its length plus Intersection::time_cost per step.

Source

pub fn collisions(&self, trajectories: &[Vec<Point>]) -> usize

The number of time steps (and midpoints) at which two robots are closer than safety.

Trait Implementations§

Source§

impl Clone for Intersection

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Intersection

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Objective<Vec<f64>> for Intersection

Source§

fn evaluate(&mut self, x: &Vec<f64>) -> f64

The total cost of the coordinated plan: path length plus Intersection::time_cost per step; failed robots add 1000 plus their straight-line distance.

Source§

impl PartialEq for Intersection

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Intersection

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.