Documentation
¶
Index ¶
- func SplitLoad(load int64, ratio float64) int64
- type Demand
- type Edge
- type EdgeRatio
- type FGraphs
- type LoadChange
- type Move
- type MoveType
- type NetworkState
- type SRTE
- func (srte *SRTE) ApplyMove(m Move, persist bool) bool
- func (srte *SRTE) Changes() []LoadChange
- func (srte *SRTE) Clear(demand int) bool
- func (srte *SRTE) Insert(demand int, pos int, node int) bool
- func (srte *SRTE) Load(edge int) int64
- func (srte *SRTE) PersistChanges()
- func (srte *SRTE) Remove(demand int, pos int) bool
- func (srte *SRTE) Search(edge int, demand int, maxUtil float64) (Move, bool)
- func (srte *SRTE) SearchClear(edge int, demand int, maxUtil float64) (Move, bool)
- func (srte *SRTE) SearchInsert(edge int, demand int, maxUtil float64) (Move, bool)
- func (srte *SRTE) SearchRemove(edge int, demand int, maxUtil float64) (Move, bool)
- func (srte *SRTE) SearchUpdate(edge int, demand int, maxUtil float64) (Move, bool)
- func (srte *SRTE) Update(demand int, pos int, newNode int) bool
- func (srte *SRTE) Utilization(edge int) float64
- type SRTEInstance
- type Topology
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EdgeRatio ¶
EdgeRatio represent an edge in a forwarding graph and the ratio of load sent on that edge. For example, EdgeRatio{5, 0.5} means that 50% of the load sent on the forwarding graph traverses edge 5.
type LoadChange ¶
LoadChange is a pair made of an edge and its load before any change was applied to the current state.
type NetworkState ¶
type NetworkState struct {
// contains filtered or unexported fields
}
NetworkState is a reversible structure which represents the state of the network's load. This structure keeps track of changes applied to its edges and can efficiently undo them.
func NewNetworkState ¶
func NewNetworkState(nEdges int) *NetworkState
NewNetworkState initializes and returns a new NetworkState.
func (*NetworkState) AddLoad ¶
func (s *NetworkState) AddLoad(edge int, load int64)
AddLoad adds the load from the edge. The change is registered so that it can be undone if needed.
func (*NetworkState) Changes ¶
func (s *NetworkState) Changes() []LoadChange
Changes returns the edges that have been changed since the last time changes were persisted.
Important: the slice is a view on one of the state's internal structure and should only be used in read-only operations. Modifying the slice will most likely results in incorrect behavior.
func (*NetworkState) Load ¶
func (s *NetworkState) Load(edge int) int64
Load returns the current load on the edge.
func (*NetworkState) PersistChanges ¶
func (s *NetworkState) PersistChanges()
PersistChanges persists all the changes as the "new" state. New changes can be accumulated (and undone) from this point.
func (*NetworkState) RemoveLoad ¶
func (s *NetworkState) RemoveLoad(edge int, load int64)
RemoveLoad removes the load from the edge. The change is registered so that it can be undone if needed.
func (*NetworkState) UndoChanges ¶
func (s *NetworkState) UndoChanges()
UndoChanges undoes all the changes since the last time PersistChanges was called. This operation is done in O(C) where C is the number of edges that have been changed.
type SRTE ¶
type SRTE struct { FGraphs *FGraphs PathVar []*paths.PathVar Instance *SRTEInstance // contains filtered or unexported fields }
func NewSRTE ¶
func NewSRTE(instance *SRTEInstance) (*SRTE, error)
func (*SRTE) ApplyMove ¶
ApplyMove applies the given move to the network's state. The function returns true if the move could be applied, it returns false otherwize (e.g. if the move is invalid).
func (*SRTE) Changes ¶
func (srte *SRTE) Changes() []LoadChange
Changes returns the list of changes applied to the network since the last time the state was persisted.
func (*SRTE) Clear ¶
Clear removes all the intermediate nodes in the demand's path and updates the load of the impacted edge accordingly.
The function returns true if (i) the operation is valid, and (ii) it changed the demand's path. Otherwise, it returns false and does not change the state of the network.
func (*SRTE) Insert ¶
Insert inserts a new intermediate node at position pos in the demand's path and updates the load of the impacted edge accordingly.
The function returns true if (i) the operation is valid, and (ii) it changed the demand's path. Otherwise, it returns false and does not change the state of the network.
func (*SRTE) PersistChanges ¶
func (srte *SRTE) PersistChanges()
PersistChanges persists the changes applied since the last time the state of the network was persisted. New changes can be accumulated (and undone) from this point.
func (*SRTE) Remove ¶
Remove removes the intermediate node at position pos in the demand's path and updates the load of the impacted edge accordingly.
The function returns true if (i) the operation is valid, and (ii) it changed the demand's path. Otherwise, it returns false and does not change the state of the network.
func (*SRTE) Search ¶
Search searches for a move that reduces the load of the selected edge and keeps the maximum utilization of the network below maxUtil. It returns an empty move and false if it could not find an improving move.
func (*SRTE) SearchClear ¶
SearchClear searches for a "clear" move that reduces the load of the selected edge and keeps the maximum utilization of the network below maxUtil. It returns an empty move and false if it could not find an improving move.
func (*SRTE) SearchInsert ¶
SearchInsert searches for a "insert" move that reduces the load of the selected edge and keeps the maximum utilization of the network below maxUtil. It returns an empty move and false if it could not find an improving move.
func (*SRTE) SearchRemove ¶
SearchRemove searches for a "remove" move that reduces the load of the selected edge and keeps the maximum utilization of the network below maxUtil. It returns an empty move and false if it could not find an improving move.
func (*SRTE) SearchUpdate ¶
SearchUpdate searches for a "update" move that reduces the load of the selected edge and keeps the maximum utilization of the network below maxUtil. It returns an empty move and false if it could not find an improving move.
func (*SRTE) Update ¶
Update replaces the intermediate node at position pos in the demand's path with newNode and updates the load of the impacted edge accordingly.
The function returns true if (i) the operation is valid, and (ii) it changed the demand's path. Otherwise, it returns false and does not change the state of the network.
func (*SRTE) Utilization ¶
Utilization returns the edge's utilization.
type SRTEInstance ¶
type Topology ¶
Topology represents the topology of a network as a directed graph.
func NewTopology ¶
NewTopology creates a new topology with the specified edges and number of nodes. It is important to ensure that edges are only between nodes within the range [0, nNodes); otherwise, the function will panic.