pub struct WeighedShortest { /* private fields */ }
Expand description
Use the shortest path from origin to destination, giving a weight to each link class.
Note that it uses information based on BFS and not on Dijkstra, which may cause discrepancies in some topologies.
See the Topology::compute_distance_matrix
and its notes on weights for more informations.
Implementations§
Source§impl WeighedShortest
impl WeighedShortest
pub fn new(arg: RoutingBuilderArgument<'_>) -> WeighedShortest
Trait Implementations§
Source§impl Debug for WeighedShortest
impl Debug for WeighedShortest
Source§impl Routing for WeighedShortest
impl Routing for WeighedShortest
Source§fn next(
&self,
_routing_info: &RoutingInfo,
topology: &dyn Topology,
current_router: usize,
target_router: usize,
target_server: Option<usize>,
num_virtual_channels: usize,
_rng: &mut StdRng,
) -> Result<RoutingNextCandidates, Error>
fn next( &self, _routing_info: &RoutingInfo, topology: &dyn Topology, current_router: usize, target_router: usize, target_server: Option<usize>, num_virtual_channels: usize, _rng: &mut StdRng, ) -> Result<RoutingNextCandidates, Error>
Compute the list of allowed exits.
routing_info
contains the information in the packet being routed.
current_router
is the index of the router in the topology
that is performing the routing.
target_router
is the index of the router towards which we are routing.
If target_server
is not None it is the server destination of the packet, which must be attached to target_router
. A routing that works without this can be more simply used as part of other routing algorithms, as it may be used to route to intermediate routers even on indirect topologies.
num_virtual_channels
is the number of virtual channels dedicated to this routing.
rng
is the global generator of random numbers.Source§fn initialize(&mut self, topology: &dyn Topology, _rng: &mut StdRng)
fn initialize(&mut self, topology: &dyn Topology, _rng: &mut StdRng)
Prepares the routing to be utilized. Perhaps by precomputing routing tables.
Source§fn initialize_routing_info(
&self,
_routing_info: &RefCell<RoutingInfo>,
_topology: &dyn Topology,
_current_router: usize,
_target_touter: usize,
_target_server: Option<usize>,
_rng: &mut StdRng,
)
fn initialize_routing_info( &self, _routing_info: &RefCell<RoutingInfo>, _topology: &dyn Topology, _current_router: usize, _target_touter: usize, _target_server: Option<usize>, _rng: &mut StdRng, )
Initialize the routing info of the packet. Called when the first phit of the packet leaves the server and enters a router.
Source§fn update_routing_info(
&self,
_routing_info: &RefCell<RoutingInfo>,
_topology: &dyn Topology,
_current_router: usize,
_current_port: usize,
_target_router: usize,
_target_server: Option<usize>,
_rng: &mut StdRng,
)
fn update_routing_info( &self, _routing_info: &RefCell<RoutingInfo>, _topology: &dyn Topology, _current_router: usize, _current_port: usize, _target_router: usize, _target_server: Option<usize>, _rng: &mut StdRng, )
Updates the routing info of the packet. Called when the first phit of the packet leaves a router and enters another router. Values are of the router being entered into.
Source§fn performed_request(
&self,
_requested: &CandidateEgress,
_routing_info: &RefCell<RoutingInfo>,
_topology: &dyn Topology,
_current_router: usize,
_target_router: usize,
_target_server: Option<usize>,
_num_virtual_channels: usize,
_rng: &mut StdRng,
)
fn performed_request( &self, _requested: &CandidateEgress, _routing_info: &RefCell<RoutingInfo>, _topology: &dyn Topology, _current_router: usize, _target_router: usize, _target_server: Option<usize>, _num_virtual_channels: usize, _rng: &mut StdRng, )
To be called by the router when one of the candidates is requested.
Source§fn statistics(&self, _cycle: Time) -> Option<ConfigurationValue>
fn statistics(&self, _cycle: Time) -> Option<ConfigurationValue>
To optionally write routing statistics into the simulation output.
Source§fn reset_statistics(&mut self, _next_cycle: Time)
fn reset_statistics(&mut self, _next_cycle: Time)
Clears all collected statistics
Auto Trait Implementations§
impl Freeze for WeighedShortest
impl RefUnwindSafe for WeighedShortest
impl Send for WeighedShortest
impl Sync for WeighedShortest
impl Unpin for WeighedShortest
impl UnwindSafe for WeighedShortest
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more