pub struct UaInstance<G> { /* private fields */ }Expand description
A validated instance of MAPF with unassigned agents (MAPF-UA): agents with a goal, and agents with only a start that may end anywhere but must not get in the way.
Starts are pairwise distinct over all agents, goals pairwise distinct, and every start
and goal is a vertex of the graph. See focbs.
§Examples
use mapf_search::{Agent, Grid, InstanceError, UaInstance};
let grid = Grid::new(3, 1);
let assigned = vec![Agent { start: 0, goal: 2 }];
assert!(UaInstance::new(grid.clone(), assigned.clone(), vec![1]).is_ok());
assert_eq!(
UaInstance::new(grid, assigned, vec![0]).unwrap_err(),
InstanceError::SharedStart(0, 1)
);Implementations§
Source§impl<G: Graph> UaInstance<G>
impl<G: Graph> UaInstance<G>
Sourcepub fn new(
graph: G,
assigned: Vec<Agent>,
unassigned: Vec<Vertex>,
) -> Result<Self, InstanceError>
pub fn new( graph: G, assigned: Vec<Agent>, unassigned: Vec<Vertex>, ) -> Result<Self, InstanceError>
Creates an instance after checking the agents against the graph. In errors, agents
are numbered with the assigned ones first: unassigned agent j is agent
assigned.len() + j.
§Errors
InstanceError::OutOfRangeif a start or goal is not a vertex ofgraph;InstanceError::SharedStartif two agents start at the same vertex;InstanceError::SharedGoalif two assigned agents have the same goal.
Sourcepub fn unassigned(&self) -> &[Vertex]
pub fn unassigned(&self) -> &[Vertex]
The starts of the agents without a goal.
Trait Implementations§
Source§impl<G: Clone> Clone for UaInstance<G>
impl<G: Clone> Clone for UaInstance<G>
Source§impl<G: Debug> Debug for UaInstance<G>
impl<G: Debug> Debug for UaInstance<G>
impl<G: Eq> Eq for UaInstance<G>
Source§impl<G: PartialEq> PartialEq for UaInstance<G>
impl<G: PartialEq> PartialEq for UaInstance<G>
impl<G: PartialEq> StructuralPartialEq for UaInstance<G>
Auto Trait Implementations§
impl<G> Forget for UaInstance<G>
impl<G> Freeze for UaInstance<G>where
G: Freeze,
impl<G> Move for UaInstance<G>
impl<G> RefUnwindSafe for UaInstance<G>where
G: RefUnwindSafe,
impl<G> Send for UaInstance<G>where
G: Send,
impl<G> Sync for UaInstance<G>where
G: Sync,
impl<G> Unpin for UaInstance<G>where
G: Unpin,
impl<G> UnsafeUnpin for UaInstance<G>where
G: UnsafeUnpin,
impl<G> UnwindSafe for UaInstance<G>where
G: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more