Package ons
Class Core
java.lang.Object
ons.Core
public class Core
extends java.lang.Object
The Space Division Multiplexing Elastic Optical Network (SDM-EON) Core represents a Fiberlink core in an optical
network divided by slots.
-
Field Summary
-
Constructor Summary
Constructors Constructor Description Core(int ID, int linkID, int numSlots, int guardband)
-
Method Summary
Modifier and Type Method Description protected void
addNeighbors(Core core)
boolean
areSlotsAvaiable(int begin, int end)
Checks for available slots considering the guard band.int[]
bestFit(int requiredSlots)
The best fit slot alocation.void
changeSpectrum(int oldfirstSlot, int oldlastSlot, int newfirstSlot, int newlastSlot)
Change the spectrum frequency in this core.int[]
exactFit(int requiredSlots)
The exact fit slot alocationint[]
findLightpath(long lp)
Retrieves the lightpath slot position.int[]
firstExactFit(int requiredSlots)
The first exact fit slot alocationint[]
firstFit(int requiredSlots)
The first fit slot alocationint
getAvaiableSlots()
Retrieves the slots available in this core.double
getEntropy()
Retrieves the current fragmentation rate based in Entropy Equation.double
getExFragmentationRate()
Retrieves the External Fragmentation Rate of this coreint
getFirstSlotAvailable(int requiredSlots)
Retrieves the first slot available to accommodate this requisition.long
getFirstUsedSlot()
Retrieves the First used slot in this Core;int[]
getfreeBlocks()
Returns all free blocks in this core.int[]
getfreeBlocksToIndex(int start, int end)
Returns all free blocks to a final index on this core.int[]
getfreeBlocksWithGB()
Returns all free blocks in this core (Here he considers the guard band as a free block).int[]
getfreeRequiredSlotsBlocks(int requiredSlots)
Returns all free blocks that fit into the required slots in this core.int[]
getfreeRequiredSlotsBlocksToIndex(int requiredSlots, int start, int end)
Returns all free blocks that fit into the required slots to a final index on this core.int
getFreeSlots(int start, int end)
Retrieves the number of free blocks in this intervalint
getGuardband()
Retrieves the guardband size.int
getID()
int
getLastSlotBlock(int firstSlotBlock)
Retrieves the last available slot of this blockint
getLastSlotBlockWithGB(int firstSlotBlock)
Retrieves the last available slot of this block (Here he considers the guard band as a free block)int
getLastSlotOccupiedBlock(int firstSlotBlock)
Retrieves the last occupied slot of this blocklong
getLastUsedSlot()
Retrieves the Last used slot in this Core;long
getLeftSlot(int slot)
Retrieves the left slot given this position slotjava.util.ArrayList<java.lang.Integer>
getLengthFreeBlock()
Retrieves the length of all free blocks in this corelong
getLightpathId(int index)
Retrieve the lightpath id in this indexjava.util.ArrayList<java.lang.Long>
getLightpaths()
Retrieve all lightpath ids from this coreint
getLinkID()
double
getMouraFragmentationRate()
Retrieves the Moura Fragmentation Rate of this corejava.util.ArrayList<Core>
getNeighbors()
int
getNumSlots()
Retrieves the number of slots in this core.int[]
getOccupiedBlocks()
Returns all occupied blocks in this core.int[]
getOccupiedLightPathsBlocks()
Returns all occupied LightPaths blocks in this core.double
getRelativeFragmentationRate(int requiredSlots)
Retrieves the Relative Fragmentation Rate of this core based on required slotslong
getRightSlot(int slot)
Retrieves the right slot given this position slotdouble
getSC()
Retrieves the Spectrum Compactness (SC) in this Core.long[]
getSlots()
Retrieves the slots.java.util.ArrayList<java.lang.Integer>
getSlotsAvailable(int requiredSlots)
Retrieves the set of slots available given a minimum size.java.util.TreeSet<java.lang.Integer>
getSlotsAvailableGlobal(int requiredSlots)
Retrieves the set of slots available in optical grooming or not given a minimum size.int[]
getSlotsAvailableGlobalToArray(int requiredSlots)
Retrieves the set of slots available in optical grooming or not given a minimum size [but in array of 'int'].java.util.TreeSet<java.lang.Integer>
getSlotsAvailableOG(int requiredSlots)
Retrieves the set of slots available in optical grooming given a minimum size.int[]
getSlotsAvailableOGToArray(int requiredSlots)
Retrieves the set of slots available in optical grooming given a minimum size [but in array of 'int'].int[]
getSlotsAvailableToArray(int requiredSlots)
Retrieves the set of slots available given a minimum size [but in array of 'int'].int
getUsedSlots()
Retrieves the used slots in this core.boolean
hasSlotsAvaiable(int requiredSlots)
Check if there is available slots to accommodate the request.boolean
hasThisLightPath(long id)
Check if this lightpath is this coreboolean
isOpticalGrooming(long lp)
Retrieves if this lightpath is in optical groomingint[]
lastExactFit(int requiredSlots)
The last exact fit slot alocationint[]
lastFit(int requiredSlots)
The last fit slot alocationboolean
leftExtend(int requiredSlots, long lp)
Examine whether it is possible to extend lightpath to left.int
maxSizeAvaiable()
Retrieves the max size of contiguous slots available.int
minSizeAvaiable()
Retrieves the minimun size of contiguous slots available.void
printCore()
Print this core for debug.void
printEndCore()
Print the latest 10 slots of this core, for debug.boolean
pushpull(int oldfirstSlot, int oldlastSlot, int newfirstSlot, int newlastSlot)
Verify that it's possible push-pull in this core.int[]
randomFit(int requiredSlots)
The random fit slot alocationint
rangeFree(int requiredSlots)
Retrieves the number of requests for C size that can be satisfiedint
rangeFreeSimultaneous(int requiredSlots)
Retrieves the number of simultaneous requests for C size that can be satisfiedprotected void
releaseSlots(int begin, int end)
Release slots from this core.protected void
releaseSlotsInOpticalGrooming(int begin, int end)
Release slots from this core belonging to a tunnel.protected void
reserveSlots(long id, int begin, int end)
Reserve slots (with guard band) in this core, ie reserve lightpath.protected void
reserveSlotsInOpticalGrooming(long id, int begin, int end)
Reserve slots (with guard band only the lightpath is on the edge) in this core, ie reserve lightpath using optical grooming technique.boolean
rightExtend(int requiredSlots, long lp)
Examine whether it is possible to extend lightpath to right.int[]
tbsa(int requiredSlots)
Spectrum Alocation TBSA (Traffic Balancing Spectrum Assignment).java.lang.String
toString()
Retrieves the information of this core
-
Field Details
-
Constructor Details
-
Core
public Core(int ID, int linkID, int numSlots, int guardband)
-
-
Method Details
-
addNeighbors
-
getNeighbors
-
getID
public int getID() -
getLinkID
public int getLinkID() -
getSlots
public long[] getSlots()Retrieves the slots.- Returns:
- the slots of this core
-
getGuardband
public int getGuardband()Retrieves the guardband size.- Returns:
- the guardband size
-
getNumSlots
public int getNumSlots()Retrieves the number of slots in this core.- Returns:
- the number of slots in this core
-
getAvaiableSlots
public int getAvaiableSlots()Retrieves the slots available in this core.- Returns:
- the number slots available
-
getUsedSlots
public int getUsedSlots()Retrieves the used slots in this core.- Returns:
- the number used slots
-
hasSlotsAvaiable
public boolean hasSlotsAvaiable(int requiredSlots)Check if there is available slots to accommodate the request.- Parameters:
requiredSlots
- the request slots- Returns:
- true if can be accommodate, false otherwise
-
getFirstSlotAvailable
public int getFirstSlotAvailable(int requiredSlots)Retrieves the first slot available to accommodate this requisition.- Parameters:
requiredSlots
- the required slots- Returns:
- the first slot available to accommodate this requisition
-
getSlotsAvailable
public java.util.ArrayList<java.lang.Integer> getSlotsAvailable(int requiredSlots)Retrieves the set of slots available given a minimum size.- Parameters:
requiredSlots
- the required slots of set- Returns:
- the set with first slots available to 'requiredSlots'
-
getSlotsAvailableOG
public java.util.TreeSet<java.lang.Integer> getSlotsAvailableOG(int requiredSlots)Retrieves the set of slots available in optical grooming given a minimum size.- Parameters:
requiredSlots
- the required slots of set- Returns:
- the set with first slots available in optical grooming to 'requiredSlots'
-
getSlotsAvailableGlobal
public java.util.TreeSet<java.lang.Integer> getSlotsAvailableGlobal(int requiredSlots)Retrieves the set of slots available in optical grooming or not given a minimum size.- Parameters:
requiredSlots
- the required slots of set- Returns:
- the set with first slots available in optical grooming or not to 'requiredSlots'
-
getSlotsAvailableToArray
public int[] getSlotsAvailableToArray(int requiredSlots)Retrieves the set of slots available given a minimum size [but in array of 'int'].- Parameters:
requiredSlots
- the required slots of set- Returns:
- the array with first slots available to 'requiredSlots'
-
getSlotsAvailableOGToArray
public int[] getSlotsAvailableOGToArray(int requiredSlots)Retrieves the set of slots available in optical grooming given a minimum size [but in array of 'int'].- Parameters:
requiredSlots
- the required slots of set- Returns:
- the array with first slots available in optical grooming to 'requiredSlots'
-
getSlotsAvailableGlobalToArray
public int[] getSlotsAvailableGlobalToArray(int requiredSlots)Retrieves the set of slots available in optical grooming or not given a minimum size [but in array of 'int'].- Parameters:
requiredSlots
- the required slots of set- Returns:
- the array with first slots available in optical grooming or not to 'requiredSlots'
-
areSlotsAvaiable
public boolean areSlotsAvaiable(int begin, int end)Checks for available slots considering the guard band.- Parameters:
begin
- the begin slotend
- the end slot- Returns:
- true if is avaiable slots, false otherwise
-
reserveSlots
protected void reserveSlots(long id, int begin, int end)Reserve slots (with guard band) in this core, ie reserve lightpath.- Parameters:
id
- the id of lightpath reservedbegin
- the begin of lightpathend
- the end of lightpath
-
reserveSlotsInOpticalGrooming
protected void reserveSlotsInOpticalGrooming(long id, int begin, int end)Reserve slots (with guard band only the lightpath is on the edge) in this core, ie reserve lightpath using optical grooming technique.- Parameters:
id
- the id of lightpath reservedbegin
- the begin of lightpathend
- the end of lightpath
-
releaseSlots
protected void releaseSlots(int begin, int end)Release slots from this core. Examines the corresponding guard bands- Parameters:
begin
- the beginend
- the end
-
releaseSlotsInOpticalGrooming
protected void releaseSlotsInOpticalGrooming(int begin, int end)Release slots from this core belonging to a tunnel. Examines the corresponding guard bands in the edges- Parameters:
begin
- the beginend
- the end
-
maxSizeAvaiable
public int maxSizeAvaiable()Retrieves the max size of contiguous slots available.- Returns:
- the max size of contiguous slots available
-
minSizeAvaiable
public int minSizeAvaiable()Retrieves the minimun size of contiguous slots available.- Returns:
- the minimun size of contiguous slots available
-
hasThisLightPath
public boolean hasThisLightPath(long id)Check if this lightpath is this core- Parameters:
id
- the id of lightpath- Returns:
- if it is true, false otherwise
-
toString
public java.lang.String toString()Retrieves the information of this core- Overrides:
toString
in classjava.lang.Object
- Returns:
- the string information
-
printCore
public void printCore()Print this core for debug. -
printEndCore
public void printEndCore()Print the latest 10 slots of this core, for debug. -
findLightpath
public int[] findLightpath(long lp)Retrieves the lightpath slot position.- Parameters:
lp
- the id of lightpath- Returns:
- the array[2] with begin position and end position
-
leftExtend
public boolean leftExtend(int requiredSlots, long lp)Examine whether it is possible to extend lightpath to left.- Parameters:
requiredSlots
- the number of slots to be extend to leftlp
- the lightpath id- Returns:
- true if is possible, false otherwise
-
rightExtend
public boolean rightExtend(int requiredSlots, long lp)Examine whether it is possible to extend lightpath to right.- Parameters:
requiredSlots
- the number of slots to be extend to rightlp
- the lightpath id- Returns:
- true if is possible, false otherwise
-
isOpticalGrooming
public boolean isOpticalGrooming(long lp)Retrieves if this lightpath is in optical grooming- Parameters:
lp
- the lightpath id- Returns:
- true if this is in optical grooming, false otherwise
-
getLeftSlot
public long getLeftSlot(int slot)Retrieves the left slot given this position slot- Parameters:
slot
- the slot position- Returns:
- the id in left position
-
getRightSlot
public long getRightSlot(int slot)Retrieves the right slot given this position slot- Parameters:
slot
- the slot position- Returns:
- the id in right position
-
rangeFreeSimultaneous
public int rangeFreeSimultaneous(int requiredSlots)Retrieves the number of simultaneous requests for C size that can be satisfied- Parameters:
requiredSlots
- C = required slots- Returns:
- number of simultaneous requests for 'requiredSlots' size that can be satisfied
-
rangeFree
public int rangeFree(int requiredSlots)Retrieves the number of requests for C size that can be satisfied- Parameters:
requiredSlots
- C = required slots- Returns:
- number of simultaneous requests for 'requiredSlots' size that can be satisfied
-
getExFragmentationRate
public double getExFragmentationRate()Retrieves the External Fragmentation Rate of this core- Returns:
- the External Fragmentation Rate of this core
-
getRelativeFragmentationRate
public double getRelativeFragmentationRate(int requiredSlots)Retrieves the Relative Fragmentation Rate of this core based on required slots- Parameters:
requiredSlots
- to calculates the Relative Fragmentation Rate- Returns:
- the Relative Fragmentation Rate of this core based on required slots
-
getMouraFragmentationRate
public double getMouraFragmentationRate()Retrieves the Moura Fragmentation Rate of this core- Returns:
- the Moura Fragmentation Rate of this core
-
firstFit
public int[] firstFit(int requiredSlots)The first fit slot alocation- Parameters:
requiredSlots
- number of slots required for first fit- Returns:
- the array with first slots available to 'requiredSlots'
-
lastFit
public int[] lastFit(int requiredSlots)The last fit slot alocation- Parameters:
requiredSlots
- number of slots required for last fit- Returns:
- the array with last slots available to 'requiredSlots'
-
randomFit
public int[] randomFit(int requiredSlots)The random fit slot alocation- Parameters:
requiredSlots
- number of slots required for random fit- Returns:
- the array with random slots available to 'requiredSlots'
-
exactFit
public int[] exactFit(int requiredSlots)The exact fit slot alocation- Parameters:
requiredSlots
- number of slots required for exact fit- Returns:
- the array with exact slots available to 'requiredSlots'
-
bestFit
public int[] bestFit(int requiredSlots)The best fit slot alocation. Blocks closer to request slots- Parameters:
requiredSlots
- number of slots required for best fit- Returns:
- the array with exact slots available to 'requiredSlots'
-
firstExactFit
public int[] firstExactFit(int requiredSlots)The first exact fit slot alocation- Parameters:
requiredSlots
- number of slots required- Returns:
- the array with slots available to 'requiredSlots'
-
lastExactFit
public int[] lastExactFit(int requiredSlots)The last exact fit slot alocation- Parameters:
requiredSlots
- number of slots required- Returns:
- the array with slots available to 'requiredSlots'
-
tbsa
public int[] tbsa(int requiredSlots)Spectrum Alocation TBSA (Traffic Balancing Spectrum Assignment). Beyranvand, H. and Salehi, J. (2013). A quality-of-transmission aware dynamic routing and spectrum assignment scheme for future elastic optical networks. Journal of Lightwave Technology, 31(18):3043–3054.- Parameters:
requiredSlots
- number of slots required- Returns:
- the array with slots available to 'requiredSlots'
-
getFreeSlots
public int getFreeSlots(int start, int end)Retrieves the number of free blocks in this interval- Parameters:
start
- start intervalend
- end interval- Returns:
- the number of blocks if 0's
-
getLengthFreeBlock
public java.util.ArrayList<java.lang.Integer> getLengthFreeBlock()Retrieves the length of all free blocks in this core- Returns:
- an ArrayList-Integer- object containing the length of all free blocks in this core
-
getfreeBlocks
public int[] getfreeBlocks()Returns all free blocks in this core. The number returned is the first slot to this block.- Returns:
-
getfreeBlocksToIndex
public int[] getfreeBlocksToIndex(int start, int end)Returns all free blocks to a final index on this core. The number returned is the first slot to this block.- Parameters:
start
- start indexend
- final index- Returns:
-
getfreeBlocksWithGB
public int[] getfreeBlocksWithGB()Returns all free blocks in this core (Here he considers the guard band as a free block). The number returned is the first slot to this block.- Returns:
-
getOccupiedBlocks
public int[] getOccupiedBlocks()Returns all occupied blocks in this core. The number returned is the first slot to this block.- Returns:
-
getOccupiedLightPathsBlocks
public int[] getOccupiedLightPathsBlocks()Returns all occupied LightPaths blocks in this core. The number returned is the first slot to this block.- Returns:
-
getfreeRequiredSlotsBlocks
public int[] getfreeRequiredSlotsBlocks(int requiredSlots)Returns all free blocks that fit into the required slots in this core. The number returned is the first slot to this block.- Parameters:
requiredSlots
- number of slots required- Returns:
-
getfreeRequiredSlotsBlocksToIndex
public int[] getfreeRequiredSlotsBlocksToIndex(int requiredSlots, int start, int end)Returns all free blocks that fit into the required slots to a final index on this core. The number returned is the first slot to this block.- Parameters:
requiredSlots
- number of slots requiredstart
- start indexend
- final index- Returns:
-
getLastSlotBlock
public int getLastSlotBlock(int firstSlotBlock)Retrieves the last available slot of this block- Parameters:
firstSlotBlock
- the first slot of this block- Returns:
- the last of this block
-
getLastSlotOccupiedBlock
public int getLastSlotOccupiedBlock(int firstSlotBlock)Retrieves the last occupied slot of this block- Parameters:
firstSlotBlock
- the first slot of this block- Returns:
- the last of this block
-
getLastSlotBlockWithGB
public int getLastSlotBlockWithGB(int firstSlotBlock)Retrieves the last available slot of this block (Here he considers the guard band as a free block)- Parameters:
firstSlotBlock
- the first slot of this block- Returns:
- the last of this block
-
pushpull
public boolean pushpull(int oldfirstSlot, int oldlastSlot, int newfirstSlot, int newlastSlot)Verify that it's possible push-pull in this core.- Parameters:
oldfirstSlot
- the first slot of the old lightpatholdlastSlot
- the last slot of the old lightpathnewfirstSlot
- the first slot of the new lightpathnewlastSlot
- the last slot of the new lightpath- Returns:
- true if is possible to do push-pull or false otherwise
-
getSC
public double getSC()Retrieves the Spectrum Compactness (SC) in this Core. YONGLI ZHAO, LIYAZHOU HU, RUIJIE ZHU, XIAOSONG YU, XINBO WANG and JIE ZHANG. Crosstalk-Aware Spectrum Defragmentation Based on Spectrum Compactness in Space Division Multiplexing Enabled Elastic Optical Networks With Multicore Fiber. IEEE Access, 2018- Returns:
- the Spectrum Compactness (SC) in this Core
-
getEntropy
public double getEntropy()Retrieves the current fragmentation rate based in Entropy Equation. Wright et al 2015. P. Wright, M. C. Parker, e A. Lord. Minimum- and maximum-entropy routing and spectrum assignment for flexgrid elastic optical networking [invited]. IEEE/OSA Journal of Optical Communications and Networking, 7(1):A66–A72, Jan 2015.- Returns:
- the current fragmentation of topology.
-
getFirstUsedSlot
public long getFirstUsedSlot()Retrieves the First used slot in this Core;- Returns:
- the First used slot in this Core;
-
getLastUsedSlot
public long getLastUsedSlot()Retrieves the Last used slot in this Core;- Returns:
- the Last used slot in this Core;
-
getLightpaths
public java.util.ArrayList<java.lang.Long> getLightpaths()Retrieve all lightpath ids from this core- Returns:
- all lightpath ids from this core
-
getLightpathId
public long getLightpathId(int index)Retrieve the lightpath id in this index- Parameters:
index
- slot in this core- Returns:
- the lightpath id in this index
-
changeSpectrum
public void changeSpectrum(int oldfirstSlot, int oldlastSlot, int newfirstSlot, int newlastSlot)Change the spectrum frequency in this core.- Parameters:
oldfirstSlot
- the first slot of the old lightpatholdlastSlot
- the last slot of the old lightpathnewfirstSlot
- the first slot of the new lightpathnewlastSlot
- the last slot of the new lightpath
-