├── README.md ├── vxFury_Heu_v2.2.4 ├── data │ ├── output │ │ └── deleteOutputs.bat │ └── topology │ │ ├── networkTopology.vsdx │ │ ├── N6S8.csv │ │ ├── SMALLNET.csv │ │ ├── NSFNET.csv │ │ ├── COST239.csv │ │ └── USNET.csv ├── bin │ ├── work │ │ ├── temp │ │ │ ├── Test.class │ │ │ └── Test_s.class │ │ ├── VCAT │ │ │ ├── HeuVCAT.class │ │ │ └── InitVCAT.class │ │ ├── utilities │ │ │ ├── Logger.class │ │ │ ├── Utility.class │ │ │ └── Logger$Level.class │ │ ├── forAMPL │ │ │ └── dataForAMPL.class │ │ ├── SBPP │ │ │ ├── HeuProtectionSBPP.class │ │ │ └── InitProtectionSBPP.class │ │ └── PathMN │ │ │ ├── HeuProtectionPathM1.class │ │ │ ├── InitProtectionPathM1.class │ │ │ ├── dataForAMPL_ProtectionPathM1.class │ │ │ └── dataForAMPL_ProtectionPathM1$Strategy.class │ └── eon │ │ ├── general │ │ ├── Time.class │ │ ├── Constant.class │ │ ├── object.class │ │ ├── xRandom.class │ │ ├── FileOutput.class │ │ ├── Modulation.class │ │ ├── RouteType.class │ │ ├── bitProcess.class │ │ ├── RequestType.class │ │ └── RoutingStrategy.class │ │ ├── network │ │ ├── Layer.class │ │ ├── Link.class │ │ ├── Node.class │ │ ├── Route.class │ │ └── NodePair.class │ │ ├── spectrum │ │ ├── Request.class │ │ ├── SlotWindow.class │ │ ├── sortBySlots.class │ │ ├── FrequencySlot.class │ │ ├── ResourceOnLink.class │ │ ├── AdaptiveSlotSection.class │ │ └── RoutingAndSpectrumAllocation.class │ │ └── graph │ │ ├── sortByLength.class │ │ ├── RouteSearching.class │ │ └── SearchConstraint.class ├── .classpath ├── .project ├── src │ ├── eon │ │ ├── general │ │ │ ├── RequestType.java │ │ │ ├── RouteType.java │ │ │ ├── xRandom.java │ │ │ ├── RoutingStrategy.java │ │ │ ├── object.java │ │ │ ├── Constant.java │ │ │ ├── Modulation.java │ │ │ ├── FileOutput.java │ │ │ ├── Time.java │ │ │ └── bitProcess.java │ │ ├── spectrum │ │ │ ├── FrequencySlot.java │ │ │ ├── AdaptiveSlotSection.java │ │ │ ├── ResourceOnLink.java │ │ │ ├── SlotWindow.java │ │ │ ├── Request.java │ │ │ └── RoutingAndSpectrumAllocation.java │ │ ├── graph │ │ │ ├── SearchConstraint.java │ │ │ └── RouteSearching.java │ │ └── network │ │ │ ├── Node.java │ │ │ ├── NodePair.java │ │ │ ├── Route.java │ │ │ ├── Link.java │ │ │ └── Layer.java │ └── work │ │ ├── utilities │ │ ├── Utility.java │ │ └── Logger.java │ │ ├── VCAT │ │ ├── InitVCAT.java │ │ └── HeuVCAT.java │ │ ├── SBPP │ │ ├── InitProtectionSBPP.java │ │ └── HeuProtectionSBPP.java │ │ ├── PathMN │ │ ├── InitProtectionPathM1.java │ │ ├── dataForAMPL_ProtectionPathM1.java │ │ └── HeuProtectionPathM1.java │ │ ├── temp │ │ ├── Test_s.java │ │ └── Test.java │ │ └── forAMPL │ │ └── dataForAMPL.java └── release.txt ├── .gitignore └── LICENSE /README.md: -------------------------------------------------------------------------------- 1 | # ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/data/output/deleteOutputs.bat: -------------------------------------------------------------------------------- 1 | del *.txt /s 2 | del *.log /s 3 | del *.dat /s -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/work/temp/Test.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/work/temp/Test.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/eon/general/Time.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/eon/general/Time.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/eon/network/Layer.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/eon/network/Layer.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/eon/network/Link.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/eon/network/Link.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/eon/network/Node.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/eon/network/Node.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/eon/network/Route.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/eon/network/Route.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/work/VCAT/HeuVCAT.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/work/VCAT/HeuVCAT.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/work/temp/Test_s.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/work/temp/Test_s.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/eon/general/Constant.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/eon/general/Constant.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/eon/general/object.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/eon/general/object.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/eon/general/xRandom.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/eon/general/xRandom.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/eon/network/NodePair.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/eon/network/NodePair.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/eon/spectrum/Request.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/eon/spectrum/Request.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/work/VCAT/InitVCAT.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/work/VCAT/InitVCAT.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/eon/general/FileOutput.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/eon/general/FileOutput.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/eon/general/Modulation.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/eon/general/Modulation.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/eon/general/RouteType.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/eon/general/RouteType.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/eon/general/bitProcess.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/eon/general/bitProcess.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/eon/graph/sortByLength.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/eon/graph/sortByLength.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/work/utilities/Logger.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/work/utilities/Logger.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/work/utilities/Utility.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/work/utilities/Utility.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/eon/general/RequestType.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/eon/general/RequestType.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/eon/graph/RouteSearching.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/eon/graph/RouteSearching.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/eon/spectrum/SlotWindow.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/eon/spectrum/SlotWindow.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/eon/spectrum/sortBySlots.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/eon/spectrum/sortBySlots.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/work/forAMPL/dataForAMPL.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/work/forAMPL/dataForAMPL.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/data/topology/networkTopology.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/data/topology/networkTopology.vsdx -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/eon/general/RoutingStrategy.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/eon/general/RoutingStrategy.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/eon/graph/SearchConstraint.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/eon/graph/SearchConstraint.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/eon/spectrum/FrequencySlot.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/eon/spectrum/FrequencySlot.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/eon/spectrum/ResourceOnLink.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/eon/spectrum/ResourceOnLink.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/work/SBPP/HeuProtectionSBPP.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/work/SBPP/HeuProtectionSBPP.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/work/utilities/Logger$Level.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/work/utilities/Logger$Level.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/work/SBPP/InitProtectionSBPP.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/work/SBPP/InitProtectionSBPP.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/eon/spectrum/AdaptiveSlotSection.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/eon/spectrum/AdaptiveSlotSection.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/work/PathMN/HeuProtectionPathM1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/work/PathMN/HeuProtectionPathM1.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/work/PathMN/InitProtectionPathM1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/work/PathMN/InitProtectionPathM1.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/work/PathMN/dataForAMPL_ProtectionPathM1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/work/PathMN/dataForAMPL_ProtectionPathM1.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/eon/spectrum/RoutingAndSpectrumAllocation.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/eon/spectrum/RoutingAndSpectrumAllocation.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/bin/work/PathMN/dataForAMPL_ProtectionPathM1$Strategy.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/basharbme/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON/master/vxFury_Heu_v2.2.4/bin/work/PathMN/dataForAMPL_ProtectionPathM1$Strategy.class -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/data/topology/N6S8.csv: -------------------------------------------------------------------------------- 1 | Node,x,y,, 2 | N1,45,190,, 3 | N2,65,205,, 4 | N3,65,175,, 5 | N4,93,205,, 6 | N5,93,175,, 7 | N6,113,190,, 8 | Link,NodeA,NodeB,Length,Cost 9 | N1-N2,N1,N2,324,324 10 | N1-N3,N1,N3,368,368 11 | N2-N3,N2,N3,432,432 12 | N2-N4,N2,N4,592,592 13 | N3-N5,N3,N5,631,631 14 | N4-N5,N4,N5,464,464 15 | N4-N6,N4,N6,384,384 16 | N5-N6,N5,N6,336,336 17 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | XinZhan_Heu_v2.2.4 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/eon/general/RequestType.java: -------------------------------------------------------------------------------- 1 | package eon.general; 2 | 3 | /** 4 | * @restructured by vxFury 5 | * 6 | */ 7 | public enum RequestType { 8 | ARRIVAL("ARRIVAL", 0), DEPARTURE("DEPARTURE", 1); 9 | 10 | String name; 11 | int index; 12 | 13 | RequestType(String name, int index) { 14 | this.name = name; 15 | this.index = index; 16 | } 17 | 18 | public String getName() { 19 | return name; 20 | } 21 | 22 | public int getIndex() { 23 | return index; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/release.txt: -------------------------------------------------------------------------------- 1 | v2.2.4 2 | 1.combine SWP and ATS 3 | 4 | v2.2.3 5 | 1.faster 'contains'(replace "constraint.getExcludedLinkList.contains(link)" with "constraint.containsLinks(link)" which uses tips : bit-Mask)(LinkList -> ArrayList) 6 | 7 | v2.2.2 8 | 1.fix some bugs 9 | 2.SBPP 10 | 11 | v2.2.1 12 | 1.dynamic routing using depth-first-serach algorithm(M:1) 13 | 14 | v2.1.x 15 | 1.develop ATS-based RSA algorithm 16 | 2.spectrum allocation for static route 17 | 18 | note : 19 | v1.x.x SWP-based RSA algorithm -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/eon/general/RouteType.java: -------------------------------------------------------------------------------- 1 | package eon.general; 2 | 3 | /** 4 | * @restructured by vxFury 5 | * 6 | */ 7 | public enum RouteType { 8 | Ordinary("Ordinary", 0), Working("Working", 1), Protection("Protection", 2); 9 | 10 | String name; 11 | int index; 12 | 13 | RouteType(String name, int index) { 14 | this.name = name; 15 | this.index = index; 16 | } 17 | 18 | public String getName() { 19 | return name; 20 | } 21 | 22 | public int getIndex() { 23 | return index; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | jboss/server/all/deploy/project.ext 2 | jboss/server/default/deploy/project.ext 3 | jboss/server/minimal/deploy/project.ext 4 | jboss/server/all/log/*.log 5 | jboss/server/all/tmp/**/* 6 | jboss/server/all/data/**/* 7 | jboss/server/all/work/**/* 8 | jboss/server/default/log/*.log 9 | jboss/server/default/tmp/**/* 10 | jboss/server/default/data/**/* 11 | jboss/server/default/work/**/* 12 | jboss/server/minimal/log/*.log 13 | jboss/server/minimal/tmp/**/* 14 | jboss/server/minimal/data/**/* 15 | jboss/server/minimal/work/**/* 16 | 17 | # deployed package files # 18 | 19 | *.DEPLOYED 20 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/eon/general/xRandom.java: -------------------------------------------------------------------------------- 1 | package eon.general; 2 | 3 | import java.util.Random; 4 | 5 | /** 6 | * @restructured by vxFury 7 | * 8 | */ 9 | public class xRandom { 10 | public static int uniformRandom(int min_value, int max_value, Random r) { 11 | int interval = max_value - min_value + 1; 12 | int x = r.nextInt(interval); 13 | return min_value + x; 14 | } 15 | 16 | public static double uniformRandom(Random r) { 17 | return r.nextDouble(); 18 | } 19 | 20 | public static double expdev(Random r) { 21 | double dum; 22 | dum = uniformRandom(r); 23 | return (-Math.log(dum)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/eon/general/RoutingStrategy.java: -------------------------------------------------------------------------------- 1 | package eon.general; 2 | 3 | /** 4 | * @restructured by vxFury 5 | * 6 | */ 7 | public enum RoutingStrategy { 8 | BestFit("BestFit", 0),MinimalDiff("MinimalDiff", 1),AdvancedMinDiff("AdvancedMinDiff", 2),MaximalWeight("MaximalWeight", 3),FirstFit("FirstFit", 4), LeastCost("LeastCost", 5), ; 9 | 10 | String name; 11 | int index; 12 | 13 | RoutingStrategy(String name, int index) { 14 | this.name = name; 15 | this.index = index; 16 | } 17 | 18 | public String getName() { 19 | return name; 20 | } 21 | 22 | public int getIndex() { 23 | return index; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/data/topology/SMALLNET.csv: -------------------------------------------------------------------------------- 1 | Node,x,y,, 2 | N0,-148,220,, 3 | N1,-91,220,, 4 | N2,-153,189,, 5 | N3,-133,204,, 6 | N4,-106,204,, 7 | N5,-86,189,, 8 | N6,-133,174,, 9 | N7,-106,174,, 10 | N8,-148,158,, 11 | N9,-91,158,, 12 | Link,NodeA,NodeB,Length,Cost 13 | N0-N1,N0,N1,223,223 14 | N0-N2,N0,N2,199,199 15 | N0-N3,N0,N3,240,240 16 | N1-N3,N1,N3,201,201 17 | N1-N4,N1,N4,241,241 18 | N1-N5,N1,N5,193,193 19 | N2-N3,N2,N3,218,218 20 | N2-N6,N2,N6,199,199 21 | N2-N8,N2,N8,207,207 22 | N3-N4,N3,N4,200,200 23 | N3-N6,N3,N6,181,181 24 | N3-N7,N3,N7,183,183 25 | N4-N5,N4,N5,204,204 26 | N4-N6,N4,N6,196,196 27 | N4-N7,N4,N7,212,212 28 | N5-N7,N5,N7,188,188 29 | N5-N9,N5,N9,195,195 30 | N6-N7,N6,N7,199,199 31 | N6-N8,N6,N8,240,240 32 | N7-N8,N7,N8,236,236 33 | N7-N9,N7,N9,222,222 34 | N8-N9,N8,N9,199,199 35 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/eon/general/object.java: -------------------------------------------------------------------------------- 1 | package eon.general; 2 | 3 | /** 4 | * @restructured by vxFury 5 | * 6 | */ 7 | public class object { 8 | String name; 9 | int index; 10 | String comments; 11 | 12 | public object(String name, int index, String comments) { 13 | this.name = name; 14 | this.index = index; 15 | this.comments = comments; 16 | } 17 | 18 | public String getName() { 19 | return name; 20 | } 21 | 22 | public void setName(String name) { 23 | this.name = name; 24 | } 25 | 26 | public int getIndex() { 27 | return index; 28 | } 29 | 30 | public void setIndex(int index) { 31 | this.index = index; 32 | } 33 | 34 | public String getComments() { 35 | return comments; 36 | } 37 | 38 | public void setComments(String comments) { 39 | this.comments = comments; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/work/utilities/Utility.java: -------------------------------------------------------------------------------- 1 | package work.utilities; 2 | 3 | public class Utility { 4 | public static String toBinaryString(int x) { 5 | int[] buffer = new int[Integer.SIZE]; 6 | 7 | for(int i = (Integer.SIZE - 1); i >= 0;i --) { 8 | buffer[i] = x >>> i & 0x1; 9 | } 10 | 11 | String binStr = ""; 12 | for(int i = (Integer.SIZE - 1); i >= 0;i --) { 13 | binStr += buffer[i]; 14 | } 15 | 16 | return binStr; 17 | } 18 | 19 | public static String toBinaryString(long x) { 20 | long[] buffer = new long[Long.SIZE]; 21 | 22 | for(int i = (Long.SIZE - 1); i >= 0;i --) { 23 | buffer[i] = x >>> i & 0x1; 24 | } 25 | 26 | String binStr = ""; 27 | for(int i = (Long.SIZE - 1); i >= 0;i --) { 28 | binStr += buffer[i]; 29 | } 30 | 31 | return binStr; 32 | } 33 | } -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/eon/general/Constant.java: -------------------------------------------------------------------------------- 1 | package eon.general; 2 | 3 | import work.utilities.Logger.Level; 4 | 5 | /** 6 | * @restructured by vxFury 7 | * 8 | */ 9 | public class Constant { 10 | public static int MAXIUM = 100000000; 11 | 12 | // Resource on fiber link 13 | public static double BandwidthPerSlot = 12.5; // in units of Gbps(Modulation : BPSK) 14 | public static int TotalSlotsNum = 320; 15 | 16 | // For Availability Research 17 | public final static double MTTR = 6.0;// Mean Time To Repair, 6 hours 18 | public final static double FIT = 1.0 / (Math.pow(10.0, 9.0)); 19 | public final static double LAMBDA = 200.0 * FIT; 20 | public final static double MTTF = 1.0 / LAMBDA; // Mean Time To Failures 21 | public final static double MU = 1 / MTTR; 22 | 23 | public static int outMask = Level.FATAL.getMask() 24 | | Level.DEBUG.getMask(); 25 | } 26 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/data/topology/NSFNET.csv: -------------------------------------------------------------------------------- 1 | Node,x,y,, 2 | N01,57,125,, 3 | N02,75,140,, 4 | N03,75,110,, 5 | N04,95,125,, 6 | N05,115,120,, 7 | N06,115,100,, 8 | N07,135,120,, 9 | N08,155,125,, 10 | N09,180,125,, 11 | N10,180,85,, 12 | N11,200,145,, 13 | N12,215,130,, 14 | N13,205,100,, 15 | N14,223,110,, 16 | Link,NodeA,NodeB,Length,Cost 17 | N01-N02,N01,N02,260,260 18 | N01-N03,N01,N03,252,252 19 | N01-N04,N01,N04,324,324 20 | N02-N03,N02,N03,380,380 21 | N02-N08,N02,N08,868,868 22 | N03-N06,N03,N06,416,416 23 | N04-N05,N04,N05,248,248 24 | N04-N11,N04,N11,1140,1140 25 | N05-N06,N05,N06,272,272 26 | N05-N07,N05,N07,292,292 27 | N06-N10,N06,N10,704,704 28 | N06-N13,N06,N13,1036,1036 29 | N07-N08,N07,N08,212,212 30 | N08-N09,N08,N09,224,224 31 | N09-N10,N09,N10,752,752 32 | N09-N12,N09,N12,536,536 33 | N09-N14,N09,N14,668,668 34 | N11-N12,N11,N12,408,408 35 | N11-N14,N11,N14,684,684 36 | N12-N13,N12,N13,664,664 37 | N13-N14,N13,N14,352,352 38 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/data/topology/COST239.csv: -------------------------------------------------------------------------------- 1 | Node,x,y,, 2 | N01,156,159,, 3 | N02,78,130,, 4 | N03,132,130,, 5 | N04,178,130,, 6 | N05,103,105,, 7 | N06,148,104,, 8 | N07,180,103,, 9 | N08,89,80,, 10 | N09,144,79,, 11 | N10,201,78,, 12 | N11,159,60,, 13 | Link,NodeA,NodeB,Length,Cost 14 | N01-N02,N01,N02,130,130 15 | N01-N03,N01,N03,90,90 16 | N01-N04,N01,N04,90,90 17 | N01-N07,N01,N07,103,103 18 | N02-N03,N02,N03,120,120 19 | N02-N05,N02,N05,70,70 20 | N02-N08,N02,N08,90,90 21 | N03-N04,N03,N04,100,100 22 | N03-N05,N03,N05,90,90 23 | N03-N06,N03,N06,67,67 24 | N04-N07,N04,N07,50,50 25 | N04-N08,N04,N08,250,250 26 | N04-N10,N04,N10,150,150 27 | N05-N06,N05,N06,98,98 28 | N05-N08,N05,N08,60,60 29 | N05-N11,N05,N11,230,230 30 | N06-N07,N06,N07,78,78 31 | N06-N08,N06,N08,120,120 32 | N06-N09,N06,N09,65,65 33 | N07-N09,N07,N09,81,81 34 | N07-N10,N07,N10,65,65 35 | N08-N09,N08,N09,120,120 36 | N08-N11,N08,N11,180,180 37 | N09-N10,N09,N10,100,100 38 | N09-N11,N09,N11,60,60 39 | N10-N11,N10,N11,120,120 40 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/eon/spectrum/FrequencySlot.java: -------------------------------------------------------------------------------- 1 | package eon.spectrum; 2 | 3 | import java.util.ArrayList; 4 | 5 | /** 6 | * @author vxFury 7 | * 8 | */ 9 | public class FrequencySlot { 10 | private int index; 11 | private int flags = 0x0; 12 | 13 | private ArrayList requestList = new ArrayList(); 14 | 15 | public int getIndex() { 16 | return index; 17 | } 18 | 19 | public void setIndex(int index) { 20 | this.index = index; 21 | } 22 | 23 | public FrequencySlot(int index) { 24 | this.index = index; 25 | } 26 | 27 | public ArrayList getRequestList() { 28 | return requestList; 29 | } 30 | 31 | public void setRequestList(ArrayList requestList) { 32 | this.requestList = requestList; 33 | } 34 | 35 | public void clearShareable() { 36 | flags &= 0xBFFFFFFF; 37 | } 38 | 39 | public void setShareable() { 40 | flags |= 0x40000000; 41 | } 42 | 43 | public boolean isShareable() { 44 | return (flags & 0x40000000) != 0; 45 | } 46 | } -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/eon/general/Modulation.java: -------------------------------------------------------------------------------- 1 | package eon.general; 2 | 3 | /** 4 | * @restructured by vxFury 5 | * 6 | */ 7 | public enum Modulation { 8 | QAM8("8QAM", 3, 1000.0), QPSK("QPSK", 2, 2000.0), BPSK("BPSK", 1, 4000.0), UNARRIVAL("UNARRIVAL", 0, 0.0); 9 | 10 | private String Name; 11 | private int SpectrumEfficiency; 12 | private double transDistance; 13 | 14 | private Modulation(String Name, int SpectrumEfficiency, double transDistance) { 15 | this.Name = Name; 16 | this.SpectrumEfficiency = SpectrumEfficiency; 17 | this.transDistance = transDistance; 18 | } 19 | 20 | public static int getRequiredSlots(double rate,Modulation modulation) { 21 | return (int) Math.ceil(rate/modulation.getCapacity()); 22 | } 23 | 24 | public String getName() { 25 | return Name; 26 | } 27 | 28 | public int getSpectrumEfficiency() { 29 | return SpectrumEfficiency; 30 | } 31 | 32 | public double getTransDistance() { 33 | return transDistance; 34 | } 35 | 36 | public double getCapacity() { 37 | return SpectrumEfficiency * Constant.BandwidthPerSlot; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/eon/spectrum/AdaptiveSlotSection.java: -------------------------------------------------------------------------------- 1 | package eon.spectrum; 2 | 3 | /** 4 | * @author vxFury 5 | * 6 | */ 7 | public class AdaptiveSlotSection { 8 | private int startIndex; 9 | private int slots; 10 | 11 | private double leftWeight = 0.0; 12 | private double rightWeight = 0.0; 13 | 14 | public AdaptiveSlotSection(int startIndex,int slots) { 15 | this.slots = slots; 16 | this.startIndex = startIndex; 17 | } 18 | 19 | public int getStartIndex() { 20 | return startIndex; 21 | } 22 | 23 | public void setStartIndex(int startIndex) { 24 | this.startIndex = startIndex; 25 | } 26 | 27 | public int getSlots() { 28 | return slots; 29 | } 30 | 31 | public void setSlots(int slots) { 32 | this.slots = slots; 33 | } 34 | 35 | public double getLeftWeight() { 36 | return leftWeight; 37 | } 38 | 39 | public void setLeftWeight(double leftWeight) { 40 | this.leftWeight = leftWeight; 41 | } 42 | 43 | public double getRightWeight() { 44 | return rightWeight; 45 | } 46 | 47 | public void setRightWeight(double rightWeight) { 48 | this.rightWeight = rightWeight; 49 | } 50 | } -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/eon/spectrum/ResourceOnLink.java: -------------------------------------------------------------------------------- 1 | package eon.spectrum; 2 | 3 | import eon.network.Link; 4 | 5 | /** 6 | * @author vxFury 7 | * 8 | */ 9 | public class ResourceOnLink { 10 | private Link link; 11 | private int startIndex; 12 | private int slots; 13 | private Request request; 14 | 15 | public ResourceOnLink(Link link, int startIndex, int slots, Request request) { 16 | setLink(link); 17 | setStartIndex(startIndex); 18 | setSlots(slots); 19 | setRequest(request); 20 | } 21 | 22 | public int getStartIndex() { 23 | return startIndex; 24 | } 25 | 26 | public void setStartIndex(int startIndex) { 27 | this.startIndex = startIndex; 28 | } 29 | 30 | public int getSlots() { 31 | return slots; 32 | } 33 | 34 | public void setSlots(int slots) { 35 | this.slots = slots; 36 | } 37 | 38 | public Link getLink() { 39 | return link; 40 | } 41 | 42 | public void setLink(Link link) { 43 | this.link = link; 44 | } 45 | 46 | public Request getRequest() { 47 | return request; 48 | } 49 | 50 | public void setRequest(Request request) { 51 | this.request = request; 52 | } 53 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 vxFury 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/eon/general/FileOutput.java: -------------------------------------------------------------------------------- 1 | package eon.general; 2 | 3 | import java.io.*; 4 | 5 | /** 6 | * @restructured by vxFury 7 | * 8 | */ 9 | public class FileOutput { 10 | public void writeLn(String filename, String result) { 11 | FileOutputStream fos = null; 12 | try { 13 | fos = new FileOutputStream(filename, true); 14 | byte[] buffer1 = result.getBytes(); 15 | fos.write(buffer1); 16 | String str = "\r\n"; 17 | 18 | byte[] buffer = str.getBytes(); 19 | fos.write(buffer); 20 | fos.close(); 21 | } catch (FileNotFoundException e1) { 22 | System.out.println(e1); 23 | } catch (IOException e1) { 24 | System.out.println(e1); 25 | } 26 | } 27 | 28 | public void write(String filename, String result) { 29 | FileOutputStream fos = null; 30 | try { 31 | fos = new FileOutputStream(filename, true); 32 | byte[] buffer1 = result.getBytes(); 33 | fos.write(buffer1); 34 | String str = ""; 35 | byte[] buffer = str.getBytes(); 36 | fos.write(buffer); 37 | fos.close(); 38 | } catch (FileNotFoundException e1) { 39 | System.out.println(e1); 40 | } catch (IOException e1) { 41 | System.out.println(e1); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/work/VCAT/InitVCAT.java: -------------------------------------------------------------------------------- 1 | package work.VCAT; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.Date; 5 | 6 | /** 7 | * @author vxFury 8 | * 9 | */ 10 | public class InitVCAT { 11 | public static void main(String[] args) { 12 | HeuVCAT heu = new HeuVCAT(); 13 | 14 | String dataPath = "./data/"; 15 | 16 | String[] netName = { "usnet" };// { "n6s8", "smallnet", "cost239", "nsfnet", "usnet" }; 17 | 18 | int demand[] = {100,500,1000,1500,2000,2500,3000,3500,4000,4500,5000}; 19 | 20 | int k = 3; 21 | 22 | for (String net : netName) { 23 | long time = System.currentTimeMillis(); 24 | SimpleDateFormat date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss.SSS"); 25 | System.out.println("********************************************************************************"); 26 | System.out.println("Topology File : " + net + ".csv\r\n" + date.format(new Date()) + "\r\n"); 27 | 28 | for(int tmp : demand){ 29 | System.out.println("Demand(fixed) for each nodepair is " + tmp); 30 | heu.availabilityEnhancing_VCAT(dataPath,net,k,tmp,tmp); 31 | } 32 | 33 | System.out.println(date.format(new Date())); 34 | System.out.println("End of analysis : " + (net + ".csv")); 35 | time = System.currentTimeMillis() - time; 36 | System.out.println("Time-consuming(Total) : " + time + " ms"); 37 | System.out.println("********************************************************************************\r\n"); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/eon/general/Time.java: -------------------------------------------------------------------------------- 1 | package eon.general; 2 | 3 | import eon.network.Route; 4 | 5 | /** 6 | * @restructured by vxFury 7 | * 8 | */ 9 | public class Time { 10 | String name; 11 | double time; 12 | int keytime; 13 | Route linearroute; 14 | int route_index; 15 | int occpyspectrum = Constant.MAXIUM; 16 | 17 | public Time(String name, double time, int keytime, Route linearroute) { 18 | this.name = name; 19 | this.time = time; 20 | this.keytime = keytime; 21 | this.linearroute = linearroute; 22 | } 23 | 24 | public int getOccpySpectrum() { 25 | return occpyspectrum; 26 | } 27 | 28 | public void setOccpySpectrum(int occpyspectrum) { 29 | this.occpyspectrum = occpyspectrum; 30 | } 31 | 32 | public int getRouteIndex() { 33 | return route_index; 34 | } 35 | 36 | public void setRouteIndex(int route_index) { 37 | this.route_index = route_index; 38 | } 39 | 40 | public Route getRoute() { 41 | return linearroute; 42 | } 43 | 44 | public void setRoute(Route linearroute) { 45 | this.linearroute = linearroute; 46 | } 47 | 48 | public int getKeyTime() { 49 | return keytime; 50 | } 51 | 52 | public void setKeyTime(int keytime) { 53 | this.keytime = keytime; 54 | } 55 | 56 | public String getName() { 57 | return name; 58 | } 59 | 60 | public void setName(String name) { 61 | this.name = name; 62 | } 63 | 64 | public double getTime() { 65 | return time; 66 | } 67 | 68 | public void setTime(double time) { 69 | this.time = time; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/work/SBPP/InitProtectionSBPP.java: -------------------------------------------------------------------------------- 1 | package work.SBPP; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.Date; 5 | 6 | import work.utilities.Logger; 7 | 8 | /** 9 | * @author vxFury 10 | * 11 | */ 12 | public class InitProtectionSBPP { 13 | public static void main(String[] args) { 14 | HeuProtectionSBPP heu = new HeuProtectionSBPP(); 15 | 16 | String dataPath = "./data/"; 17 | 18 | String[] netName = { "cost239" };// { "n6s8", "smallnet", "cost239", "nsfnet", "usnet" }; 19 | 20 | int minRate = 200, maxRate = 3200, gap = 200; 21 | 22 | for (String net : netName) { 23 | long time = System.currentTimeMillis(); 24 | SimpleDateFormat date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); 25 | System.out.println("********************************************************************************"); 26 | System.out.println("Topology File : " + net + ".csv\r\n" + date.format(new Date()) + "\r\n"); 27 | 28 | for (int rate = minRate; rate <= maxRate; rate += gap) { 29 | Logger.logln("FixedRate : " + rate,null); 30 | heu.availabilityEnhancing_ProtectionSBPP_AMD(dataPath, net, rate, rate); 31 | } 32 | 33 | System.out.println(date.format(new Date())); 34 | System.out.println("End of analysis : " + (net + ".csv")); 35 | time = System.currentTimeMillis() - time; 36 | System.out.println("Time-consuming : " + time + " ms"); 37 | System.out.println("********************************************************************************\r\n"); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/work/PathMN/InitProtectionPathM1.java: -------------------------------------------------------------------------------- 1 | package work.PathMN; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.Date; 5 | 6 | import work.utilities.Logger; 7 | 8 | /** 9 | * @author vxFury 10 | * 11 | */ 12 | public class InitProtectionPathM1 { 13 | public static void main(String[] args) { 14 | HeuProtectionPathM1 heu = new HeuProtectionPathM1(); 15 | 16 | String dataPath = "./data/"; 17 | 18 | String[] netName = { "cost239" };// { "n6s8", "smallnet", "cost239", "nsfnet", "usnet" }; 19 | 20 | int minRate = 200, maxRate = 3200, gap = 200; 21 | 22 | int M = 3; 23 | 24 | for (String net : netName) { 25 | long time = System.currentTimeMillis(); 26 | SimpleDateFormat date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); 27 | System.out.println("********************************************************************************"); 28 | System.out.println("Topology File : " + net + ".csv\r\n" + date.format(new Date()) + "\r\n"); 29 | 30 | for(int rate = minRate; rate <= maxRate;rate += gap) { 31 | Logger.logln("FixedRate : " + rate, null); 32 | heu.availabilityEnhancing_ProtectionPathM1_MD(dataPath, net, M, rate, rate); 33 | } 34 | 35 | System.out.println(date.format(new Date())); 36 | System.out.println("End of analysis : " + (net + ".csv")); 37 | time = System.currentTimeMillis() - time; 38 | System.out.println("Time-consuming : " + time + " ms"); 39 | System.out.println("********************************************************************************\r\n"); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/data/topology/USNET.csv: -------------------------------------------------------------------------------- 1 | Node,x,y,, 2 | N01,-125,352,, 3 | N02,-134,331,, 4 | N03,-135,301,, 5 | N04,-122,288,, 6 | N05,-130,271,, 7 | N06,-97,331,, 8 | N07,-99,301,, 9 | N08,-89,268,, 10 | N09,-67,304,, 11 | N10,-63,274,, 12 | N11,-42,333,, 13 | N12,-37,306,, 14 | N13,-32,279,, 15 | N14,-38,261,, 16 | N15,0,326,, 17 | N16,2,306,, 18 | N17,1,274,, 19 | N18,-7,255,, 20 | N19,42,356,, 21 | N20,36,326,, 22 | N21,33,303,, 23 | N22,23,290,, 24 | N23,31,274,, 25 | N24,21,256,, 26 | Link,NodeA,NodeB,Length,Cost 27 | N01-N02,N01,N02,80,8 28 | N01-N06,N01,N06,100,10 29 | N02-N03,N02,N03,110,11 30 | N02-N06,N02,N06,95,9.5 31 | N03-N04,N03,N04,25,2.5 32 | N03-N05,N03,N05,100,10 33 | N03-N07,N03,N07,100,10 34 | N04-N05,N04,N05,80,8 35 | N04-N07,N04,N07,85,8.5 36 | N05-N08,N05,N08,120,12 37 | N06-N07,N06,N07,100,10 38 | N06-N09,N06,N09,120,12 39 | N06-N11,N06,N11,190,19 40 | N07-N08,N07,N08,115,11.5 41 | N07-N09,N07,N09,100,10 42 | N08-N10,N08,N10,90,9 43 | N09-N10,N09,N10,100,10 44 | N09-N11,N09,N11,140,14 45 | N09-N12,N09,N12,100,10 46 | N10-N13,N10,N13,95,9.5 47 | N10-N14,N10,N14,85,8.5 48 | N11-N12,N11,N12,90,9 49 | N11-N15,N11,N15,130,13 50 | N11-N19,N11,N19,260,26 51 | N12-N13,N12,N13,90,9 52 | N12-N16,N12,N16,100,10 53 | N13-N14,N13,N14,65,6.5 54 | N13-N17,N13,N17,110,11 55 | N14-N18,N14,N18,120,12 56 | N15-N16,N15,N16,60,6 57 | N15-N20,N15,N20,130,13 58 | N16-N17,N16,N17,100,10 59 | N16-N21,N16,N21,100,10 60 | N16-N22,N16,N22,80,8 61 | N17-N18,N17,N18,80,8 62 | N17-N22,N17,N22,85,8.5 63 | N17-N23,N17,N23,100,10 64 | N18-N24,N18,N24,90,9 65 | N19-N20,N19,N20,120,12 66 | N20-N21,N20,N21,70,7 67 | N21-N22,N21,N22,30,3 68 | N22-N23,N22,N23,60,6 69 | N23-N24,N23,N24,90,9 70 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/eon/spectrum/SlotWindow.java: -------------------------------------------------------------------------------- 1 | package eon.spectrum; 2 | 3 | import java.util.ArrayList; 4 | 5 | import eon.network.Layer; 6 | import eon.network.Link; 7 | import eon.network.Route; 8 | 9 | /** 10 | * @restructured by vxFury 11 | * 12 | */ 13 | public class SlotWindow extends Layer { 14 | private int startIndex; 15 | private int endIndex; 16 | 17 | private ArrayList excludedLinkList = null; 18 | private ArrayList unshareableRouteList; 19 | 20 | public SlotWindow(String name, int index, String comments, int startIndex, int endIndex) { 21 | super(name, index, comments); 22 | this.excludedLinkList = new ArrayList(); 23 | this.startIndex = startIndex; 24 | this.endIndex = endIndex; 25 | this.unshareableRouteList = new ArrayList(); 26 | } 27 | 28 | public void RemoveConstrantLinks() { 29 | for (Link routeLinks : this.excludedLinkList) { 30 | routeLinks.getNodeA().addAdjacentNode(routeLinks.getNodeB()); 31 | } 32 | } 33 | 34 | public void initSlotWindowPlane() { 35 | for (Link routeLinks : this.excludedLinkList) { 36 | routeLinks.getNodeA().removeAdjacentNode(routeLinks.getNodeB()); 37 | } 38 | } 39 | 40 | public void addExcludedLinks(Route Route) { 41 | for (Link routeLinks : Route.getLinkList()) { 42 | this.excludedLinkList.add(routeLinks); 43 | } 44 | } 45 | 46 | public int getStartIndex() { 47 | return startIndex; 48 | } 49 | 50 | public int getEndIndex() { 51 | return endIndex; 52 | } 53 | 54 | public ArrayList getUnshareableRouteList() { 55 | return unshareableRouteList; 56 | } 57 | 58 | public void setUnshareableRouteList(ArrayList unshareableRouteList) { 59 | this.unshareableRouteList = unshareableRouteList; 60 | } 61 | 62 | public ArrayList getExcludedLinkList() { 63 | return excludedLinkList; 64 | } 65 | 66 | public void setExcludedLinkList(ArrayList excludedLinkList) { 67 | this.excludedLinkList = excludedLinkList; 68 | } 69 | 70 | public void setStartIndex(int startIndex) { 71 | this.startIndex = startIndex; 72 | } 73 | 74 | public void setEndIndex(int endIndex) { 75 | this.endIndex = endIndex; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/eon/general/bitProcess.java: -------------------------------------------------------------------------------- 1 | package eon.general; 2 | 3 | public class bitProcess { 4 | private static final int[] BITCOUNT_TABLE = { 5 | 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 6 | 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 7 | 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 8 | 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 9 | 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 10 | 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 11 | 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 12 | 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 13 | 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 14 | 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 15 | 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 16 | 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 17 | 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 18 | 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 19 | 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 20 | 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8, 21 | }; 22 | 23 | public static int bitCount_StaticTable(int n) { 24 | return BITCOUNT_TABLE[(n >>> 0) & 0xFF] + 25 | BITCOUNT_TABLE[(n >>> 8) & 0xFF] + 26 | BITCOUNT_TABLE[(n >>> 16) & 0xFF] + 27 | BITCOUNT_TABLE[(n >>> 24) & 0xFF] ; 28 | } 29 | 30 | /* 31 | * 1 1 0 1 1 0 0 1 32 | * \ / \ / \ / \ / 33 | * 2 1 1 1 34 | * \ / \ / 35 | * 3 2 36 | * \ / 37 | * 5 38 | */ 39 | public static int bitCount_Parallel(int x) { 40 | // 0x55 = 0101 0101 41 | x = (x & 0x55555555) + ((x >>> 1) & 0x55555555); 42 | // 0x33 = 0011 0011 43 | x = (x & 0x33333333) + ((x >>> 2) & 0x33333333); 44 | // 0x0f = 0000 1111 45 | x = (x & 0x0f0f0f0f) + ((x >>> 4) & 0x0f0f0f0f); 46 | // 0x00ff = 0000 0000 1111 1111 47 | x = (x & 0x00ff00ff) + ((x >>> 8) & 0x00ff00ff); 48 | // 0x0000ffff = 0000 0000 0000 0000 1111 1111 1111 1111 49 | x = (x & 0x0000ffff) + ((x >>> 16) & 0x0000ffff); 50 | 51 | return x; 52 | } 53 | 54 | public static int bitCount_Perfectness(int x) { 55 | int temp = x - (x >>> 1) & 033333333333 - (x >>> 2) & 011111111111; 56 | return (temp + (temp >>> 3)) & 030707070707 % 63; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/eon/graph/SearchConstraint.java: -------------------------------------------------------------------------------- 1 | package eon.graph; 2 | 3 | import java.util.ArrayList; 4 | 5 | import eon.network.*; 6 | 7 | /** 8 | * @restructured by vxFury 9 | * 10 | */ 11 | public class SearchConstraint { 12 | private Layer associatedLayer = null; 13 | private ArrayList excludedNodelist = null; 14 | private ArrayList excludedLinklist = null; 15 | 16 | private ArrayList linkmask = null; 17 | 18 | public SearchConstraint(Layer associatedLayer) { 19 | this.associatedLayer = associatedLayer; 20 | 21 | excludedLinklist = new ArrayList(); 22 | excludedNodelist = new ArrayList(); 23 | 24 | initLinkMask(); 25 | } 26 | 27 | public void initLinkMask() { 28 | int llsize = associatedLayer.getLinkList().size(); 29 | int size = ((llsize >>> 5) + ((llsize & 0x1F) == 0 ? (0) : (1))); 30 | 31 | linkmask = new ArrayList(); 32 | 33 | for(int index = 0; index < size; index ++) { 34 | linkmask.add(0x0); 35 | } 36 | } 37 | 38 | public void addLink(Link link) { 39 | excludedLinklist.add(link); 40 | 41 | int index = link.getIndex() >>> 5; 42 | int offset = link.getIndex() & 0x1F; 43 | 44 | int status = linkmask.get(index); 45 | int check = 0x1 << offset; 46 | linkmask.set(index, status | check); 47 | } 48 | 49 | public void removeLink(Link link) { 50 | excludedLinklist.remove(link); 51 | 52 | int index = link.getIndex() >>> 5; 53 | int offset = link.getIndex() & 0x1F; 54 | 55 | int status = linkmask.get(index); 56 | int check = ~(0x1 << offset); 57 | linkmask.set(index, status & check); 58 | } 59 | 60 | public boolean containsLink(Link link) { 61 | int index = link.getIndex() >>> 5; 62 | int offset = link.getIndex() & 0x1F; 63 | return (linkmask.get(index) & (0x1 << offset)) != 0; 64 | } 65 | 66 | public Layer getAssociatedLayer() { 67 | return associatedLayer; 68 | } 69 | 70 | public void setAssociatedLayer(Layer associatedLayer) { 71 | this.associatedLayer = associatedLayer; 72 | } 73 | 74 | public ArrayList getExcludedNodeList() { 75 | return excludedNodelist; 76 | } 77 | 78 | public void setExcludedNodeList(ArrayList excludedNodeList) { 79 | this.excludedNodelist = excludedNodeList; 80 | } 81 | 82 | public void addAllLinks(ArrayList linkList) { 83 | for(Link link : linkList) { 84 | addLink(link); 85 | } 86 | } 87 | 88 | public ArrayList __getExcludedLinkList() { 89 | return excludedLinklist; 90 | } 91 | 92 | public void __setExcludedLinkList(ArrayList excludedLinklist) { 93 | this.excludedLinklist = excludedLinklist; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/eon/spectrum/Request.java: -------------------------------------------------------------------------------- 1 | package eon.spectrum; 2 | 3 | import java.util.ArrayList; 4 | 5 | import eon.general.RequestType; 6 | import eon.general.RouteType; 7 | import eon.network.NodePair; 8 | import eon.network.Route; 9 | 10 | /** 11 | * @author vxFury 12 | * 13 | */ 14 | public class Request { 15 | private NodePair nodepair; 16 | private double requiredRate; 17 | private RequestType requestType = RequestType.ARRIVAL; 18 | 19 | private double arrivalTime; 20 | private double departTime; 21 | 22 | private ArrayList routeList = null; 23 | private ArrayList rolList = null; 24 | 25 | public Request(NodePair nodepair, double rate) { 26 | setNodePair(nodepair); 27 | setRequiredRate(rate); 28 | setRequestType(RequestType.ARRIVAL); 29 | 30 | routeList = new ArrayList(); 31 | rolList = new ArrayList(); 32 | } 33 | 34 | public Request(NodePair nodepair, int rate, double arrivaltime, double departtime, RequestType requestType) { 35 | setNodePair(nodepair); 36 | setRequiredRate(rate); 37 | setArrivalTime(arrivaltime); 38 | setDepartTime(departtime); 39 | setRequestType(requestType); 40 | 41 | routeList = new ArrayList(); 42 | rolList = new ArrayList(); 43 | } 44 | 45 | public ArrayList getRouteList(RouteType routeType) { 46 | ArrayList rlist = new ArrayList(); 47 | 48 | for(Route route : getRouteList()) { 49 | if(route.getRouteType() == routeType) { 50 | rlist.add(route); 51 | } 52 | } 53 | 54 | return rlist; 55 | } 56 | 57 | public NodePair getNodePair() { 58 | return nodepair; 59 | } 60 | 61 | public void setNodePair(NodePair nodepair) { 62 | this.nodepair = nodepair; 63 | } 64 | 65 | public double getRequiredRate() { 66 | return requiredRate; 67 | } 68 | 69 | public void setRequiredRate(double requiredRate) { 70 | this.requiredRate = requiredRate; 71 | } 72 | 73 | public RequestType getRequestType() { 74 | return requestType; 75 | } 76 | 77 | public void setRequestType(RequestType requestType) { 78 | this.requestType = requestType; 79 | } 80 | 81 | public double getArrivalTime() { 82 | return arrivalTime; 83 | } 84 | 85 | public void setArrivalTime(double arrivalTime) { 86 | this.arrivalTime = arrivalTime; 87 | } 88 | 89 | public double getDepartTime() { 90 | return departTime; 91 | } 92 | 93 | public void setDepartTime(double departTime) { 94 | this.departTime = departTime; 95 | } 96 | 97 | public ArrayList getRouteList() { 98 | return routeList; 99 | } 100 | 101 | public void setRouteList(ArrayList routeList) { 102 | this.routeList = routeList; 103 | } 104 | 105 | public ArrayList getRolList() { 106 | return rolList; 107 | } 108 | 109 | public void setRolList(ArrayList rolList) { 110 | this.rolList = rolList; 111 | } 112 | } -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/work/utilities/Logger.java: -------------------------------------------------------------------------------- 1 | package work.utilities; 2 | 3 | import java.io.File; 4 | 5 | import eon.general.FileOutput; 6 | 7 | /** 8 | * @author vxFury 9 | * 10 | */ 11 | public class Logger { 12 | private File file; 13 | private Level level = Level.ALL; 14 | private FileOutput logger = new FileOutput(); 15 | 16 | private static int outMask = Level.FATAL.getMask(); 17 | 18 | public Logger(String loggerFile,Level level) { 19 | try { 20 | file = new File(loggerFile); 21 | this.level = level; 22 | } catch (Exception ex) { 23 | ex.printStackTrace(); 24 | } 25 | } 26 | 27 | public Logger(String loggerFile) { 28 | try { 29 | file = new File(loggerFile); 30 | } catch (Exception ex) { 31 | ex.printStackTrace(); 32 | } 33 | } 34 | 35 | public String getName() { 36 | return file.getName(); 37 | } 38 | 39 | public File getFile() { 40 | return file; 41 | } 42 | 43 | public static void logln(Logger logger,String format,Object...args) { 44 | String msg = String.format(format, args); 45 | if(logger != null) { 46 | if((logger.getLevel().getMask() & outMask) != 0) { 47 | logger.writeLn(msg); 48 | } 49 | } else { 50 | System.out.println(msg); 51 | } 52 | } 53 | 54 | public static void log(Logger logger,String format,Object...args) { 55 | String msg = String.format(format, args); 56 | if(logger != null) { 57 | if((logger.getLevel().getMask() & outMask) != 0) { 58 | logger.write(msg); 59 | } 60 | } else { 61 | System.out.print(msg); 62 | } 63 | } 64 | 65 | public static void logln(String msg,Logger logger) { 66 | if(logger != null) { 67 | if((logger.getLevel().getMask() & outMask) != 0) { 68 | logger.writeLn(msg); 69 | } 70 | } else { 71 | System.out.println(msg); 72 | } 73 | } 74 | 75 | public static void log(String msg,Logger logger) { 76 | if(logger != null) { 77 | if((logger.getLevel().getMask() & outMask) != 0) { 78 | logger.write(msg); 79 | } 80 | } else { 81 | System.out.print(msg); 82 | } 83 | } 84 | 85 | public synchronized void write(String msg) { 86 | this.logger.write(file.getAbsolutePath(), msg); 87 | } 88 | 89 | public synchronized void writeLn(String msg) { 90 | this.logger.writeLn(file.getAbsolutePath(), msg); 91 | } 92 | 93 | public Level getLevel() { 94 | return level; 95 | } 96 | 97 | public void setLevel(Level level) { 98 | this.level = level; 99 | } 100 | 101 | public void addFilter(Level level) { 102 | outMask |= level.getMask(); 103 | } 104 | 105 | public void removeFilter(Level level) { 106 | outMask &= ~(level.getMask()); 107 | } 108 | 109 | public boolean isEnabled(Level level) { 110 | return (outMask & level.getMask()) != 0; 111 | } 112 | 113 | public enum Level { 114 | NONE("NONE", 0), FATAL("FATAL", 0x0001 << 0), ERROR("ERROR", 0x0001 << 1), WARNING("WARNING", 0x0001 << 2), INFO("INFO", 0x0001 << 3), DEBUG("DEBUG", 0x0001 << 4), ALL("ALL", 0xFFFF); 115 | private String Name; 116 | private int Mask; 117 | 118 | private Level(String Name, int Mask) { 119 | this.Name = Name; 120 | this.Mask = Mask; 121 | } 122 | 123 | public String getName() { 124 | return Name; 125 | } 126 | 127 | public int getMask() { 128 | return Mask; 129 | } 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/eon/network/Node.java: -------------------------------------------------------------------------------- 1 | package eon.network; 2 | 3 | import java.util.ArrayList; 4 | 5 | import eon.general.Constant; 6 | import eon.general.object; 7 | 8 | /** 9 | * @restructured by vxFury 10 | * 11 | */ 12 | public class Node extends object { 13 | private Layer associatedLayer = null; 14 | private ArrayList adjacentNodeList = null; 15 | 16 | private double costFromSrc = Constant.MAXIUM; 17 | private int hopFromSrc = Constant.MAXIUM; 18 | private double lengthFromSrc = Constant.MAXIUM; 19 | 20 | private int timesVisited = 0; 21 | private Node parentNode = null; 22 | 23 | private int x; 24 | private int y; 25 | 26 | private double BlockingProbability = 0; 27 | private double TrafficLoad = 0; 28 | 29 | public Node(String name, int index, String comments, Layer associatedLayer, int x, int y) { 30 | super(name, index, comments); 31 | this.associatedLayer = associatedLayer; 32 | this.adjacentNodeList = new ArrayList(); 33 | this.x = x; 34 | this.y = y; 35 | } 36 | 37 | public double getTrafficLoad() { 38 | return TrafficLoad; 39 | } 40 | 41 | public void setTrafficLoad(double nodeTrafficLoad) { 42 | TrafficLoad = nodeTrafficLoad; 43 | } 44 | 45 | public double getBlockingProbability() { 46 | return BlockingProbability; 47 | } 48 | 49 | public void setBlockingProbability(double nodeBlockingProbability) { 50 | BlockingProbability = nodeBlockingProbability; 51 | } 52 | 53 | public int getX() { 54 | return x; 55 | } 56 | 57 | public void setX(int x) { 58 | this.x = x; 59 | } 60 | 61 | public int getY() { 62 | return y; 63 | } 64 | 65 | public void setY(int y) { 66 | this.y = y; 67 | } 68 | 69 | public Layer getAssociatedLayer() { 70 | return associatedLayer; 71 | } 72 | 73 | public void setAssociatedLayer(Layer associatedLayer) { 74 | this.associatedLayer = associatedLayer; 75 | } 76 | 77 | public ArrayList getAdjacentNodeList() { 78 | return adjacentNodeList; 79 | } 80 | 81 | public void setAdjacentNodeList(ArrayList adjacentNodeList) { 82 | this.adjacentNodeList = adjacentNodeList; 83 | } 84 | 85 | public double getCostFromSrc() { 86 | return costFromSrc; 87 | } 88 | 89 | public void setCostFromSrc(double costFromSrc) { 90 | this.costFromSrc = costFromSrc; 91 | } 92 | 93 | public int getHopFromSrc() { 94 | return hopFromSrc; 95 | } 96 | 97 | public void setHopFromSrc(int hopFromSrc) { 98 | this.hopFromSrc = hopFromSrc; 99 | } 100 | 101 | public double getLengthFromSrc() { 102 | return lengthFromSrc; 103 | } 104 | 105 | public void setLengthFromSrc(double lengthFromSrc) { 106 | this.lengthFromSrc = lengthFromSrc; 107 | } 108 | 109 | public int getTimesVisited() { 110 | return timesVisited; 111 | } 112 | 113 | public void setTimesVisited(int status) { 114 | this.timesVisited = status; 115 | } 116 | 117 | public Node getParentNode() { 118 | return parentNode; 119 | } 120 | 121 | public void setParentNode(Node parentNode) { 122 | this.parentNode = parentNode; 123 | } 124 | 125 | public void addAdjacentNode(Node node) { 126 | this.adjacentNodeList.add(node); 127 | } 128 | 129 | public void removeAdjacentNode(int index) { 130 | adjacentNodeList.remove(index); 131 | } 132 | 133 | public void removeAdjacentNode(Node node) { 134 | this.adjacentNodeList.remove(node); 135 | } 136 | 137 | public int getDegree() { 138 | return this.adjacentNodeList.size(); 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/work/PathMN/dataForAMPL_ProtectionPathM1.java: -------------------------------------------------------------------------------- 1 | package work.PathMN; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.Date; 5 | 6 | import eon.general.Modulation; 7 | import eon.graph.RouteSearching; 8 | import eon.network.Layer; 9 | import eon.network.NodePair; 10 | import work.utilities.Logger; 11 | import work.utilities.Logger.Level; 12 | import work.forAMPL.*; 13 | 14 | /** 15 | * @author vxFury 16 | * 17 | */ 18 | public class dataForAMPL_ProtectionPathM1 { 19 | public static void dataForAMPL (String dataPath, String networkName, Strategy strategy) { 20 | Layer layer = new Layer("workLayer", 0, ""); 21 | String topology = dataPath + "topology/" + networkName + ".csv"; 22 | System.out.print(">>Importing Topology of Network(" + topology + ") ...\n"); 23 | layer.readTopology(topology); 24 | layer.generateNodePairs(); 25 | 26 | Logger NetDataLogger = new Logger(dataPath + "output/data/data_M1_" + strategy.getName() + "_" + networkName + ".dat"); 27 | NetDataLogger.setLevel(Level.FATAL); 28 | 29 | System.out.println(">>Data for AMPL will be output to File(" + NetDataLogger.getName() + ") ..."); 30 | 31 | dataForAMPL dfl = new dataForAMPL(); 32 | 33 | dfl.outputSetOfLinks(layer, NetDataLogger); 34 | dfl.outputSetOfNodePairs(layer, NetDataLogger); 35 | 36 | if(strategy == Strategy.KSP) { 37 | dfl.searchKshortesPath(layer, 3, Modulation.BPSK.getTransDistance()); 38 | } else if (strategy == Strategy.BFS) { 39 | RouteSearching rs = new RouteSearching(); 40 | 41 | for(NodePair nodepair : layer.getNodePairList()) { 42 | rs.searchAllRoutes(nodepair.getSrcNode(),nodepair.getDesNode(),layer,null,9,Modulation.BPSK.getTransDistance(),nodepair.getRouteList()); 43 | } 44 | } 45 | 46 | dfl.outputSetOfCandidateRoutes(layer, NetDataLogger); 47 | dfl.outputParamOfCapacityPerSlot(layer, NetDataLogger); 48 | dfl.outputParamOfTrafficDemand(layer, NetDataLogger); 49 | dfl.outputParamOfUnavailability(layer, NetDataLogger); 50 | dfl.outputParamOfDelta(layer, NetDataLogger); 51 | } 52 | 53 | public static void main(String[] args) { 54 | String dataPath = "./data/"; 55 | String[] netName = { "cost239" };// { "n6s8", "smallnet", "cost239", "nsfnet", "usnet" }; 56 | 57 | for (String net : netName) { 58 | long time = System.currentTimeMillis(); 59 | SimpleDateFormat date = new SimpleDateFormat("MM/DD/YYYY HH:mm:ss"); 60 | System.out.println("********************************************************************************"); 61 | System.out.println("Topology File : " + net + ".csv\r\n" + date.format(new Date()) + "\r\n"); 62 | 63 | Strategy strategy = Strategy.KSP; 64 | dataForAMPL(dataPath, net, strategy); 65 | 66 | System.out.println(""); 67 | 68 | System.out.println(date.format(new Date())); 69 | System.out.println("End of dataForAMPL : " + (net + ".csv")); 70 | time = System.currentTimeMillis() - time; 71 | System.out.println("Time-consuming : " + time + " ms"); 72 | System.out.println("********************************************************************************\r\n"); 73 | } 74 | } 75 | 76 | public enum Strategy { 77 | BFS("BFS", 0), KSP("KSP", 1); 78 | private String name; 79 | private int index; 80 | 81 | private Strategy(String Name,int index) { 82 | this.name = Name; 83 | this.setIndex(index); 84 | } 85 | 86 | public String getName() { 87 | return name; 88 | } 89 | 90 | public int getIndex() { 91 | return index; 92 | } 93 | 94 | public void setIndex(int index) { 95 | this.index = index; 96 | } 97 | } 98 | } -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/eon/network/NodePair.java: -------------------------------------------------------------------------------- 1 | package eon.network; 2 | 3 | import java.util.ArrayList; 4 | 5 | import eon.general.object; 6 | 7 | /** 8 | * @restructured by vxFury 9 | * 10 | */ 11 | public class NodePair extends object { 12 | private Layer associatedLayer = null; 13 | 14 | private Node srcNode = null; 15 | private Node desNode = null; 16 | 17 | // list of k shortest routes associated with the nodepair 18 | private ArrayList routelist = null; 19 | 20 | private int leasthop; 21 | private int leastworkinghop; 22 | private int leastprotectionhop; 23 | 24 | private double rate = 0; 25 | 26 | public Node getSrcNode() { 27 | return srcNode; 28 | } 29 | 30 | public void setSrcNode(Node srcNode) { 31 | this.srcNode = srcNode; 32 | } 33 | 34 | public Node getDesNode() { 35 | return desNode; 36 | } 37 | 38 | public void setDesNode(Node desNode) { 39 | this.desNode = desNode; 40 | } 41 | 42 | private double NodepairProbability = 0; 43 | 44 | public double getNodepairProbability() { 45 | return NodepairProbability; 46 | } 47 | 48 | public void setNodepairProbability(double nodepairProbability) { 49 | NodepairProbability = nodepairProbability; 50 | } 51 | 52 | public NodePair(String name, int index, String comments, Layer associatedLayer, Node srcNode, Node desNode) { 53 | super(name, index, comments); 54 | this.associatedLayer = associatedLayer; 55 | this.srcNode = srcNode; 56 | this.desNode = desNode; 57 | this.routelist = new ArrayList(); 58 | } 59 | 60 | public Layer getAssociatedLayer() { 61 | return associatedLayer; 62 | } 63 | 64 | public void setAssociatedLayer(Layer associatedLayer) { 65 | this.associatedLayer = associatedLayer; 66 | } 67 | 68 | public ArrayList getRouteList() { 69 | return routelist; 70 | } 71 | 72 | public void setRouteList(ArrayList routelist) { 73 | this.routelist = routelist; 74 | } 75 | 76 | public void addRoute(Route route) { 77 | this.routelist.add(route); 78 | } 79 | 80 | public void removeRoute(Route route) { 81 | this.routelist.remove(route); 82 | } 83 | 84 | public void removeRoute(int index) { 85 | for (int i = 0; i < this.routelist.size(); i++) { 86 | if (this.routelist.get(i).getIndex() == index) { 87 | this.routelist.remove(i); 88 | break; 89 | } 90 | } 91 | } 92 | 93 | public void removeRoute(String name) { 94 | for (int i = 0; i < this.routelist.size(); i++) { 95 | if (this.routelist.get(i).getName().equals(name)) { 96 | this.routelist.remove(i); 97 | break; 98 | } 99 | } 100 | } 101 | 102 | public void setRate(double rate) { 103 | this.rate = rate; 104 | } 105 | 106 | public double getRate() { 107 | return rate; 108 | } 109 | 110 | public void setLeastHop(int hop) { 111 | this.leasthop = hop; 112 | } 113 | 114 | public int getLeastHop() { 115 | return leasthop; 116 | } 117 | 118 | public void setLeastWorkingHop(int hop) { 119 | this.leastworkinghop = hop; 120 | } 121 | 122 | public int getLeastWorkingHop() { 123 | return leastworkinghop; 124 | } 125 | 126 | public int getLeastProtectionHop() { 127 | return leastprotectionhop; 128 | } 129 | 130 | public void setLeastProtectionHop(int hop) { 131 | this.leastprotectionhop = hop; 132 | } 133 | 134 | // For VCAT 135 | public int getSlots() { 136 | int slots = 0; 137 | 138 | for(Route route : this.getRouteList()) { 139 | slots += route.getSlots(); 140 | } 141 | 142 | return slots; 143 | } 144 | 145 | public double getNodepairAvailVCAT() { 146 | double nodepairAvailVCAT = 0; 147 | 148 | for (int k = 0; k < this.getRouteList().size(); k++) { 149 | Route route = this.getRouteList().get(k); 150 | nodepairAvailVCAT += ((double) route.getSlots()/ (double)this.getSlots()) * route.getAvailRouteVCAT(this); 151 | } 152 | 153 | return nodepairAvailVCAT; 154 | } 155 | } 156 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/work/temp/Test_s.java: -------------------------------------------------------------------------------- 1 | package work.temp; 2 | 3 | import java.util.ArrayList; 4 | 5 | import eon.general.Constant; 6 | import work.utilities.Logger; 7 | import work.utilities.Utility; 8 | 9 | public class Test_s { 10 | public static void main(String[] args) { 11 | ArrayList resourceList = new ArrayList(); 12 | int size = (Constant.TotalSlotsNum >>> 5) + (((Constant.TotalSlotsNum & 0x1F) == 0) ? (0) : (1)); 13 | for(int i = 0; i < size; i ++) { 14 | resourceList.add(i, 0xFFFFFFFF); 15 | } 16 | 17 | spectrumOccupy(10,10, resourceList); 18 | spectrumOccupy(30,10, resourceList); 19 | 20 | int bits = getBitsFlanked(resourceList,20,5); 21 | 22 | Logger.logln("" + bits, null); 23 | 24 | Long tmp = Long.MAX_VALUE; 25 | tmp |= 0x1 << 63; 26 | 27 | Logger.logln(Utility.toBinaryString(tmp), null); 28 | 29 | //spectrumRelease(startIndex,slots, resourceList); 30 | } 31 | 32 | public static int getBitsFlanked(ArrayList resourceList, int index, int range) { 33 | int bits = 0; 34 | 35 | if(range == 0) { 36 | return 0; 37 | } 38 | 39 | int min, max; 40 | 41 | if(range < 0) { 42 | min = Math.max(0, index + range); 43 | max = index - 1; 44 | 45 | for(int i = max;i >= min; i --) { 46 | int tmpIndex = i >>> 5; 47 | int tmpOffset = i & 0x1F; 48 | 49 | int check = 0x1 << tmpOffset; 50 | if((resourceList.get(tmpIndex) & check) != 0x0) { 51 | bits ++; 52 | } else { 53 | break; 54 | } 55 | } 56 | } else { 57 | min = index + 1; 58 | max = Math.min(Constant.TotalSlotsNum, index + range); 59 | 60 | for(int i = min;i <= max; i ++) { 61 | int tmpIndex = i >>> 5; 62 | int tmpOffset = i & 0x1F; 63 | 64 | int check = 0x1 << tmpOffset; 65 | if((resourceList.get(tmpIndex) & check) != 0x0) { 66 | bits ++; 67 | } else { 68 | break; 69 | } 70 | } 71 | } 72 | 73 | return bits; 74 | } 75 | 76 | public static void spectrumOccupy(int startIndex, int slots, ArrayList resourceList) { 77 | int endIndex = startIndex + slots; 78 | int offsetStart = startIndex & 0x1F; 79 | int indexStart = startIndex >>> 5; 80 | int offsetEnd = endIndex & 0x1F; 81 | int indexEnd = endIndex >>> 5; 82 | 83 | Logger.logln(null, "%d %d", endIndex, indexEnd); 84 | 85 | if(indexStart == indexEnd) { 86 | // resource required in the same Integer-Section 87 | Integer status = resourceList.get(indexStart); 88 | 89 | int check = ~(((0x1 << offsetStart) - 1) ^ ((0x01 << offsetEnd) - 1)); 90 | resourceList.set(indexStart, status & check); 91 | 92 | Logger.logln(null, "%s %s", Utility.toBinaryString(status), Utility.toBinaryString(status & check)); 93 | } else { 94 | Integer status = resourceList.get(indexStart); 95 | int check = (0x1 << offsetStart) - 1; 96 | resourceList.set(indexStart, status & check); 97 | Logger.logln(null, "%s %s", Utility.toBinaryString(status), Utility.toBinaryString(status & check)); 98 | 99 | for(int index = indexStart + 1; index < indexEnd; index ++) { 100 | resourceList.set(index, 0x0); 101 | } 102 | 103 | if(offsetEnd != 0) { 104 | status = resourceList.get(indexEnd); 105 | 106 | check = ~((0x1 << offsetEnd) - 1); 107 | 108 | resourceList.set(indexEnd, status & check); 109 | 110 | Logger.logln(null, "%s %s", Utility.toBinaryString(status), Utility.toBinaryString(status & check)); 111 | } 112 | } 113 | } 114 | 115 | public static void spectrumRelease(int startIndex, int slots, ArrayList resourceList) { 116 | int endIndex = startIndex + slots; 117 | int offsetStart = startIndex & 0x1F; 118 | int indexStart = startIndex >>> 5; 119 | int offsetEnd = endIndex & 0x1F; 120 | int indexEnd = endIndex >>> 5; 121 | 122 | if(indexStart == indexEnd) { 123 | // resource required in the same Integer-Section 124 | Integer status = resourceList.get(indexStart); 125 | 126 | int check = ((0x1 << offsetStart) - 1) ^ ((0x01 << offsetEnd) - 1); 127 | resourceList.set(indexStart, status | check); 128 | 129 | Logger.logln(null, "%s %s", Utility.toBinaryString(status), Utility.toBinaryString(status | check)); 130 | } else { 131 | Integer status = resourceList.get(indexStart); 132 | int check = ~((0x1 << offsetStart) - 1); 133 | resourceList.set(indexStart, status | check); 134 | Logger.logln(null, "%s %s", Utility.toBinaryString(status),Utility.toBinaryString(status | check)); 135 | 136 | for(int index = indexStart + 1; index < indexEnd; index ++) { 137 | resourceList.set(indexEnd, 0xFFFFFFFF); 138 | } 139 | 140 | if(offsetEnd != 0) { 141 | status = resourceList.get(indexEnd); 142 | 143 | check = (0x1 << offsetEnd) - 1; 144 | 145 | resourceList.set(indexEnd, status | check); 146 | 147 | Logger.logln(null, "%s %s", Utility.toBinaryString(status), Utility.toBinaryString(status | check)); 148 | } 149 | } 150 | } 151 | } -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/work/VCAT/HeuVCAT.java: -------------------------------------------------------------------------------- 1 | package work.VCAT; 2 | 3 | import eon.general.Modulation; 4 | import eon.general.xRandom; 5 | 6 | import java.util.ArrayList; 7 | import java.util.Random; 8 | 9 | import eon.network.Layer; 10 | import eon.network.Link; 11 | import eon.network.NodePair; 12 | import eon.network.Route; 13 | import work.utilities.Logger; 14 | import work.utilities.Logger.Level; 15 | import eon.spectrum.Request; 16 | import eon.spectrum.ResourceOnLink; 17 | import eon.spectrum.RoutingAndSpectrumAllocation; 18 | 19 | /** 20 | * @author vxFury 21 | * 22 | */ 23 | public class HeuVCAT { 24 | public void availabilityEnhancing_VCAT(String dataPath, String networkName, int k,int minRate,int maxRate) { 25 | // Part 1 Data Preparation 26 | // TODO NOTE : 27 | Layer layer = new Layer("workLayer", 0, ""); 28 | String topology = dataPath + "topology/" + networkName + ".csv"; 29 | System.out.print(">>Importing Topology of Network(" + topology + ") ...\n"); 30 | layer.readTopology(topology); 31 | layer.generateNodePairs(); 32 | 33 | Logger sysLogger = new Logger(dataPath + "output/system/system_" + networkName + "_" + k + "_" + minRate + "_" + maxRate + ".log"); 34 | sysLogger.setLevel(Level.ERROR); 35 | 36 | Layer.searchKshortesPath(layer, k,Modulation.BPSK.getTransDistance()); 37 | 38 | double[] sumLength = new double[layer.getNodePairList().size()]; 39 | 40 | for(NodePair nodepair : layer.getNodePairList()) { 41 | sumLength[nodepair.getIndex()] = 0; 42 | for(Route route : nodepair.getRouteList()) { 43 | sumLength[nodepair.getIndex()] += route.getLength(); 44 | } 45 | } 46 | 47 | long time = System.currentTimeMillis(); 48 | // Part 2 Routing and Spectrum Allocation 49 | // TODO NOTE : 50 | System.out.println(">>Routing and Spectrum Allocation, the allocation information will be output to File(" + sysLogger.getName() + ") ..."); 51 | for(NodePair nodepair : layer.getNodePairList()){ 52 | int rate = xRandom.uniformRandom(minRate,maxRate,new Random()); 53 | nodepair.setRate(rate); 54 | Request request = new Request(nodepair, rate); 55 | 56 | boolean fail = false; 57 | 58 | ArrayList rolList = new ArrayList(); 59 | loop: 60 | for (Route route : nodepair.getRouteList()) { 61 | RoutingAndSpectrumAllocation rsa = new RoutingAndSpectrumAllocation(); 62 | 63 | double curRate = rate * nodepair.getRouteList().get(nodepair.getRouteList().size() - 1 - route.getIndex()).getLength()/sumLength[nodepair.getIndex()]; 64 | route.setRate(curRate); 65 | 66 | int rst = rsa.SpectrumAllocating_MinimalDiff(request, route); 67 | 68 | if(rst == 0) { 69 | for(Link link : route.getLinkList()) { 70 | ResourceOnLink rol = new ResourceOnLink(link,route.getStartIndex(),route.getSlots(),request); 71 | rolList.add(rol); 72 | link.spectrumOccupy(route.getStartIndex(), route.getSlots(), request); 73 | } 74 | } else { 75 | fail = true; 76 | break loop; 77 | } 78 | } 79 | 80 | if(fail) { 81 | //release all resource allocated before 82 | for(ResourceOnLink rol : rolList) { 83 | rol.getLink().spectrumRelease(rol.getStartIndex(), rol.getSlots(), request); 84 | } 85 | nodepair.getRouteList().clear(); 86 | } 87 | } 88 | time = System.currentTimeMillis() - time; 89 | System.out.println("Time-consuming(RSA) : " + time + " ms"); 90 | 91 | // Part 3 Availability Calculation 92 | // TODO NOTE : 93 | Logger rstLogger = new Logger(dataPath + "output/system/system_" + networkName + "_" + k + "_" + minRate + "_" + maxRate + ".log"); 94 | rstLogger.setLevel(Level.FATAL); 95 | System.out.println(">>Availability Calculation, the result will be output to File(" + rstLogger.getName() + ") ..."); 96 | outputResult_Availability(layer, null); 97 | 98 | outputResult_SpectrumAllocation(layer,rstLogger); 99 | 100 | for(Link link : layer.getLinkList()) { 101 | link.outputUnusedSlotSections(sysLogger); 102 | } 103 | 104 | Logger.logln("", null); 105 | } 106 | 107 | public void outputResult_Availability(Layer layer, Logger logger) { 108 | double totalEstablishedBandwidth = 0; 109 | double Bandwidth_AvaWeghit = 0; 110 | double average_unavailability = 0; 111 | 112 | for(NodePair nodepair : layer.getNodePairList()) { 113 | if(nodepair.getRouteList().size() != 0) { 114 | totalEstablishedBandwidth += nodepair.getRate(); 115 | Bandwidth_AvaWeghit += nodepair.getRate() * nodepair.getNodepairAvailVCAT(); 116 | } else { 117 | 118 | } 119 | } 120 | average_unavailability = (1 - Bandwidth_AvaWeghit / totalEstablishedBandwidth); 121 | Logger.logln("total Established Bandwidth : " + totalEstablishedBandwidth, logger); 122 | Logger.logln("Average network unavailability is " + average_unavailability, logger); 123 | } 124 | 125 | public void outputResult_SpectrumAllocation(Layer layer,Logger logger) { 126 | String format = "Route StartIndex EndIndex"; 127 | Logger.logln(format,logger); 128 | 129 | for(NodePair nodepair : layer.getNodePairList()) { 130 | if(nodepair.getRouteList().size() != 0) { 131 | for(Route route : nodepair.getRouteList()) { 132 | if(route.getSlots() > 0) { 133 | Route.outputRoute(route, logger); 134 | String msg = " " + route.getStartIndex() + " " + (route.getStartIndex() + route.getSlots() - 1); 135 | Logger.logln(msg,logger); 136 | } 137 | } 138 | } 139 | 140 | Logger.logln("",logger); 141 | } 142 | } 143 | } -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/eon/network/Route.java: -------------------------------------------------------------------------------- 1 | package eon.network; 2 | 3 | import java.util.ArrayList; 4 | 5 | import eon.general.Modulation; 6 | import eon.general.RouteType; 7 | import eon.general.object; 8 | import eon.network.Route; 9 | import work.utilities.Logger; 10 | 11 | /** 12 | * @restructured by vxFury 13 | * 14 | */ 15 | public class Route extends object { 16 | private Layer associatedLayer = null; 17 | private RouteType routeType = RouteType.Ordinary; 18 | 19 | private ArrayList nodelist = null; 20 | private ArrayList linklist = null; 21 | 22 | private ArrayList linkmask = null; 23 | 24 | private ArrayList slotsList = null; 25 | 26 | private double length = 0.0; 27 | private Modulation modulation = Modulation.UNARRIVAL; 28 | 29 | private double cost; 30 | private double rate = 0; 31 | 32 | private int startIndex; 33 | private int slots; 34 | 35 | public Route(Layer associatedLayer, String name, int index, String comments) { 36 | super(name, index, comments); 37 | this.associatedLayer = associatedLayer; 38 | nodelist = new ArrayList(); 39 | linklist = new ArrayList(); 40 | slotsList = new ArrayList(); 41 | 42 | initLinkMask(); 43 | } 44 | 45 | public Route(Layer associatedLayer, String name, int index, String comments, RouteType routeType) { 46 | super(name, index, comments); 47 | this.associatedLayer = associatedLayer; 48 | nodelist = new ArrayList(); 49 | linklist = new ArrayList(); 50 | slotsList = new ArrayList(); 51 | this.routeType = routeType; 52 | 53 | initLinkMask(); 54 | } 55 | 56 | public Route(Layer associatedLayer, String name, int index, String comments, ArrayList linklist) { 57 | super(name, index, comments); 58 | this.associatedLayer = associatedLayer; 59 | nodelist = new ArrayList(); 60 | slotsList = new ArrayList(); 61 | this.setLinkList(linklist); 62 | this.setSlots(0); 63 | 64 | initLinkMask(); 65 | } 66 | 67 | public void initLinkMask() { 68 | int llsize = associatedLayer.getLinkList().size(); 69 | int size = ((llsize >>> 5) + ((llsize & 0x1F) == 0 ? (0) : (1))); 70 | 71 | linkmask = new ArrayList(); 72 | 73 | for(int index = 0; index < size; index ++) { 74 | linkmask.add(0x0); 75 | } 76 | } 77 | 78 | public void addLink(Link link) { 79 | linklist.add(link); 80 | 81 | int index = link.getIndex() >>> 5; 82 | int offset = link.getIndex() & 0x1F; 83 | 84 | int status = linkmask.get(index); 85 | int check = 0x1 << offset; 86 | linkmask.set(index, status | check); 87 | } 88 | 89 | public void removeLink(Link link) { 90 | linklist.remove(link); 91 | 92 | int index = link.getIndex() >>> 5; 93 | int offset = link.getIndex() & 0x1F; 94 | 95 | int status = linkmask.get(index); 96 | int check = ~(0x1 << offset); 97 | linkmask.set(index, status & check); 98 | } 99 | 100 | public boolean containsLink(Link link) { 101 | int index = link.getIndex() >>> 5; 102 | int offset = link.getIndex() & 0x1F; 103 | return (linkmask.get(index) & (0x1 << offset)) != 0; 104 | } 105 | 106 | public Layer getAssociatedLayer() { 107 | return associatedLayer; 108 | } 109 | 110 | public void setAssociatedLayer(Layer associatedLayer) { 111 | this.associatedLayer = associatedLayer; 112 | } 113 | 114 | public RouteType getRouteType() { 115 | return routeType; 116 | } 117 | 118 | public void setRouteType(RouteType routeType) { 119 | this.routeType = routeType; 120 | } 121 | 122 | public void setLinkList(ArrayList linklist) { 123 | this.linklist = linklist; 124 | } 125 | 126 | public ArrayList getLinkList() { 127 | return linklist; 128 | } 129 | 130 | public void setNodeList(ArrayList nodelist) { 131 | this.nodelist = nodelist; 132 | } 133 | 134 | public ArrayList getNodeList() { 135 | return nodelist; 136 | } 137 | 138 | public double getRate() { 139 | return rate; 140 | } 141 | 142 | public void setRate(double rate) { 143 | this.rate = rate; 144 | } 145 | 146 | public void setSlots(int slotsnum) { 147 | this.slots = slotsnum; 148 | } 149 | 150 | public int getSlots() { 151 | return slots; 152 | } 153 | 154 | public void setSlotsList(ArrayList slotsList) { 155 | this.slotsList = slotsList; 156 | } 157 | 158 | public ArrayList getSlotsList() { 159 | return slotsList; 160 | } 161 | 162 | public void setStartIndex(int startindex) { 163 | this.startIndex = startindex; 164 | } 165 | 166 | public int getStartIndex() { 167 | return startIndex; 168 | } 169 | 170 | public Modulation autosetModulation() { 171 | Modulation mod = Modulation.UNARRIVAL; 172 | for (Modulation modulation : Modulation.values()) { 173 | if (this.length <= modulation.getTransDistance()) { 174 | mod = modulation; 175 | break; 176 | } 177 | } 178 | 179 | return mod; 180 | } 181 | 182 | public Modulation getModulation() { 183 | return modulation; 184 | } 185 | 186 | public void setModulation(Modulation modulation) { 187 | this.modulation = modulation; 188 | } 189 | 190 | public double getCost() { 191 | return cost; 192 | } 193 | 194 | public void setCost(double cost) { 195 | this.cost = cost; 196 | } 197 | 198 | public double getLength() { 199 | return length; 200 | } 201 | 202 | public void setLength(double length) { 203 | this.length = length; 204 | } 205 | 206 | public static void outputRoute(Route route, Logger logger) { 207 | int i = 1; 208 | for (Node node : route.getNodeList()) { 209 | if (i < route.getNodeList().size()) { 210 | Logger.log(node.getName() + "-",logger); 211 | } else { 212 | Logger.log(node.getName(),logger); 213 | } 214 | i++; 215 | } 216 | } 217 | 218 | // TODO : For availability calculation 219 | public double getAvailRouteSingle() { 220 | double availRouteSingle = 1.0; 221 | ArrayList linklist = this.getLinkList(); 222 | for (Link link : linklist) { 223 | availRouteSingle *= link.getAvailLinkSingle(); 224 | } 225 | return availRouteSingle; 226 | } 227 | 228 | public double getAvailRouteVCAT(NodePair nodepair) { 229 | ArrayList linklist = this.getLinkList(); 230 | double availRouteVCAT = 1.0; 231 | for (Link link : linklist) { 232 | availRouteVCAT *= link.getAvailLinkVCAT(nodepair, this); 233 | } 234 | 235 | return availRouteVCAT; 236 | } 237 | } 238 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/work/forAMPL/dataForAMPL.java: -------------------------------------------------------------------------------- 1 | package work.forAMPL; 2 | 3 | import java.util.ArrayList; 4 | 5 | import eon.network.Layer; 6 | import eon.network.Link; 7 | import eon.network.Node; 8 | import eon.network.NodePair; 9 | import eon.graph.RouteSearching; 10 | import eon.network.Route; 11 | import work.utilities.Logger; 12 | 13 | /** 14 | * @author vxFury 15 | * 16 | */ 17 | public class dataForAMPL { 18 | public void outputSetOfNodes(Layer layer, Logger logger) { 19 | Logger.logln("set Nodes :=", logger); 20 | for (Node node : layer.getNodeList()) { 21 | Logger.logln(node.getName(),logger); 22 | } 23 | Logger.logln(";\n",logger); 24 | } 25 | 26 | public void outputSetOfNodePairs(Layer layer, Logger logger) { 27 | Logger.logln("set NP :=",logger); 28 | for (NodePair nodepair : layer.getNodePairList()) { 29 | Logger.logln(nodepair.getName(),logger); 30 | } 31 | Logger.logln(";\n",logger); 32 | } 33 | 34 | public void outputSetOfLinks(Layer layer, Logger logger) { 35 | Logger.logln("set E :=",logger); 36 | for (Link link : layer.getLinkList()) { 37 | Logger.logln(link.getName(),logger); 38 | } 39 | Logger.logln(";\n",logger); 40 | } 41 | 42 | public void searchKshortesPath(Layer layer, int k) { 43 | for (NodePair nodepair : layer.getNodePairList()) { 44 | ArrayList routelist = new ArrayList(); 45 | 46 | RouteSearching workpathsearch = new RouteSearching(); 47 | workpathsearch.Kshortest(nodepair.getSrcNode(), nodepair.getDesNode(), layer, k, routelist); 48 | 49 | nodepair.setLeastWorkingHop(routelist.get(0).getLinkList().size()); 50 | nodepair.setLeastProtectionHop(routelist.get(1).getLinkList().size()); 51 | nodepair.setLeastHop(routelist.get(0).getLinkList().size()); 52 | nodepair.setRouteList(routelist); 53 | } 54 | } 55 | 56 | public void searchKshortesPath(Layer layer, int k,double lengthLimit) { 57 | for (NodePair nodepair : layer.getNodePairList()) { 58 | ArrayList routelist = new ArrayList(); 59 | 60 | RouteSearching workpathsearch = new RouteSearching(); 61 | workpathsearch.Kshortest(nodepair.getSrcNode(), nodepair.getDesNode(), layer, k, lengthLimit, routelist); 62 | 63 | nodepair.setLeastWorkingHop(routelist.get(0).getLinkList().size()); 64 | nodepair.setLeastProtectionHop(routelist.get(1).getLinkList().size()); 65 | nodepair.setLeastHop(routelist.get(0).getLinkList().size()); 66 | nodepair.setRouteList(routelist); 67 | } 68 | } 69 | 70 | public void outputRoute(Route route, Logger logger) { 71 | int i = 1; 72 | for (Node node : route.getNodeList()) { 73 | if (i < route.getNodeList().size()) { 74 | Logger.log(node.getName() + "-",logger); 75 | } else { 76 | Logger.log(node.getName(),logger); 77 | } 78 | i++; 79 | } 80 | } 81 | 82 | public void outputSetOfCandidateRoutes(Layer layer, Logger logger) { 83 | for (NodePair nodepair : layer.getNodePairList()) { 84 | Logger.logln("set R[" + nodepair.getName() + "] :=",logger); 85 | for (Route route : nodepair.getRouteList()) { 86 | outputRoute(route, logger); 87 | Logger.logln("",logger); 88 | } 89 | Logger.logln(";",logger); 90 | } 91 | Logger.logln("",logger); 92 | } 93 | 94 | public void outputSetOfTraversedLinks(Layer layer, Logger logger) { 95 | for (NodePair nodepair : layer.getNodePairList()) { 96 | for (Route route : nodepair.getRouteList()) { 97 | Logger.log("set TraversedLinks[" + nodepair.getName() + " ",logger); 98 | outputRoute(route, logger); 99 | Logger.logln("] :=",logger); 100 | 101 | for (Link link : route.getLinkList()) { 102 | Logger.logln(link.getName(),logger); 103 | } 104 | Logger.logln(";",logger); 105 | } 106 | } 107 | Logger.logln("",logger); 108 | } 109 | 110 | public void outputParamOfCapacityPerSlot(Layer layer, Logger logger) { 111 | Logger.logln("param Cap := ",logger); 112 | for(NodePair nodepair : layer.getNodePairList()) { 113 | for (Route route : nodepair.getRouteList()) { 114 | Logger.log(nodepair.getName() + " ",logger); 115 | outputRoute(route, logger); 116 | Logger.logln(" " + route.getModulation().getCapacity(),logger); 117 | } 118 | } 119 | Logger.logln(";\r\n",logger); 120 | } 121 | 122 | public void outputParamOfUnavailability(Layer layer,Logger logger) { 123 | Logger.logln("param uaR:= ",logger); 124 | for (NodePair nodepair : layer.getNodePairList()) { 125 | for (Route route : nodepair.getRouteList()) { 126 | Logger.log(nodepair.getName() + " ",logger); 127 | Route.outputRoute(route, logger); 128 | Logger.logln(" " + (1 - route.getAvailRouteSingle()),logger); 129 | } 130 | } 131 | Logger.logln(";\r\n",logger); 132 | } 133 | 134 | public boolean IsLinkToRoute(Route route, Link link) { 135 | boolean key = false; 136 | for (Link link_tmp : route.getLinkList()) { 137 | if (link_tmp.getName() == link.getName()) { 138 | key = true; 139 | break; 140 | } 141 | } 142 | 143 | return key; 144 | } 145 | 146 | public void outputParamOfDelta(Layer layer, Logger logger) { 147 | Logger.logln("param delta :=",logger); 148 | for (Link link : layer.getLinkList()) { 149 | for (NodePair nodepair : layer.getNodePairList()) { 150 | for (Route route : nodepair.getRouteList()) { 151 | Logger.log(link.getName() + " " + (nodepair.getName()) + " ",logger); 152 | outputRoute(route, logger); 153 | 154 | Logger.logln(" " + (IsLinkToRoute(route, link) ? (1) : (0)),logger); 155 | } 156 | } 157 | } 158 | Logger.logln(";\r\n",logger); 159 | } 160 | 161 | public void outputParamOfTrafficDemand(Layer layer, Logger logger) { 162 | Logger.logln("param TD :=",logger); 163 | for (NodePair nodepair : layer.getNodePairList()) { 164 | Logger.logln(nodepair.getName() + " " + nodepair.getRate(),logger); 165 | } 166 | Logger.logln(";\r\n",logger); 167 | } 168 | 169 | public int traverseCommonLink (Route route1,Route route2) { 170 | int rst = 0; 171 | 172 | for(Link link1 : route1.getLinkList()) { 173 | for(Link link2 : route2.getLinkList()) { 174 | if(link1.getName().compareTo(link2.getName()) == 0) { 175 | rst = 1; 176 | } 177 | } 178 | } 179 | 180 | return rst; 181 | } 182 | 183 | public int isLinkToRoutes(Link link,Route route1,Route route2) { 184 | int rst = 0; 185 | 186 | if(IsLinkToRoute(route1,link) && IsLinkToRoute(route2,link)) { 187 | rst = 1; 188 | } 189 | 190 | return rst; 191 | } 192 | 193 | public void outputParamOfIsLinkToRoutes(Layer layer,Logger logger) { 194 | Logger.logln("param IsLinkToRoutes :=",logger); 195 | for(Link link : layer.getLinkList()) { 196 | for(NodePair nodepair1 : layer.getNodePairList()) { 197 | for(Route route1 : nodepair1.getRouteList()) { 198 | for(NodePair nodepair2 : layer.getNodePairList()) { 199 | if(nodepair2.getName().compareTo(nodepair1.getName()) != 0) { 200 | for(Route route2 : nodepair2.getRouteList()) { 201 | String msg = link.getName() + " " + nodepair1.getName() + " "; 202 | Logger.log(msg,logger); 203 | outputRoute(route1,logger); 204 | msg = " " + nodepair2.getName() + " "; 205 | Logger.log(msg,logger); 206 | outputRoute(route2,logger); 207 | msg = " " + isLinkToRoutes(link,route1,route2); 208 | Logger.logln(msg,logger); 209 | } 210 | } 211 | } 212 | } 213 | } 214 | } 215 | Logger.logln(";\r\n",logger); 216 | } 217 | 218 | public void outputParamOfIsRouteShareLinks(Layer layer, Logger logger) { 219 | Logger.logln("param IsRouteShareLinks :=",logger); 220 | for(NodePair nodepair1 : layer.getNodePairList()) { 221 | for(Route route1 : nodepair1.getRouteList()) { 222 | for(NodePair nodepair2 : layer.getNodePairList()) { 223 | if(nodepair2.getName().compareTo(nodepair1.getName()) != 0) { 224 | for(Route route2 : nodepair2.getRouteList()) { 225 | String msg = nodepair1.getName() + " "; 226 | Logger.log(msg,logger); 227 | outputRoute(route1,logger); 228 | msg = " " + nodepair2.getName() + " "; 229 | Logger.log(msg,logger); 230 | outputRoute(route2,logger); 231 | msg = " " + traverseCommonLink(route1,route2); 232 | Logger.logln(msg,logger); 233 | } 234 | } 235 | } 236 | } 237 | } 238 | Logger.logln(";\r\n",logger); 239 | } 240 | } 241 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/eon/network/Link.java: -------------------------------------------------------------------------------- 1 | package eon.network; 2 | 3 | import java.util.ArrayList; 4 | 5 | import eon.general.Constant; 6 | import eon.general.bitProcess; 7 | import eon.general.object; 8 | import eon.spectrum.AdaptiveSlotSection; 9 | import eon.spectrum.FrequencySlot; 10 | import eon.spectrum.Request; 11 | import eon.spectrum.RoutingAndSpectrumAllocation; 12 | import work.utilities.Logger; 13 | 14 | /** 15 | * @restructured by vxFury 16 | * 17 | */ 18 | public class Link extends object { 19 | private Layer associatedLayer = null; 20 | private Node nodeA = null; // node A 21 | private Node nodeB = null; // node B 22 | private double length = 0; // physical distance 23 | private double cost = 0; // the cost of the link 24 | 25 | private int status = 0; // the visited status 26 | 27 | private ArrayList resourceList = null; 28 | 29 | private ArrayList slotList = null; 30 | 31 | public Link(String name, int index, String comments, Layer associatedLayer, Node nodeA, Node nodeB, double length, double cost) { 32 | super(name, index, comments); 33 | this.associatedLayer = associatedLayer; 34 | this.nodeA = nodeA; 35 | this.nodeB = nodeB; 36 | this.length = length; 37 | this.cost = cost; 38 | this.status = 0; 39 | 40 | resourceList = new ArrayList(); 41 | initResourceList(resourceList); 42 | 43 | slotList = new ArrayList(); 44 | initSlotList(slotList); 45 | } 46 | 47 | public Layer getAssociatedLayer() { 48 | return associatedLayer; 49 | } 50 | 51 | public void setAssociatedLayer(Layer associatedLayer) { 52 | this.associatedLayer = associatedLayer; 53 | } 54 | 55 | public Node getNodeA() { 56 | return nodeA; 57 | } 58 | 59 | public void setNodeA(Node nodeA) { 60 | this.nodeA = nodeA; 61 | } 62 | 63 | public Node getNodeB() { 64 | return nodeB; 65 | } 66 | 67 | public void setNodeB(Node nodeB) { 68 | this.nodeB = nodeB; 69 | } 70 | 71 | public double getLength() { 72 | return length; 73 | } 74 | 75 | public void setLength(double length) { 76 | this.length = length; 77 | } 78 | 79 | public double getCost() { 80 | return cost; 81 | } 82 | 83 | public void setCost(double cost) { 84 | this.cost = cost; 85 | } 86 | 87 | public int getStatus() { 88 | return status; 89 | } 90 | 91 | public void setStatus(int status) { 92 | this.status = status; 93 | } 94 | 95 | public ArrayList getResourceList() { 96 | return resourceList; 97 | } 98 | 99 | public void setResourceList(ArrayList resourceList) { 100 | this.resourceList = resourceList; 101 | } 102 | 103 | public ArrayList getSlotList() { 104 | return slotList; 105 | } 106 | 107 | public void setSlotList(ArrayList slotList) { 108 | this.slotList = slotList; 109 | } 110 | 111 | public void initSlotList(ArrayList slotList) { 112 | slotList.clear(); 113 | for (int i = 0; i < Constant.TotalSlotsNum; i++) { 114 | FrequencySlot slot = new FrequencySlot(i); 115 | slotList.add(i, slot); 116 | } 117 | } 118 | 119 | public void initResourceList(ArrayList slotSectionList) { 120 | int size = (Constant.TotalSlotsNum >>> 5) + (((Constant.TotalSlotsNum & 0x1F) == 0) ? (0) : (1)); 121 | 122 | for(int i = 0;i < size; i ++) { 123 | Integer element; 124 | if((i == size - 1) && ((Constant.TotalSlotsNum & 0x1F) != 0)) { 125 | int remain = Constant.TotalSlotsNum - ((size - 1) << 5); 126 | element = ((int) (Math.pow(2, remain) - 1)); 127 | 128 | slotSectionList.add(i, element); 129 | } else { 130 | element = 0xFFFFFFFF; 131 | slotSectionList.add(i, element); 132 | } 133 | } 134 | } 135 | 136 | public void set(int slotIndex) { 137 | int index = slotIndex >>> 5 + (((slotIndex & 0x1F) == 0) ? (0) : (1)); 138 | int offset = slotIndex & 0x1F; 139 | 140 | int check = this.resourceList.get(index) | (0x1 << offset); 141 | 142 | this.resourceList.set(index, check); 143 | } 144 | 145 | public void clear(int slotIndex) { 146 | int index = slotIndex >>> 5 + (((slotIndex & 0x1F) == 0) ? (0) : (1)); 147 | int offset = slotIndex & 0x1F; 148 | 149 | int check = this.resourceList.get(index) & (~(0x1 << offset)); 150 | 151 | this.resourceList.set(index, check); 152 | } 153 | 154 | public void spectrumCheck() { 155 | for(FrequencySlot slot : slotList) { 156 | if(slot.isShareable()) { 157 | if(slot.getRequestList().size() == 0) { 158 | slot.clearShareable(); 159 | set(slot.getIndex()); 160 | } else { 161 | clear(slot.getIndex()); 162 | } 163 | } 164 | } 165 | } 166 | 167 | public void spectrumRestore(int shareablity) { 168 | for(FrequencySlot slot : slotList) { 169 | if(slot.isShareable()) { 170 | if(slot.getRequestList().size() < shareablity) { 171 | set(slot.getIndex()); 172 | } else { 173 | clear(slot.getIndex()); 174 | } 175 | } 176 | } 177 | } 178 | 179 | public void spectrumOccupy_Shareable(int startIndex, int slots, Request request, int shareablity) { 180 | for(int i = startIndex; i < startIndex + slots;i ++) { 181 | FrequencySlot slot = this.slotList.get(i); 182 | slot.setShareable(); 183 | slot.getRequestList().add(request); 184 | 185 | if(slot.getRequestList().size() >= shareablity) { 186 | clear(i); 187 | } 188 | } 189 | } 190 | 191 | public void spectrumRelease_Shareable(int startIndex, int slots, Request request, int shareablity) { 192 | for(int i = startIndex; i < startIndex + slots;i ++) { 193 | FrequencySlot slot = this.slotList.get(i); 194 | slot.getRequestList().remove(request); 195 | 196 | if(slot.getRequestList().size() < shareablity) { 197 | set(i); 198 | } 199 | 200 | if(slot.getRequestList().size() == 0) { 201 | slot.clearShareable(); 202 | } 203 | } 204 | } 205 | 206 | public void spectrumOccupy(int startIndex, int slots, Request request) { 207 | int endIndexP = startIndex + slots; 208 | int offsetStart = startIndex & 0x1F; 209 | int indexStart = startIndex >>> 5; 210 | int offsetEnd = endIndexP & 0x1F; 211 | int indexEnd = endIndexP >>> 5; 212 | 213 | if(indexStart == indexEnd) { 214 | // resource required in the same Integer-Section 215 | Integer status = resourceList.get(indexStart); 216 | 217 | int check = ~(((0x1 << offsetStart) - 1) ^ ((0x01 << offsetEnd) - 1)); 218 | resourceList.set(indexStart, status & check); 219 | } else { 220 | Integer status = resourceList.get(indexStart); 221 | int check = (0x1 << offsetStart) - 1; 222 | resourceList.set(indexStart, status & check); 223 | 224 | for(int index = indexStart + 1; index < indexEnd; index ++) { 225 | resourceList.set(index, 0x0); 226 | } 227 | 228 | if(offsetEnd != 0) { 229 | status = resourceList.get(indexEnd); 230 | 231 | check = ~((0x1 << offsetEnd) - 1); 232 | 233 | resourceList.set(indexEnd, status & check); 234 | } 235 | } 236 | 237 | for(int i = startIndex; i < startIndex + slots;i ++) { 238 | this.slotList.get(i).getRequestList().add(request); 239 | } 240 | } 241 | 242 | public void spectrumRelease(int startIndex, int slots, Request request) { 243 | int endIndexP = startIndex + slots; 244 | int offsetStart = startIndex & 0x1F; 245 | int indexStart = startIndex >>> 5; 246 | int offsetEnd = endIndexP & 0x1F; 247 | int indexEnd = endIndexP >>> 5; 248 | 249 | if(indexStart == indexEnd) { 250 | // resource required in the same Integer-Section 251 | Integer status = resourceList.get(indexStart); 252 | 253 | int check = ((0x1 << offsetStart) - 1) ^ ((0x01 << offsetEnd) - 1); 254 | resourceList.set(indexStart, status | check); 255 | } else { 256 | Integer status = resourceList.get(indexStart); 257 | int check = ~((0x1 << offsetStart) - 1); 258 | resourceList.set(indexStart, status | check); 259 | 260 | for(int index = indexStart + 1; index < indexEnd; index ++) { 261 | resourceList.set(index, 0xFFFFFFFF); 262 | } 263 | 264 | if(offsetEnd != 0) { 265 | status = resourceList.get(indexEnd); 266 | 267 | check = (0x1 << offsetEnd) - 1; 268 | 269 | resourceList.set(indexEnd, status | check); 270 | } 271 | } 272 | 273 | for(int i = startIndex; i < startIndex + slots;i ++) { 274 | this.slotList.get(i).getRequestList().remove(request); 275 | } 276 | } 277 | 278 | public void outputUnusedSlotSections(Logger logger) { 279 | RoutingAndSpectrumAllocation rsa = new RoutingAndSpectrumAllocation(); 280 | ArrayList ats = rsa.getAdaptiveSlotSections(this.getResourceList(), 1); 281 | 282 | if(ats.size() > 0) { 283 | Logger.logln("Unused Slot Section(s) for link(" + this.getName() + ") :", logger); 284 | 285 | for(AdaptiveSlotSection ss : ats) { 286 | Logger.logln("" + ss.getStartIndex() + " ~ " + (ss.getStartIndex() + ss.getSlots() - 1),logger); 287 | } 288 | } else { 289 | Logger.logln("All Slots for link(" + this.getName() + ") were used.", logger); 290 | } 291 | 292 | int unused = 0; 293 | for(Integer ss : this.getResourceList()) { 294 | unused += bitProcess.bitCount_StaticTable(ss); 295 | } 296 | Logger.logln("Unused Slots for link(" + this.getName() + ") :" + unused,logger); 297 | } 298 | 299 | private static double MTTR = Constant.MTTR; 300 | private static double MTTF = Constant.MTTF; 301 | 302 | public double getAvailLinkSingle() { 303 | return MTTF / (MTTF + MTTR * this.getLength()); 304 | } 305 | 306 | public double getAvailLinkVCAT(NodePair nodepair, Route route){ 307 | double slotRemain = (double) (nodepair.getSlots() - route.getSlots()); 308 | double availLinkVCAT = (MTTF * nodepair.getSlots() + MTTR * this.getLength() * slotRemain) 309 | / ((MTTF + MTTR * this.getLength()) * nodepair.getSlots()); 310 | 311 | return availLinkVCAT; 312 | } 313 | } 314 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/eon/spectrum/RoutingAndSpectrumAllocation.java: -------------------------------------------------------------------------------- 1 | package eon.spectrum; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collections; 5 | import java.util.Comparator; 6 | 7 | import eon.general.Constant; 8 | import eon.general.Modulation; 9 | import eon.general.RouteType; 10 | import eon.graph.RouteSearching; 11 | import eon.graph.SearchConstraint; 12 | import eon.network.Layer; 13 | import eon.network.Link; 14 | import eon.network.Node; 15 | import eon.network.Route; 16 | 17 | /** 18 | * @author vxFury 19 | * 20 | */ 21 | public class RoutingAndSpectrumAllocation { 22 | public Route RoutingAndSpectrumAllocating_FirstFit(Layer layer ,ArrayList swpList, Request request,SearchConstraint constraint, int hoplimit, Modulation modulation,RouteType routeType) { 23 | Route newroute = null; 24 | 25 | loop: 26 | for (SlotWindow currentSWP : swpList) { 27 | int startindex = currentSWP.getStartIndex(); 28 | int endindex = currentSWP.getEndIndex(); 29 | 30 | if(currentSWP.getUnshareableRouteList().size() > 0) { 31 | for (Route route : currentSWP.getUnshareableRouteList()) { 32 | for (Link link : route.getLinkList()) { 33 | if (!currentSWP.getExcludedLinkList().contains(link)) { 34 | currentSWP.getExcludedLinkList().add(link); 35 | } 36 | } 37 | } 38 | } 39 | 40 | newroute = new Route(layer,"", 0, ""); 41 | Node srcnode = request.getNodePair().getSrcNode(); 42 | Node desnode = request.getNodePair().getDesNode(); 43 | 44 | SearchConstraint pathconstraint = new SearchConstraint(layer); 45 | pathconstraint.addAllLinks(currentSWP.getExcludedLinkList()); 46 | 47 | if(constraint != null) { 48 | // 3.exclude link(s) and node(s) included in the constraint 49 | if(constraint.__getExcludedLinkList().size() != 0) { 50 | for(Link link : constraint.__getExcludedLinkList()) { 51 | if(!pathconstraint.containsLink(link)) { 52 | pathconstraint.addLink(link); 53 | } 54 | } 55 | } 56 | if(constraint.getExcludedNodeList().size() != 0) { 57 | for(Node node : constraint.getExcludedNodeList()) { 58 | if(!pathconstraint.getExcludedNodeList().contains(node)) { 59 | pathconstraint.getExcludedNodeList().add(node); 60 | } 61 | } 62 | } 63 | } 64 | 65 | RouteSearching routesearch = new RouteSearching(); 66 | routesearch.Dijkstras(srcnode, desnode, layer, newroute, pathconstraint); 67 | 68 | if(newroute.getLinkList().size() != 0) { 69 | newroute.setRouteType(routeType); 70 | newroute.setStartIndex(startindex); 71 | newroute.setSlots(endindex + 1 - startindex); 72 | newroute.setModulation(modulation); 73 | 74 | if(hoplimit <= 0) { 75 | if (newroute.getLength() < modulation.getTransDistance()) { 76 | break loop; 77 | } 78 | } else { 79 | if(newroute.getLinkList().size() <= hoplimit) { 80 | if (newroute.getLength() < modulation.getTransDistance()) { 81 | break loop; 82 | } 83 | } 84 | } 85 | 86 | newroute = null; 87 | } else { 88 | newroute = null; 89 | } 90 | } 91 | 92 | return newroute; 93 | } 94 | 95 | public Route RoutingAndSpectrumAllocating(Layer layer, Request request, RouteType routeType, Modulation modulation, SearchConstraint constraint) { 96 | Route newroute = new Route(layer,"", 0, "", routeType); 97 | 98 | Node srcNode = request.getNodePair().getSrcNode(); 99 | 100 | int slots = (int) Math.ceil(request.getRequiredRate()/modulation.getCapacity()); 101 | 102 | ArrayList resourceListForSWP = new ArrayList(); 103 | 104 | int size = (Constant.TotalSlotsNum >>> 5) + (((Constant.TotalSlotsNum & 0x1F) == 0) ? (0) : (1)); 105 | 106 | for(int i = 0;i < size; i ++) { 107 | Integer resource = 0x0; 108 | 109 | for(Node adjNode : srcNode.getAdjacentNodeList()) { 110 | Link link = layer.findLink(srcNode, adjNode); 111 | 112 | if(!constraint.containsLink(link)) { 113 | resource |= link.getResourceList().get(i); 114 | } 115 | } 116 | 117 | resourceListForSWP.add(i,resource); 118 | } 119 | 120 | ArrayList atsList = getAdaptiveSlotSections(resourceListForSWP,slots); 121 | Collections.sort(atsList,new sortBySlots()); 122 | 123 | if(atsList.size() > 0) { 124 | ArrayList swpList = new ArrayList(); 125 | 126 | for(AdaptiveSlotSection ads : atsList) { 127 | SlotWindow sw = new SlotWindow("",atsList.size(),"",0,0); 128 | 129 | if(ads.getSlots() > slots) { 130 | for(int sI = ads.getStartIndex(); sI < ads.getStartIndex() + ads.getSlots() - slots + 1; sI ++) { 131 | sw.setStartIndex(sI); 132 | sw.setEndIndex(sI + slots - 1); 133 | swpList.add(sw); 134 | } 135 | } else { 136 | sw.setStartIndex(ads.getStartIndex()); 137 | sw.setEndIndex(ads.getStartIndex() + ads.getSlots() - 1); 138 | swpList.add(sw); 139 | } 140 | } 141 | 142 | newroute = RoutingAndSpectrumAllocating_FirstFit(layer, swpList, request, constraint, size, modulation, routeType); 143 | } else { 144 | newroute = null; 145 | } 146 | 147 | if(newroute.getLinkList().size() == 0) { 148 | newroute = null; 149 | } 150 | 151 | return newroute; 152 | } 153 | 154 | public int SpectrumAllocating_MinimalDiff(Request request,Route route) { 155 | int rst = -1; 156 | 157 | int slots = (int) Math.ceil(route.getRate()/route.getModulation().getCapacity()); 158 | route.setSlots(slots); 159 | 160 | ArrayList atsList = getAvailableAdaptiveSlotSectionStrips(route,slots); 161 | Collections.sort(atsList,new sortBySlots()); 162 | 163 | if(atsList.size() > 0) { 164 | rst = 0; 165 | 166 | route.setStartIndex(atsList.get(0).getStartIndex()); 167 | } 168 | 169 | return rst; 170 | } 171 | 172 | public int SpectrumAllocating_AdvancedMinDiff(Request request,Route route, int minFragmentSize) { 173 | int rst = -1; 174 | 175 | int slots = (int) Math.ceil(route.getRate()/route.getModulation().getCapacity()); 176 | route.setSlots(slots); 177 | 178 | ArrayList atsList = getAvailableAdaptiveSlotSectionStrips(route,slots); 179 | Collections.sort(atsList,new sortBySlots()); 180 | 181 | if(atsList.size() > 0) { 182 | rst = 0; 183 | 184 | for(AdaptiveSlotSection ss : atsList) { 185 | if(Math.abs(ss.getSlots() - slots) >= minFragmentSize) { 186 | route.setStartIndex(ss.getStartIndex()); 187 | break; 188 | } else { 189 | rst = -1; 190 | } 191 | } 192 | 193 | if(rst == -1) { 194 | rst = 0; 195 | 196 | route.setStartIndex(atsList.get(0).getStartIndex()); 197 | } 198 | } 199 | 200 | return rst; 201 | } 202 | 203 | public ArrayList getAvailableAdaptiveSlotSectionStrips(Route route,int minimalSlots) { 204 | ArrayList availableResourceList = new ArrayList(); 205 | 206 | if(minimalSlots <= 0) { 207 | minimalSlots = 1; 208 | } 209 | 210 | int size = (Constant.TotalSlotsNum >>> 5) + (((Constant.TotalSlotsNum & 0x1F) == 0) ? (0) : (1)); 211 | 212 | for(int i = 0;i < size; i ++) { 213 | Integer commonResource = 0xFFFFFFFF; 214 | for(Link link : route.getLinkList()) { 215 | commonResource &= link.getResourceList().get(i); 216 | } 217 | 218 | availableResourceList.add(i,commonResource); 219 | } 220 | 221 | return getAdaptiveSlotSections(availableResourceList, minimalSlots); 222 | } 223 | 224 | // Adaptive Slot-Section(s) 225 | public ArrayList getAdaptiveSlotSections(ArrayList resourceList, int minimalSlots) { 226 | ArrayList ats = new ArrayList(); 227 | 228 | if(minimalSlots <= 0) { 229 | minimalSlots = 1; 230 | } 231 | 232 | int size = resourceList.size(),index = 0; 233 | 234 | int offset = 0, bits = 0; 235 | for(Integer resource : resourceList) { 236 | for(int i = 0; i < 32; i ++) { 237 | if((resource & 0x1) != 0) { 238 | bits ++; 239 | } else { 240 | if(bits >= minimalSlots) { 241 | ats.add(new AdaptiveSlotSection(offset - bits,bits)); 242 | } 243 | bits = 0; 244 | } 245 | 246 | resource >>>= 1; 247 | offset ++; 248 | } 249 | 250 | index ++; 251 | 252 | if((index == size) && (bits >= minimalSlots)) { 253 | ats.add(new AdaptiveSlotSection(offset - bits,bits)); 254 | } 255 | } 256 | 257 | return ats; 258 | } 259 | 260 | public static int getBitsFlanked(ArrayList resourceList, int index, int range) { 261 | int bits = 0; 262 | 263 | if(range == 0) { 264 | return 0; 265 | } 266 | 267 | int min, max; 268 | 269 | if(range < 0) { 270 | min = Math.max(0, index + range); 271 | max = index - 1; 272 | 273 | for(int i = max;i >= min; i --) { 274 | int tmpIndex = i >>> 5; 275 | int tmpOffset = i & 0x1F; 276 | 277 | int check = 0x1 << tmpOffset; 278 | if((resourceList.get(tmpIndex) & check) != 0x0) { 279 | bits ++; 280 | } else { 281 | break; 282 | } 283 | } 284 | } else { 285 | min = index + 1; 286 | max = Math.min(Constant.TotalSlotsNum, index + range); 287 | 288 | for(int i = min;i <= max; i ++) { 289 | int tmpIndex = i >>> 5; 290 | int tmpOffset = i & 0x1F; 291 | 292 | int check = 0x1 << tmpOffset; 293 | if((resourceList.get(tmpIndex) & check) != 0x0) { 294 | bits ++; 295 | } else { 296 | break; 297 | } 298 | } 299 | } 300 | 301 | return bits; 302 | } 303 | } 304 | 305 | class sortBySlots implements Comparator { 306 | public int compare(Object obj1,Object obj2) { 307 | AdaptiveSlotSection ads1 = (AdaptiveSlotSection) obj1; 308 | AdaptiveSlotSection ads2 = (AdaptiveSlotSection) obj2; 309 | 310 | return (ads1.getSlots() - ads2.getSlots()); 311 | } 312 | } 313 | 314 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/eon/network/Layer.java: -------------------------------------------------------------------------------- 1 | package eon.network; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.File; 5 | import java.io.FileNotFoundException; 6 | import java.io.FileReader; 7 | import java.io.IOException; 8 | import java.util.ArrayList; 9 | import java.util.HashMap; 10 | import java.util.Iterator; 11 | import java.util.StringTokenizer; 12 | 13 | import eon.general.Constant; 14 | import eon.general.object; 15 | import eon.graph.RouteSearching; 16 | 17 | /** 18 | * @restructured by vxFury 19 | * 20 | */ 21 | public class Layer extends object { 22 | public static final String NodePairHyphen = "--"; 23 | public static final String LinkHyphen = "-"; 24 | 25 | private HashMap nodemap = null; 26 | private HashMap linkmap = null; 27 | private HashMap nodepairmap = null; 28 | 29 | private ArrayList nodelist = null; 30 | private ArrayList linklist = null; 31 | private ArrayList nodepairlist = null; 32 | 33 | public Layer(String name, int index, String comments) { 34 | super(name, index, comments); 35 | 36 | nodemap = new HashMap(); 37 | linkmap = new HashMap(); 38 | nodepairmap = new HashMap(); 39 | 40 | nodelist = new ArrayList(); 41 | linklist = new ArrayList(); 42 | nodepairlist = new ArrayList(); 43 | } 44 | 45 | public HashMap getNodeMap() { 46 | return nodemap; 47 | } 48 | 49 | public void setNodeMap(HashMap nodemap) { 50 | this.nodemap = nodemap; 51 | } 52 | 53 | public HashMap getLinkMap() { 54 | return linkmap; 55 | } 56 | 57 | public void setLinkMap(HashMap linkmap) { 58 | this.linkmap = linkmap; 59 | } 60 | 61 | public HashMap getNodepairMap() { 62 | return nodepairmap; 63 | } 64 | 65 | public void setNodepairMap(HashMap nodepairmap) { 66 | this.nodepairmap = nodepairmap; 67 | } 68 | 69 | public ArrayList getNodeList() { 70 | return nodelist; 71 | } 72 | 73 | public void setNodeList(ArrayList nodelist) { 74 | this.nodelist = nodelist; 75 | } 76 | 77 | public ArrayList getLinkList() { 78 | return linklist; 79 | } 80 | 81 | public void setLinkList(ArrayList linklist) { 82 | this.linklist = linklist; 83 | } 84 | 85 | public ArrayList getNodePairList() { 86 | return nodepairlist; 87 | } 88 | 89 | public void setNodePairList(ArrayList nodepairlist) { 90 | this.nodepairlist = nodepairlist; 91 | } 92 | 93 | public void addNode(Node node) { 94 | this.nodemap.put(node.getName(), node); 95 | this.nodelist.add(node); 96 | node.setAssociatedLayer(this); 97 | } 98 | 99 | public void removeNode(String nodename) { 100 | Node node = this.nodemap.get(nodename); 101 | node.setAssociatedLayer(null); 102 | String linkname = ""; 103 | for (int i = 0; i < node.getAdjacentNodeList().size(); i++) { 104 | Node nodeB = node.getAdjacentNodeList().get(i); 105 | if (node.getIndex() < nodeB.getIndex()) { 106 | linkname = node.getName() + Layer.LinkHyphen + nodeB.getName(); 107 | } else { 108 | linkname = nodeB.getName() + Layer.LinkHyphen + node.getName(); 109 | } 110 | this.linkmap.remove(linkname); 111 | this.linklist.remove(linkname); 112 | } 113 | this.nodemap.remove(nodename); 114 | this.nodelist.remove(nodename); 115 | } 116 | 117 | public void addLink(Link link) { 118 | this.linkmap.put(link.getName(), link); 119 | this.linklist.add(link); 120 | link.setAssociatedLayer(this); 121 | } 122 | 123 | public void removeLink(String linkname) { 124 | this.linkmap.get(linkname).setAssociatedLayer(null); 125 | this.linkmap.remove(linkname); 126 | this.linklist.remove(linkname); 127 | } 128 | 129 | public void addNodepair(NodePair nodepair) { 130 | this.nodepairmap.put(nodepair.getName(), nodepair); 131 | this.nodepairlist.add(nodepair); 132 | nodepair.setAssociatedLayer(this); 133 | } 134 | 135 | public void removeNodepair(String nodepairname) { 136 | this.nodepairmap.get(nodepairname).setAssociatedLayer(null); 137 | this.nodepairmap.remove(nodepairname); 138 | this.nodepairlist.remove(nodepairname); 139 | } 140 | 141 | public void copyNodes(Layer layer) { 142 | HashMap map = layer.getNodeMap(); 143 | Iterator iter1 = map.keySet().iterator(); 144 | while (iter1.hasNext()) { 145 | Node nodeA = (Node) (map.get(iter1.next())); 146 | Node nodeB = new Node(nodeA.getName(), nodeA.getIndex(), "", this, nodeA.getX(), nodeA.getY()); 147 | this.addNode(nodeB); 148 | } 149 | } 150 | 151 | public void generateNodePairs() { 152 | HashMap map = this.getNodeMap(); 153 | HashMap map2 = this.getNodeMap(); 154 | Iterator iter1 = map.keySet().iterator(); 155 | while (iter1.hasNext()) { 156 | Node node1 = (Node) (map.get(iter1.next())); 157 | Iterator iter2 = map2.keySet().iterator(); 158 | while (iter2.hasNext()) { 159 | Node node2 = (Node) (map.get(iter2.next())); 160 | if (!node1.equals(node2)) { 161 | if (node1.getIndex() < node2.getIndex()) { 162 | String name = node1.getName() + Layer.NodePairHyphen + node2.getName(); 163 | int index = this.nodepairmap.size(); 164 | NodePair nodepair = new NodePair(name, index, "", this, node1, node2); 165 | this.addNodepair(nodepair); 166 | } 167 | } 168 | } 169 | } 170 | } 171 | 172 | public Link findLink(Node nodeA, Node nodeB) { 173 | String name; 174 | if (nodeA.getIndex() < nodeB.getIndex()) { 175 | name = nodeA.getName() + Layer.LinkHyphen + nodeB.getName(); 176 | } else { 177 | name = nodeB.getName() + Layer.LinkHyphen + nodeA.getName(); 178 | } 179 | 180 | return this.getLinkMap().get(name); 181 | } 182 | 183 | public Node findNode(String nodeName, Layer layer) { 184 | HashMap map = layer.getNodeMap(); 185 | Iterator iter = map.keySet().iterator(); 186 | Node currentnode = null; 187 | while (iter.hasNext()) { 188 | currentnode = (Node) (map.get(iter.next())); 189 | if (currentnode.getName().endsWith(nodeName)) 190 | break; 191 | } 192 | return currentnode; 193 | } 194 | 195 | public NodePair findNodepair(String nodepairName) { 196 | HashMap map = this.getNodepairMap(); 197 | Iterator iter = map.keySet().iterator(); 198 | NodePair currentnodepair = null; 199 | while (iter.hasNext()) { 200 | currentnodepair = (NodePair) (map.get(iter.next())); 201 | if (currentnodepair.getName().endsWith(nodepairName)) 202 | break; 203 | } 204 | return currentnodepair; 205 | } 206 | 207 | public void clearCost() { 208 | HashMap map = this.getNodeMap(); 209 | Iterator iter = map.keySet().iterator(); 210 | while (iter.hasNext()) { 211 | Node node = (Node) (map.get(iter.next())); 212 | node.setCostFromSrc(Constant.MAXIUM); 213 | } 214 | } 215 | 216 | public void readTopology(String topologyFile) { 217 | String[] data = new String[10]; 218 | File file = new File(topologyFile); 219 | BufferedReader bufRdr = null; 220 | try { 221 | bufRdr = new BufferedReader(new FileReader(file)); 222 | } catch (FileNotFoundException e) { 223 | e.printStackTrace(); 224 | } 225 | String line = null; 226 | int col = 0; 227 | try { 228 | line = bufRdr.readLine(); 229 | } catch (IOException e) { 230 | e.printStackTrace(); 231 | } 232 | // read the first title line 233 | // read each line of text file 234 | try { 235 | boolean link = false; 236 | while ((line = bufRdr.readLine()) != null) { 237 | StringTokenizer st = new StringTokenizer(line, ","); 238 | while (st.hasMoreTokens()) { 239 | data[col] = st.nextToken(); 240 | col++; 241 | } 242 | col = 0; 243 | String name = data[0]; 244 | if (name.equals("Link")) { 245 | link = true; 246 | } 247 | // read nodes 248 | if (!link)// node operation 249 | { 250 | int x = Integer.parseInt(data[1]); 251 | int y = Integer.parseInt(data[2]); 252 | int index = this.getNodeMap().size(); 253 | Node newnode = new Node(name, index, "", this, x, y); 254 | this.addNode(newnode); 255 | } else { // link operation 256 | if (!(name.equals("Link"))) { 257 | Node nodeA = this.getNodeMap().get(data[1]); 258 | Node nodeB = this.getNodeMap().get(data[2]); 259 | double length = Double.parseDouble(data[3]); 260 | double cost = Double.parseDouble(data[4]); 261 | int index = this.getLinkMap().size(); 262 | 263 | if (nodeA.getIndex() < nodeB.getIndex()) { 264 | name = nodeA.getName() + Layer.LinkHyphen + nodeB.getName(); 265 | } else { 266 | name = nodeB.getName() + Layer.LinkHyphen + nodeA.getName(); 267 | } 268 | Link alink = new Link(name, index, "", this, nodeA, nodeB, length, cost); 269 | this.addLink(alink); 270 | 271 | // update the adjacent node list 272 | nodeA.addAdjacentNode(nodeB); 273 | nodeB.addAdjacentNode(nodeA); 274 | } 275 | } 276 | } 277 | } catch (IOException e) { 278 | e.printStackTrace(); 279 | } 280 | try { 281 | bufRdr.close(); 282 | } catch (IOException e) { 283 | e.printStackTrace(); 284 | } 285 | } 286 | 287 | public void copyLayer(Layer layer) { 288 | HashMap Copynodemap = new HashMap(); 289 | 290 | HashMap map = layer.getNodeMap(); 291 | Iterator iter = map.keySet().iterator(); 292 | while (iter.hasNext()) { 293 | Node node = (Node) (map.get(iter.next())); 294 | Copynodemap.put(node.getName(), node); 295 | 296 | } 297 | this.setNodeMap(Copynodemap); 298 | 299 | HashMap Copylinkmap = new HashMap(); 300 | HashMap mapLink = this.getLinkMap(); 301 | Iterator iterLink = mapLink.keySet().iterator(); 302 | 303 | while (iterLink.hasNext()) { 304 | Link link = (Link) (mapLink.get(iterLink.next())); 305 | 306 | Copylinkmap.put(link.getName(), link); 307 | } 308 | this.setLinkMap(Copylinkmap); 309 | } 310 | 311 | public static void searchKshortesPath(Layer layer, int k,double lengthLimit) { 312 | for (NodePair nodepair : layer.getNodePairList()) { 313 | ArrayList routelist = new ArrayList(); 314 | 315 | RouteSearching workpathsearch = new RouteSearching(); 316 | workpathsearch.Kshortest(nodepair.getSrcNode(), nodepair.getDesNode(), layer, k, lengthLimit, routelist); 317 | 318 | nodepair.setLeastWorkingHop(routelist.get(0).getLinkList().size()); 319 | nodepair.setLeastProtectionHop(routelist.get(1).getLinkList().size()); 320 | nodepair.setLeastHop(routelist.get(0).getLinkList().size()); 321 | nodepair.setRouteList(routelist); 322 | } 323 | } 324 | } 325 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/eon/graph/RouteSearching.java: -------------------------------------------------------------------------------- 1 | package eon.graph; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collections; 5 | import java.util.Comparator; 6 | import java.util.HashMap; 7 | import java.util.Iterator; 8 | import java.util.Stack; 9 | 10 | import eon.general.Constant; 11 | import eon.network.*; 12 | 13 | /** 14 | * @restructured by vxFury 15 | * 16 | */ 17 | public class RouteSearching { 18 | public void Dijkstras(Node srcNode, Node destNode, Layer layer, Route newRoute, SearchConstraint constraint) { 19 | ArrayList visitedNodeList = new ArrayList(); 20 | 21 | // initialize all the node states 22 | for(Node node : layer.getNodeList()) { 23 | node.setTimesVisited(0); 24 | node.setParentNode(null); 25 | node.setCostFromSrc(Constant.MAXIUM); 26 | node.setHopFromSrc(Constant.MAXIUM); 27 | } 28 | 29 | // Initialization 30 | Node currentNode = srcNode; 31 | currentNode.setCostFromSrc(0); 32 | currentNode.setHopFromSrc(0); 33 | currentNode.setTimesVisited(2); 34 | 35 | if (constraint == null) { 36 | for (Node node : currentNode.getAdjacentNodeList()) { 37 | if (node.getTimesVisited() == 0) { 38 | Link link = layer.findLink(currentNode, node); 39 | node.setLengthFromSrc(currentNode.getLengthFromSrc() + link.getLength()); 40 | node.setCostFromSrc(currentNode.getCostFromSrc() + link.getCost()); 41 | node.setHopFromSrc(currentNode.getHopFromSrc() + 1); 42 | node.setTimesVisited(1); 43 | node.setParentNode(currentNode); 44 | visitedNodeList.add(node); 45 | } 46 | } 47 | } else { 48 | for (Node node : currentNode.getAdjacentNodeList()) { 49 | if (!constraint.getExcludedNodeList().contains(node)) { 50 | if (node.getTimesVisited() == 0) { 51 | Link link = layer.findLink(currentNode, node); 52 | if (!constraint.containsLink(link)) { 53 | node.setLengthFromSrc(currentNode.getLengthFromSrc() + link.getLength()); 54 | node.setCostFromSrc(currentNode.getCostFromSrc() + link.getCost()); 55 | node.setHopFromSrc(currentNode.getHopFromSrc() + 1); 56 | node.setTimesVisited(1); 57 | node.setParentNode(currentNode); 58 | visitedNodeList.add(node); 59 | } 60 | } 61 | } 62 | } 63 | } 64 | 65 | // find the node with the lowest cost from the visited node list 66 | currentNode = this.getLowestCostNode(visitedNodeList); 67 | if (currentNode != null) { 68 | while (!currentNode.equals(destNode)) { 69 | // set the current node double visited 70 | currentNode.setTimesVisited(2); 71 | // remove the node from the visited node list 72 | visitedNodeList.remove(currentNode); 73 | 74 | // navigate the adjacentghboring nodes of the current node 75 | if (constraint == null) { 76 | for (Node node : currentNode.getAdjacentNodeList()) { 77 | if (node.getTimesVisited() == 0) { // if the adjacent node is not visited 78 | Link link = layer.findLink(currentNode, node); 79 | node.setLengthFromSrc(currentNode.getLengthFromSrc() + link.getLength()); 80 | node.setCostFromSrc(currentNode.getCostFromSrc() + link.getCost()); 81 | node.setHopFromSrc(currentNode.getHopFromSrc() + 1); 82 | node.setTimesVisited(1); 83 | node.setParentNode(currentNode); 84 | visitedNodeList.add(node); 85 | } else if (node.getTimesVisited() == 1) { // if the adjacent node is first visited 86 | Link link = layer.findLink(currentNode, node); 87 | if (node.getCostFromSrc() > currentNode.getCostFromSrc() + link.getCost()) { 88 | // update the node status 89 | node.setCostFromSrc(currentNode.getCostFromSrc() + link.getCost()); 90 | node.setParentNode(currentNode); 91 | } 92 | } 93 | } 94 | } else { 95 | for (Node node : currentNode.getAdjacentNodeList()) { 96 | if (!constraint.getExcludedNodeList().contains(node)) { 97 | if (node.getTimesVisited() == 0) { // if the adjacent node is not visited 98 | Link link = layer.findLink(currentNode, node); 99 | if (!constraint.containsLink(link)) { 100 | node.setCostFromSrc(currentNode.getCostFromSrc() + link.getCost()); 101 | node.setHopFromSrc(currentNode.getHopFromSrc() + 1); 102 | node.setTimesVisited(1); 103 | node.setParentNode(currentNode); 104 | visitedNodeList.add(node); 105 | } 106 | } else if (node.getTimesVisited() == 1) { // if the adjacent node is first visited 107 | String name; 108 | if (currentNode.getIndex() < node.getIndex()) { 109 | name = currentNode.getName() + "-" + node.getName(); 110 | } else { 111 | name = node.getName() + "-" + currentNode.getName(); 112 | } 113 | Link link = layer.getLinkMap().get(name); 114 | if (!constraint.containsLink(link)) { 115 | if (node.getCostFromSrc() > currentNode.getCostFromSrc() + link.getCost()) { 116 | // update the node status 117 | node.setCostFromSrc(currentNode.getCostFromSrc() + link.getCost()); 118 | node.setHopFromSrc(currentNode.getHopFromSrc() + 1); 119 | node.setParentNode(currentNode); 120 | } 121 | } 122 | } 123 | } 124 | } 125 | } 126 | 127 | // find the node with the lowest cost from the visited node list 128 | currentNode = this.getLowestCostNode(visitedNodeList); 129 | if (currentNode == null) { 130 | break; 131 | } 132 | } 133 | } 134 | // clear the route 135 | newRoute.getNodeList().clear(); 136 | newRoute.getLinkList().clear(); 137 | // add the visited nodes into the node list 138 | currentNode = destNode; 139 | if (destNode.getParentNode() != null) { 140 | newRoute.getNodeList().add(0, currentNode); 141 | newRoute.setCost(destNode.getCostFromSrc()); 142 | 143 | double length = 0; 144 | while (currentNode != srcNode) { 145 | Link link = layer.findLink(currentNode, currentNode.getParentNode()); 146 | newRoute.addLink(link); 147 | currentNode = currentNode.getParentNode(); 148 | newRoute.getNodeList().add(0, currentNode); 149 | length += link.getLength(); 150 | } 151 | newRoute.setLength(length); 152 | newRoute.setModulation(newRoute.autosetModulation()); 153 | } else { 154 | newRoute = null; 155 | } 156 | } 157 | 158 | public void Kshortest(Node srcNode, Node destNode, Layer layer, int k, ArrayList routelist) { 159 | routelist.clear(); 160 | SearchConstraint constraint = new SearchConstraint(layer); 161 | 162 | int num_found = 0; // number of found route 163 | while (true) { 164 | Route newRoute = new Route(layer,"", num_found, ""); 165 | this.Dijkstras(srcNode, destNode, layer, newRoute, constraint); 166 | if (newRoute.getLinkList().size() > 0) { 167 | routelist.add(newRoute); 168 | constraint.addAllLinks(newRoute.getLinkList()); 169 | num_found++; 170 | if (num_found == k) { 171 | break; 172 | } 173 | } else { 174 | break; 175 | } 176 | } 177 | } 178 | 179 | public void Kshortest(Node srcNode, Node destNode, Layer layer, int k, double lengthLimit, ArrayList routelist) { 180 | routelist.clear(); 181 | SearchConstraint constraint = new SearchConstraint(layer); 182 | 183 | int num_found = 0; // number of found route 184 | while (true) { 185 | Route newRoute = new Route(layer, "", num_found, ""); 186 | this.Dijkstras(srcNode, destNode, layer, newRoute, constraint); 187 | if (newRoute.getLinkList().size() > 0) { 188 | if (newRoute.getLength() <= lengthLimit) { 189 | routelist.add(newRoute); 190 | constraint.addAllLinks(newRoute.getLinkList()); 191 | num_found++; 192 | if (num_found == k) { 193 | break; 194 | } 195 | } 196 | } else { 197 | break; 198 | } 199 | } 200 | } 201 | 202 | // find a node from the visited node list that is closest to the src node 203 | private Node getLowestCostNode(ArrayList visitedNodeList) { 204 | Node currentnode = null; 205 | double current_cost_to_desc = 100000000; 206 | for (Node node : visitedNodeList) { 207 | if (node.getCostFromSrc() < current_cost_to_desc) { 208 | currentnode = node; 209 | current_cost_to_desc = node.getCostFromSrc(); 210 | } 211 | } 212 | return currentnode; 213 | } 214 | 215 | public Node getLowestCostNode(Layer layer) { 216 | Node currentnode = null; 217 | double current_cost_to_desc = Constant.MAXIUM; 218 | HashMap map = layer.getNodeMap(); 219 | Iterator iter = map.keySet().iterator(); 220 | while (iter.hasNext()) { 221 | Node node = (Node) (map.get(iter.next())); 222 | if (node.getTimesVisited() == 0) { 223 | if (node.getCostFromSrc() < current_cost_to_desc) { 224 | currentnode = node; 225 | current_cost_to_desc = node.getCostFromSrc(); 226 | } 227 | } 228 | } 229 | if (currentnode != null) 230 | currentnode.setTimesVisited(1); 231 | return currentnode; 232 | } 233 | 234 | public static boolean searchRoutes(Node curNode, Node prevNode, Node srcNode, Node desNode, SearchConstraint constraint, int hoplimit, double lengthLimit, Layer layer, Stack stack, ArrayList routeList) { 235 | Node nxtNode = null; 236 | 237 | if (curNode != null && prevNode != null ) { 238 | if(curNode == prevNode) { 239 | return false; 240 | } else { 241 | if(constraint != null) { 242 | Link link = layer.findLink(prevNode, curNode); 243 | if(constraint.containsLink(link)) { 244 | return false; 245 | } 246 | } 247 | } 248 | } 249 | 250 | if (curNode != null) { 251 | int i = 0; 252 | 253 | if(stack.size() >= hoplimit) { 254 | return false; 255 | } 256 | 257 | stack.push(curNode); 258 | 259 | if (curNode == desNode) { 260 | Route route = new Route(layer,"",routeList.size(),""); 261 | int size = stack.size(); 262 | double length = 0,cost = 0; 263 | for(int j = 0;j < size;j ++) { 264 | route.getNodeList().add(stack.get(j)); 265 | 266 | Link link = null; 267 | if(j != 0) { 268 | link = layer.findLink(stack.get(j - 1), stack.get(j)); 269 | 270 | route.addLink(link); 271 | length += link.getLength(); 272 | cost += link.getCost(); 273 | 274 | stack.get(j).setCostFromSrc(stack.get(j - 1).getCostFromSrc() + link.getCost()); 275 | } 276 | } 277 | 278 | if(length <= lengthLimit) { 279 | route.setLength(length); 280 | route.setCost(cost); 281 | route.setModulation(route.autosetModulation()); 282 | routeList.add(route); 283 | return true; 284 | } else { 285 | return false; 286 | } 287 | } else { 288 | nxtNode = curNode.getAdjacentNodeList().get(i); 289 | while (nxtNode != null) { 290 | if (prevNode != null && (nxtNode == srcNode || nxtNode == prevNode || stack.contains(nxtNode))) { 291 | i ++; 292 | if (i >= curNode.getAdjacentNodeList().size()) { 293 | nxtNode = null; 294 | } else { 295 | nxtNode = curNode.getAdjacentNodeList().get(i); 296 | } 297 | continue; 298 | } 299 | 300 | if (searchRoutes(nxtNode, curNode, srcNode, desNode, constraint, hoplimit, lengthLimit, layer, stack, routeList)) { 301 | stack.pop(); 302 | } 303 | 304 | i ++; 305 | if (i >= curNode.getAdjacentNodeList().size()) { 306 | nxtNode = null; 307 | } else { 308 | nxtNode = curNode.getAdjacentNodeList().get(i); 309 | } 310 | } 311 | 312 | stack.pop(); 313 | return false; 314 | } 315 | } else { 316 | return false; 317 | } 318 | } 319 | 320 | public void searchAllRoutes(Node srcNode, Node desNode, Layer layer,SearchConstraint constraint, int hoplimit, double lengthLimit, ArrayList routeList) { 321 | Stack stack = new Stack(); 322 | 323 | searchRoutes(srcNode, null, srcNode, desNode, constraint, hoplimit, lengthLimit, layer, stack, routeList); 324 | 325 | Collections.sort(routeList,new sortByLength()); 326 | } 327 | } 328 | 329 | class sortByLength implements Comparator { 330 | public int compare(Object obj1,Object obj2) { 331 | Route route1 = (Route) obj1; 332 | Route route2 = (Route) obj2; 333 | 334 | return (int) (route1.getLength() - route2.getLength()); 335 | } 336 | } 337 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/work/PathMN/HeuProtectionPathM1.java: -------------------------------------------------------------------------------- 1 | package work.PathMN; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Random; 5 | 6 | import eon.network.Layer; 7 | import eon.network.Link; 8 | import eon.network.NodePair; 9 | import eon.general.Modulation; 10 | import eon.general.RouteType; 11 | import eon.general.xRandom; 12 | import eon.graph.RouteSearching; 13 | import eon.graph.SearchConstraint; 14 | import eon.spectrum.Request; 15 | import eon.spectrum.RoutingAndSpectrumAllocation; 16 | import eon.network.Route; 17 | import work.utilities.Logger; 18 | import work.utilities.Logger.Level; 19 | 20 | /** 21 | * @author vxFury 22 | * 23 | */ 24 | public class HeuProtectionPathM1 { 25 | public void availabilityEnhancing_ProtectionPathM1_MD(String dataPath, String networkName, int M, int minRate, int maxRate) { 26 | // Part 1 Data Preparation 27 | // TODO NOTE : 28 | Layer layer = new Layer("workLayer", 0, ""); 29 | String topology = dataPath + "topology/" + networkName + ".csv"; 30 | System.out.print(">>Importing Topology of Network(" + topology + ") ...\n"); 31 | layer.readTopology(topology); 32 | layer.generateNodePairs(); 33 | 34 | Logger sysLogger = new Logger(dataPath + "output/system/system_" + networkName + ".log"); 35 | sysLogger.setLevel(Level.FATAL); 36 | 37 | // Part 2 Routing and Spectrum Allocation 38 | // TODO NOTE : 39 | System.out.println(">>Routing and Spectrum Allocation, the allocation information will be output to File(" + sysLogger.getName() + ") ..."); 40 | long time = System.currentTimeMillis(); 41 | for (NodePair nodepair : layer.getNodePairList()) { 42 | int rate = xRandom.uniformRandom(minRate,maxRate,new Random()); 43 | Request req = new Request(nodepair, rate); 44 | nodepair.setRate(rate); 45 | 46 | RouteSearching rs = new RouteSearching(); 47 | 48 | Route route = new Route(layer,"",0,""); 49 | rs.Dijkstras(nodepair.getSrcNode(), nodepair.getDesNode(), layer, route, null); 50 | 51 | RoutingAndSpectrumAllocation rsa = new RoutingAndSpectrumAllocation(); 52 | route.setRate(rate); 53 | route.setRouteType(RouteType.Working); 54 | if(rsa.SpectrumAllocating_MinimalDiff(req, route) == 0) { 55 | req.getRouteList().add(route); 56 | nodepair.getRouteList().add(route); 57 | 58 | for(Link link : route.getLinkList()) { 59 | link.spectrumOccupy(route.getStartIndex(), route.getSlots(), req); 60 | } 61 | } else { 62 | ArrayList routeList = new ArrayList(); 63 | rs.searchAllRoutes(nodepair.getSrcNode(), nodepair.getDesNode(), layer, null, 5, Modulation.BPSK.getTransDistance(), routeList); 64 | 65 | for(Route tmpRoute : routeList) { 66 | tmpRoute.setRate(rate); 67 | tmpRoute.setRouteType(RouteType.Working); 68 | 69 | if(rsa.SpectrumAllocating_MinimalDiff(req, route) == 0) { 70 | req.getRouteList().add(tmpRoute); 71 | nodepair.getRouteList().add(tmpRoute); 72 | 73 | for(Link link : tmpRoute.getLinkList()) { 74 | link.spectrumOccupy(tmpRoute.getStartIndex(), tmpRoute.getSlots(), req); 75 | } 76 | 77 | break; 78 | } 79 | } 80 | } 81 | } 82 | 83 | 84 | for(int t =0 ; t < M; t ++) { 85 | for (NodePair nodepair : layer.getNodePairList()) { 86 | boolean wp = false; 87 | 88 | SearchConstraint constraint = new SearchConstraint(layer); 89 | 90 | if(nodepair.getRouteList().size() > 0) { 91 | wp = true; 92 | 93 | for(Route route : nodepair.getRouteList()) { 94 | for(Link link : route.getLinkList()) { 95 | if(! constraint.containsLink(link)) { 96 | constraint.addLink(link); 97 | } 98 | } 99 | } 100 | } 101 | 102 | if (wp == true) { 103 | int rate = (int) nodepair.getRate(); 104 | Request req = new Request(nodepair, rate); 105 | 106 | ArrayList routeList = new ArrayList(); 107 | 108 | RouteSearching rs = new RouteSearching(); 109 | 110 | rs.searchAllRoutes(nodepair.getSrcNode(), nodepair.getDesNode(), layer, constraint, 7, Modulation.BPSK.getTransDistance(), routeList); 111 | 112 | if(routeList.size() > 0) { 113 | for(Route route : routeList) { 114 | RoutingAndSpectrumAllocation rsa = new RoutingAndSpectrumAllocation(); 115 | 116 | route.setRate(rate); 117 | route.setRouteType(RouteType.Protection); 118 | 119 | if(rsa.SpectrumAllocating_MinimalDiff(req, route) == 0) { 120 | req.getRouteList().add(route); 121 | nodepair.getRouteList().add(route); 122 | 123 | for(Link link : route.getLinkList()) { 124 | link.spectrumOccupy(route.getStartIndex(), route.getSlots(), req); 125 | } 126 | 127 | break; 128 | } 129 | } 130 | } 131 | } 132 | } 133 | } 134 | time = System.currentTimeMillis() - time; 135 | System.out.println("Time-consuming(RSA) : " + time + " ms"); 136 | 137 | // Part 3 Availability Calculation 138 | // TODO NOTE : 139 | Logger rstLogger = new Logger(dataPath + "output/result/result_" + networkName + ".txt"); 140 | rstLogger.setLevel(Level.FATAL); 141 | System.out.println(">>Availability Calculation, the result will be output to File(" + rstLogger.getName() + ") ..."); 142 | outputResult_Availability(layer,rstLogger); 143 | 144 | Logger cmpLogger = new Logger(dataPath + "output/result/cmp_" + networkName + "_" + M + "_" + 1 + ".txt"); 145 | cmpLogger.setLevel(Level.FATAL); 146 | outputResult_SpectrumAllocation(layer,cmpLogger); 147 | 148 | // for(Link link : layer.getLinkList()) { 149 | // link.outputUnusedSlotSections(sysLogger); 150 | // } 151 | 152 | Logger.logln("", null); 153 | } 154 | 155 | public void availabilityEnhancing_ProtectionPathM1_AMD(String dataPath, String networkName, int M, int minRate, int maxRate) { 156 | // Part 1 Data Preparation 157 | // TODO NOTE : 158 | Layer layer = new Layer("workLayer", 0, ""); 159 | String topology = dataPath + "topology/" + networkName + ".csv"; 160 | System.out.print(">>Importing Topology of Network(" + topology + ") ...\n"); 161 | layer.readTopology(topology); 162 | layer.generateNodePairs(); 163 | 164 | int minFragment = (int) Math.ceil(minRate/Modulation.BPSK.getCapacity()); 165 | 166 | Logger sysLogger = new Logger(dataPath + "output/system/system_" + networkName + ".log"); 167 | sysLogger.setLevel(Level.FATAL); 168 | 169 | // Part 2 Routing and Spectrum Allocation 170 | // TODO NOTE : 171 | System.out.println(">>Routing and Spectrum Allocation, the allocation information will be output to File(" + sysLogger.getName() + ") ..."); 172 | long time = System.currentTimeMillis(); 173 | for (NodePair nodepair : layer.getNodePairList()) { 174 | int rate = xRandom.uniformRandom(minRate,maxRate,new Random()); 175 | Request req = new Request(nodepair, rate); 176 | nodepair.setRate(rate); 177 | 178 | RouteSearching rs = new RouteSearching(); 179 | 180 | Route route = new Route(layer,"",0,""); 181 | rs.Dijkstras(nodepair.getSrcNode(), nodepair.getDesNode(), layer, route, null); 182 | 183 | RoutingAndSpectrumAllocation rsa = new RoutingAndSpectrumAllocation(); 184 | route.setRate(rate); 185 | route.setRouteType(RouteType.Working); 186 | if(rsa.SpectrumAllocating_AdvancedMinDiff(req, route,minFragment) == 0) { 187 | req.getRouteList().add(route); 188 | nodepair.getRouteList().add(route); 189 | 190 | for(Link link : route.getLinkList()) { 191 | link.spectrumOccupy(route.getStartIndex(), route.getSlots(), req); 192 | } 193 | } else { 194 | ArrayList routeList = new ArrayList(); 195 | rs.searchAllRoutes(nodepair.getSrcNode(), nodepair.getDesNode(), layer, null, layer.getNodeList().size(), Modulation.BPSK.getTransDistance(), routeList); 196 | 197 | for(Route tmpRoute : routeList) { 198 | tmpRoute.setRate(rate); 199 | tmpRoute.setRouteType(RouteType.Working); 200 | 201 | if(rsa.SpectrumAllocating_AdvancedMinDiff(req, route,minFragment) == 0) { 202 | req.getRouteList().add(tmpRoute); 203 | nodepair.getRouteList().add(tmpRoute); 204 | 205 | for(Link link : tmpRoute.getLinkList()) { 206 | link.spectrumOccupy(tmpRoute.getStartIndex(), tmpRoute.getSlots(), req); 207 | } 208 | 209 | break; 210 | } 211 | } 212 | } 213 | } 214 | 215 | 216 | for(int t =0 ; t < M; t ++) { 217 | for (NodePair nodepair : layer.getNodePairList()) { 218 | boolean wp = false; 219 | 220 | SearchConstraint constraint = new SearchConstraint(layer); 221 | 222 | if(nodepair.getRouteList().size() > 0) { 223 | wp = true; 224 | 225 | for(Route route : nodepair.getRouteList()) { 226 | for(Link link : route.getLinkList()) { 227 | if(! constraint.containsLink(link)) { 228 | constraint.addLink(link); 229 | } 230 | } 231 | } 232 | } 233 | 234 | if (wp == true) { 235 | int rate = (int) nodepair.getRate(); 236 | Request req = new Request(nodepair, rate); 237 | 238 | ArrayList routeList = new ArrayList(); 239 | 240 | RouteSearching rs = new RouteSearching(); 241 | 242 | rs.searchAllRoutes(nodepair.getSrcNode(), nodepair.getDesNode(), layer, constraint, layer.getNodeList().size(), Modulation.BPSK.getTransDistance(), routeList); 243 | 244 | if(routeList.size() > 0) { 245 | for(Route route : routeList) { 246 | RoutingAndSpectrumAllocation rsa = new RoutingAndSpectrumAllocation(); 247 | 248 | route.setRate(rate); 249 | route.setRouteType(RouteType.Protection); 250 | 251 | if(rsa.SpectrumAllocating_AdvancedMinDiff(req, route,minFragment) == 0) { 252 | req.getRouteList().add(route); 253 | nodepair.getRouteList().add(route); 254 | 255 | for(Link link : route.getLinkList()) { 256 | link.spectrumOccupy(route.getStartIndex(), route.getSlots(), req); 257 | } 258 | 259 | break; 260 | } 261 | } 262 | } 263 | } 264 | } 265 | } 266 | time = System.currentTimeMillis() - time; 267 | System.out.println("Time-consuming(RSA) : " + time + " ms"); 268 | 269 | // Part 3 Availability Calculation 270 | // TODO NOTE : 271 | Logger rstLogger = new Logger(dataPath + "output/result/result_" + networkName + ".txt"); 272 | rstLogger.setLevel(Level.FATAL); 273 | System.out.println(">>Availability Calculation, the result will be output to File(" + rstLogger.getName() + ") ..."); 274 | outputResult_Availability(layer,rstLogger); 275 | 276 | Logger cmpLogger = new Logger(dataPath + "output/result/cmp_" + networkName + "_" + M + "_" + 1 + ".txt"); 277 | cmpLogger.setLevel(Level.FATAL); 278 | outputResult_SpectrumAllocation(layer,cmpLogger); 279 | 280 | for(Link link : layer.getLinkList()) { 281 | link.outputUnusedSlotSections(sysLogger); 282 | } 283 | 284 | Logger.logln("", null); 285 | } 286 | 287 | public void outputResult_SpectrumAllocation(Layer layer,Logger logger) { 288 | String format = "Route StartIndex EndIndex"; 289 | Logger.logln(format,logger); 290 | 291 | for(NodePair nodepair : layer.getNodePairList()) { 292 | if(nodepair.getRouteList().size() != 0) { 293 | for(Route route : nodepair.getRouteList()) { 294 | Route.outputRoute(route, logger); 295 | String msg = " " + route.getStartIndex() + " " + (route.getStartIndex() + route.getSlots() - 1); 296 | Logger.logln(msg,logger); 297 | } 298 | 299 | Logger.logln("",logger); 300 | } 301 | } 302 | } 303 | 304 | public void outputResult_Availability(Layer layer, Logger logger) { 305 | double[] unava = new double[layer.getNodePairList().size()]; 306 | for (NodePair nodepair : layer.getNodePairList()) { 307 | if (nodepair.getRouteList().size() != 0) { 308 | unava[nodepair.getIndex()] = 1; 309 | for (Route route : nodepair.getRouteList()) { 310 | unava[nodepair.getIndex()] *= 1 - route.getAvailRouteSingle(); 311 | } 312 | } 313 | } 314 | 315 | double awBand = 0.0; 316 | double establishedBand = 0.0; 317 | double blockedBand = 0.0; 318 | 319 | for (NodePair nodepair : layer.getNodePairList()) { 320 | boolean est = nodepair.getRouteList().size() > 0; 321 | 322 | if(est) { 323 | awBand += nodepair.getRate() * (1 - unava[nodepair.getIndex()]); 324 | establishedBand += nodepair.getRate(); 325 | } else { 326 | blockedBand += nodepair.getRate(); 327 | } 328 | } 329 | 330 | Logger.logln("" + (1 - awBand / establishedBand) + " " + establishedBand + " " + awBand + " " + blockedBand,logger); 331 | 332 | Logger.logln("Unavailability : " + (1 - awBand / establishedBand),null); 333 | } 334 | } 335 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/work/SBPP/HeuProtectionSBPP.java: -------------------------------------------------------------------------------- 1 | package work.SBPP; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Random; 5 | 6 | import eon.network.Layer; 7 | import eon.network.Link; 8 | import eon.network.NodePair; 9 | import eon.general.Modulation; 10 | import eon.general.RouteType; 11 | import eon.general.xRandom; 12 | import eon.graph.RouteSearching; 13 | import eon.graph.SearchConstraint; 14 | import eon.spectrum.Request; 15 | import eon.spectrum.RoutingAndSpectrumAllocation; 16 | import eon.network.Route; 17 | import work.forAMPL.dataForAMPL; 18 | import work.utilities.Logger; 19 | import work.utilities.Logger.Level; 20 | 21 | /** 22 | * @author vxFury 23 | * 24 | */ 25 | public class HeuProtectionSBPP { 26 | public static ArrayList arrivedRequestList = new ArrayList(); 27 | 28 | public void availabilityEnhancing_ProtectionSBPP_MD(String dataPath, String networkName, int minRate, int maxRate) { 29 | // Part 1 Data Preparation 30 | // TODO NOTE : 31 | Layer layer = new Layer("workLayer", 0, ""); 32 | String topology = dataPath + "topology/" + networkName + ".csv"; 33 | System.out.print(">>Importing Topology of Network(" + topology + ") ...\n"); 34 | layer.readTopology(topology); 35 | layer.generateNodePairs(); 36 | 37 | Logger sysLogger = new Logger(dataPath + "output/system/system_" + networkName + ".log"); 38 | if(sysLogger != null) { 39 | sysLogger.setLevel(Level.DEBUG); 40 | } 41 | 42 | // Part 2 Routing and Spectrum Allocation 43 | // TODO NOTE : 44 | System.out.println(">>Routing and Spectrum Allocation, the allocation information will be output to File(" + sysLogger.getName() + ") ..."); 45 | long time = System.currentTimeMillis(); 46 | for (NodePair nodepair : layer.getNodePairList()) { 47 | int rate = xRandom.uniformRandom(minRate,maxRate,new Random()); 48 | Request req = new Request(nodepair, rate); 49 | nodepair.setRate(rate); 50 | 51 | boolean wp = false,pp = false; 52 | 53 | RouteSearching rs = new RouteSearching(); 54 | 55 | RoutingAndSpectrumAllocation rsa = new RoutingAndSpectrumAllocation(); 56 | 57 | ArrayList routeList = new ArrayList(); 58 | routeList.clear(); 59 | rs.searchAllRoutes(nodepair.getSrcNode(), nodepair.getDesNode(), layer, null, 6, Modulation.BPSK.getTransDistance(), routeList); 60 | 61 | for(Link link : layer.getLinkList()) { 62 | link.spectrumCheck(); 63 | //link.outputUnusedSlotSections(null); 64 | } 65 | 66 | for(Route tmpRoute : routeList) { 67 | tmpRoute.setRate(rate); 68 | tmpRoute.setRouteType(RouteType.Working); 69 | 70 | if(rsa.SpectrumAllocating_MinimalDiff(req, tmpRoute) == 0) { 71 | wp = true; 72 | 73 | req.getRouteList().add(tmpRoute); 74 | nodepair.getRouteList().add(tmpRoute); 75 | 76 | break; 77 | } 78 | } 79 | 80 | for(Link link : layer.getLinkList()) { 81 | link.spectrumRestore(20); 82 | } 83 | 84 | if(wp) { 85 | SearchConstraint constraint = new SearchConstraint(layer); 86 | constraint.addAllLinks(req.getRouteList().get(0).getLinkList()); 87 | 88 | routeList.clear(); 89 | 90 | rs.searchAllRoutes(nodepair.getSrcNode(), nodepair.getDesNode(), layer, constraint, 10, Modulation.BPSK.getTransDistance(), routeList); 91 | 92 | for(Route tmpRoute : routeList) { 93 | tmpRoute.setRate(rate); 94 | tmpRoute.setRouteType(RouteType.Protection); 95 | 96 | if(rsa.SpectrumAllocating_MinimalDiff(req, tmpRoute) == 0) { 97 | pp = true; 98 | 99 | req.getRouteList().add(tmpRoute); 100 | nodepair.getRouteList().add(tmpRoute); 101 | 102 | break; 103 | } 104 | } 105 | 106 | if(wp && pp) { 107 | for(Link link : req.getRouteList().get(0).getLinkList()) { 108 | link.spectrumOccupy(req.getRouteList().get(0).getStartIndex(), req.getRouteList().get(0).getSlots(), req); 109 | } 110 | 111 | for(Link link : req.getRouteList().get(1).getLinkList()) { 112 | link.spectrumOccupy_Shareable(req.getRouteList().get(1).getStartIndex(), req.getRouteList().get(1).getSlots(), req, 20); 113 | } 114 | } else { 115 | nodepair.getRouteList().clear(); 116 | } 117 | } 118 | } 119 | time = System.currentTimeMillis() - time; 120 | System.out.println("Time-consuming(RSA) : " + time + " ms"); 121 | 122 | // Part 3 Availability Calculation 123 | // TODO NOTE : 124 | Logger rstLogger = new Logger(dataPath + "output/result/result_" + networkName + ".txt"); 125 | if(rstLogger != null) { 126 | rstLogger.setLevel(Level.FATAL); 127 | } 128 | System.out.println(">>Output the result to File(" + rstLogger.getName() + ") ..."); 129 | outResult_Availability(layer,rstLogger); 130 | Logger cmpLogger = new Logger(dataPath + "output/result/cmp_" + networkName + ".txt"); 131 | if(cmpLogger != null) { 132 | cmpLogger.setLevel(Level.FATAL); 133 | } 134 | outputResult_SpectrumAllocationForComparation(layer,cmpLogger); 135 | 136 | for(Link link : layer.getLinkList()) { 137 | link.spectrumRestore(20); 138 | //link.outputUnusedSlotSections(null); 139 | } 140 | 141 | Logger.logln("", null); 142 | 143 | // Logger chkLogger = new Logger(dataPath + "output/result/rst_" + networkName + ".dat"); 144 | // rstLogger.setLevel(Level.FATAL); 145 | // outputResultToCheck(layer,chkLogger); 146 | } 147 | 148 | public void availabilityEnhancing_ProtectionSBPP_AMD(String dataPath, String networkName, int minRate, int maxRate) { 149 | // Part 1 Data Preparation 150 | // TODO NOTE : 151 | Layer layer = new Layer("workLayer", 0, ""); 152 | String topology = dataPath + "topology/" + networkName + ".csv"; 153 | System.out.print(">>Importing Topology of Network(" + topology + ") ...\n"); 154 | layer.readTopology(topology); 155 | layer.generateNodePairs(); 156 | 157 | Logger sysLogger = new Logger(dataPath + "output/system/system_" + networkName + ".log"); 158 | if(sysLogger != null) { 159 | sysLogger.setLevel(Level.DEBUG); 160 | } 161 | 162 | int minFragment = (int) Math.ceil(minRate/Modulation.QPSK.getCapacity()); 163 | 164 | // Part 2 Routing and Spectrum Allocation 165 | // TODO NOTE : 166 | System.out.println(">>Routing and Spectrum Allocation, the allocation information will be output to File(" + sysLogger.getName() + ") ..."); 167 | long time = System.currentTimeMillis(); 168 | for (NodePair nodepair : layer.getNodePairList()) { 169 | int rate = xRandom.uniformRandom(minRate,maxRate,new Random()); 170 | Request req = new Request(nodepair, rate); 171 | nodepair.setRate(rate); 172 | 173 | boolean wp = false,pp = false; 174 | 175 | RouteSearching rs = new RouteSearching(); 176 | 177 | RoutingAndSpectrumAllocation rsa = new RoutingAndSpectrumAllocation(); 178 | 179 | ArrayList routeList = new ArrayList(); 180 | routeList.clear(); 181 | rs.searchAllRoutes(nodepair.getSrcNode(), nodepair.getDesNode(), layer, null, 24, Modulation.BPSK.getTransDistance(), routeList); 182 | 183 | for(Link link : layer.getLinkList()) { 184 | link.spectrumCheck(); 185 | } 186 | 187 | for(Route tmpRoute : routeList) { 188 | tmpRoute.setRate(rate); 189 | tmpRoute.setRouteType(RouteType.Working); 190 | 191 | if(rsa.SpectrumAllocating_AdvancedMinDiff(req, tmpRoute,minFragment) == 0) { 192 | wp = true; 193 | 194 | req.getRouteList().add(tmpRoute); 195 | nodepair.getRouteList().add(tmpRoute); 196 | 197 | break; 198 | } 199 | } 200 | 201 | for(Link link : layer.getLinkList()) { 202 | link.spectrumRestore(20); 203 | } 204 | 205 | if(wp) { 206 | SearchConstraint constraint = new SearchConstraint(layer); 207 | constraint.addAllLinks(req.getRouteList().get(0).getLinkList()); 208 | 209 | routeList.clear(); 210 | 211 | rs.searchAllRoutes(nodepair.getSrcNode(), nodepair.getDesNode(), layer, constraint, 24, Modulation.BPSK.getTransDistance(), routeList); 212 | 213 | for(Route tmpRoute : routeList) { 214 | tmpRoute.setRate(rate); 215 | tmpRoute.setRouteType(RouteType.Protection); 216 | 217 | if(rsa.SpectrumAllocating_AdvancedMinDiff(req, tmpRoute,minFragment) == 0) { 218 | pp = true; 219 | 220 | req.getRouteList().add(tmpRoute); 221 | nodepair.getRouteList().add(tmpRoute); 222 | 223 | break; 224 | } 225 | } 226 | 227 | if(wp && pp) { 228 | for(Link link : req.getRouteList().get(0).getLinkList()) { 229 | link.spectrumOccupy(req.getRouteList().get(0).getStartIndex(), req.getRouteList().get(0).getSlots(), req); 230 | } 231 | 232 | for(Link link : req.getRouteList().get(1).getLinkList()) { 233 | link.spectrumOccupy_Shareable(req.getRouteList().get(1).getStartIndex(), req.getRouteList().get(1).getSlots(), req, 20); 234 | } 235 | } else { 236 | nodepair.getRouteList().clear(); 237 | } 238 | } 239 | } 240 | time = System.currentTimeMillis() - time; 241 | System.out.println("Time-consuming(RSA) : " + time + " ms"); 242 | 243 | // Part 3 Availability Calculation 244 | // TODO NOTE : 245 | Logger rstLogger = new Logger(dataPath + "output/result/result_" + networkName + ".txt"); 246 | if(rstLogger != null) { 247 | rstLogger.setLevel(Level.FATAL); 248 | } 249 | System.out.println(">>Output the result to File(" + rstLogger.getName() + ") ..."); 250 | outResult_Availability(layer,rstLogger); 251 | Logger cmpLogger = new Logger(dataPath + "output/result/cmp_" + networkName + ".txt"); 252 | if(cmpLogger != null) { 253 | cmpLogger.setLevel(Level.FATAL); 254 | } 255 | outputResult_SpectrumAllocationForComparation(layer,cmpLogger); 256 | 257 | for(Link link : layer.getLinkList()) { 258 | link.spectrumRestore(20); 259 | //link.outputUnusedSlotSections(null); 260 | } 261 | 262 | Logger.logln("", null); 263 | 264 | // Logger chkLogger = new Logger(dataPath + "output/result/rst_" + networkName + ".dat"); 265 | // rstLogger.setLevel(Level.FATAL); 266 | // outputResultToCheck(layer,chkLogger); 267 | } 268 | 269 | public static void outResult_Availability(Layer layer, Logger logger) { 270 | double[] unava = new double[layer.getNodePairList().size()]; 271 | for(NodePair nodepair : layer.getNodePairList()) { 272 | unava[nodepair.getIndex()] = 1.0; 273 | 274 | if(nodepair.getRouteList().size() > 0) { 275 | for(Route route : nodepair.getRouteList()) { 276 | unava[nodepair.getIndex()] *= 1 - route.getAvailRouteSingle(); 277 | } 278 | } 279 | } 280 | 281 | double awBand = 0.0; 282 | double establishedBand = 0.0; 283 | double blockedBand = 0.0; 284 | 285 | for (NodePair nodepair : layer.getNodePairList()) { 286 | if (nodepair.getRouteList().size() != 0) { 287 | awBand += nodepair.getRate() * (1 - unava[nodepair.getIndex()]); 288 | establishedBand += nodepair.getRate(); 289 | } else { 290 | blockedBand += nodepair.getRate(); 291 | } 292 | } 293 | 294 | Logger.logln("" + (1 - awBand / establishedBand) + " " + establishedBand + " " + awBand + " " + blockedBand,logger); 295 | 296 | Logger.logln("Unavailability : " + (1 - awBand / establishedBand),null); 297 | } 298 | 299 | public void outputResult_SpectrumAllocation(Layer layer,Logger logger) { 300 | String format = "Route,Length,Rate,Modulation,StartIndex,Slots,EndIndex,Availability"; 301 | Logger.logln(format,logger); 302 | 303 | for(NodePair nodepair : layer.getNodePairList()) { 304 | if(nodepair.getRouteList().size() != 0) { 305 | for(Route route : nodepair.getRouteList()) { 306 | Route.outputRoute(route, logger); 307 | String msg = "," + route.getLength() + "," + route.getRate() + "," + route.getModulation().getName() + "," + route.getStartIndex() + "," + route.getSlots() + "," + (route.getStartIndex() + route.getSlots() - 1) + "," + route.getAvailRouteSingle(); 308 | Logger.logln(msg,logger); 309 | } 310 | } 311 | } 312 | } 313 | 314 | public void outputResult_SpectrumAllocationForComparation(Layer layer,Logger logger) { 315 | String format = "Route StartIndex EndIndex"; 316 | Logger.logln(format,logger); 317 | 318 | for(NodePair nodepair : layer.getNodePairList()) { 319 | if(nodepair.getRouteList().size() != 0) { 320 | for(Route route : nodepair.getRouteList()) { 321 | Route.outputRoute(route, logger); 322 | String msg = " " + route.getStartIndex() + " " + (route.getStartIndex() + route.getSlots() - 1); 323 | Logger.logln(msg,logger); 324 | } 325 | 326 | Logger.logln("", logger); 327 | } 328 | } 329 | } 330 | 331 | public void outputResultToCheck(Layer layer, Logger logger) { 332 | dataForAMPL dfl = new dataForAMPL(); 333 | 334 | dfl.outputSetOfLinks(layer, logger); 335 | dfl.outputSetOfNodePairs(layer, logger); 336 | 337 | dfl.outputSetOfCandidateRoutes(layer, logger); 338 | dfl.outputParamOfDelta(layer, logger); 339 | 340 | Logger.logln("param sI :=",logger); 341 | for (NodePair nodepair : layer.getNodePairList()) { 342 | for (Route route : nodepair.getRouteList()) { 343 | Logger.log(nodepair.getName() + " ",logger); 344 | Route.outputRoute(route, logger); 345 | Logger.logln(" " + route.getStartIndex(),logger); 346 | } 347 | } 348 | Logger.logln(";\r\n",logger); 349 | 350 | Logger.logln("param eI :=",logger); 351 | for (NodePair nodepair : layer.getNodePairList()) { 352 | for (Route route : nodepair.getRouteList()) { 353 | Logger.log(nodepair.getName() + " ",logger); 354 | Route.outputRoute(route, logger); 355 | Logger.logln(" " + (route.getStartIndex() + route.getSlots() - 1),logger); 356 | } 357 | } 358 | Logger.logln(";\r\n",logger); 359 | 360 | Logger.logln("param share :=",logger); 361 | for (NodePair nodepair : layer.getNodePairList()) { 362 | for (Route route : nodepair.getRouteList()) { 363 | Logger.log(nodepair.getName() + " ",logger); 364 | Route.outputRoute(route, logger); 365 | Logger.logln(" " + ((route.getRouteType() == RouteType.Working) ? (0) : (1)),logger); 366 | } 367 | } 368 | Logger.logln(";\r\n",logger); 369 | } 370 | } 371 | -------------------------------------------------------------------------------- /vxFury_Heu_v2.2.4/src/work/temp/Test.java: -------------------------------------------------------------------------------- 1 | package work.temp; 2 | 3 | import java.util.ArrayList; 4 | 5 | import eon.general.bitProcess; 6 | import eon.spectrum.AdaptiveSlotSection; 7 | import work.utilities.Logger; 8 | 9 | public class Test { 10 | public static void main(String[] args) { 11 | ArrayList resourceList = new ArrayList(); 12 | 13 | resourceList.add(0x0000F0FF); 14 | resourceList.add(0x00F8F1FF); 15 | resourceList.add(0x0000F0FF); 16 | resourceList.add(0x00F8F1FF); 17 | resourceList.add(0x0000F0FF); 18 | resourceList.add(0x00F8F1FF); 19 | resourceList.add(0x0000F0FF); 20 | resourceList.add(0x00F8F1FF); 21 | resourceList.add(0x0000F0FF); 22 | resourceList.add(0x00F8F1FF); 23 | resourceList.add(0x0000F0FF); 24 | resourceList.add(0x00F8F1FF); 25 | resourceList.add(0x0000F0FF); 26 | resourceList.add(0x00F8F1FF); 27 | resourceList.add(0x0000F0FF); 28 | resourceList.add(0x00F8F1FF); 29 | resourceList.add(0x0000F0FF); 30 | resourceList.add(0x00F8F1FF); 31 | resourceList.add(0x0000F0FF); 32 | resourceList.add(0x00F8F1FF); 33 | resourceList.add(0x0000F0FF); 34 | resourceList.add(0x00F8F1FF); 35 | resourceList.add(0x0000F0FF); 36 | resourceList.add(0x00F8F1FF); 37 | resourceList.add(0x0000F0FF); 38 | resourceList.add(0x00F8F1FF); 39 | resourceList.add(0x0000F0FF); 40 | resourceList.add(0x00F8F1FF); 41 | resourceList.add(0x0000F0FF); 42 | resourceList.add(0x00F8F1FF); 43 | resourceList.add(0x0000F0FF); 44 | resourceList.add(0x00F8F1FF); 45 | resourceList.add(0x0000F0FF); 46 | resourceList.add(0x00F8F1FF); 47 | resourceList.add(0x0000F0FF); 48 | resourceList.add(0x00F8F1FF); 49 | resourceList.add(0x0000F0FF); 50 | resourceList.add(0x00F8F1FF); 51 | resourceList.add(0x0000F0FF); 52 | resourceList.add(0x00F8F1FF); 53 | resourceList.add(0x0000F0FF); 54 | resourceList.add(0x00F8F1FF); 55 | resourceList.add(0x0000F0FF); 56 | resourceList.add(0x00F8F1FF); 57 | resourceList.add(0x0000F0FF); 58 | resourceList.add(0x00F8F1FF); 59 | resourceList.add(0x0000F0FF); 60 | resourceList.add(0x00F8F1FF); 61 | resourceList.add(0x0000F0FF); 62 | resourceList.add(0x00F8F1FF); 63 | resourceList.add(0x0000F0FF); 64 | resourceList.add(0x00F8F1FF); 65 | resourceList.add(0x0000F0FF); 66 | resourceList.add(0x00F8F1FF); 67 | resourceList.add(0x0000F0FF); 68 | resourceList.add(0x00F8F1FF); 69 | resourceList.add(0x0000F0FF); 70 | resourceList.add(0x00F8F1FF); 71 | resourceList.add(0x0000F0FF); 72 | resourceList.add(0x00F8F1FF); 73 | resourceList.add(0x0000F0FF); 74 | resourceList.add(0x00F8F1FF); 75 | resourceList.add(0x0000F0FF); 76 | resourceList.add(0x00F8F1FF); 77 | resourceList.add(0x0000F0FF); 78 | resourceList.add(0x00F8F1FF); 79 | resourceList.add(0x0000F0FF); 80 | resourceList.add(0x00F8F1FF); 81 | resourceList.add(0x0000F0FF); 82 | resourceList.add(0x00F8F1FF); 83 | resourceList.add(0x0000F0FF); 84 | resourceList.add(0x00F8F1FF); 85 | resourceList.add(0x0000F0FF); 86 | resourceList.add(0x00F8F1FF); 87 | resourceList.add(0x0000F0FF); 88 | resourceList.add(0x00F8F1FF); 89 | resourceList.add(0x0000F0FF); 90 | resourceList.add(0x00F8F1FF); 91 | resourceList.add(0x0000F0FF); 92 | resourceList.add(0x00F8F1FF); 93 | resourceList.add(0x0000F0FF); 94 | resourceList.add(0x00F8F1FF); 95 | resourceList.add(0x0000F0FF); 96 | resourceList.add(0x00F8F1FF); 97 | resourceList.add(0x0000F0FF); 98 | resourceList.add(0x00F8F1FF); 99 | resourceList.add(0x0000F0FF); 100 | resourceList.add(0x00F8F1FF); 101 | resourceList.add(0x0000F0FF); 102 | resourceList.add(0x00F8F1FF); 103 | resourceList.add(0x0000F0FF); 104 | resourceList.add(0x00F8F1FF); 105 | resourceList.add(0x0000F0FF); 106 | resourceList.add(0x00F8F1FF); 107 | resourceList.add(0x0000F0FF); 108 | resourceList.add(0x00F8F1FF); 109 | resourceList.add(0x0000F0FF); 110 | resourceList.add(0x00F8F1FF); 111 | resourceList.add(0x0000F0FF); 112 | resourceList.add(0x00F8F1FF); 113 | resourceList.add(0x0000F0FF); 114 | resourceList.add(0x00F8F1FF); 115 | resourceList.add(0x0000F0FF); 116 | resourceList.add(0x00F8F1FF); 117 | resourceList.add(0x0000F0FF); 118 | resourceList.add(0x00F8F1FF); 119 | resourceList.add(0x0000F0FF); 120 | resourceList.add(0x00F8F1FF); 121 | resourceList.add(0x0000F0FF); 122 | resourceList.add(0x00F8F1FF); 123 | resourceList.add(0x0000F0FF); 124 | resourceList.add(0x00F8F1FF); 125 | resourceList.add(0x0000F0FF); 126 | resourceList.add(0x00F8F1FF); 127 | resourceList.add(0x0000F0FF); 128 | resourceList.add(0x00F8F1FF); 129 | resourceList.add(0x0000F0FF); 130 | resourceList.add(0x00F8F1FF); 131 | resourceList.add(0x0000F0FF); 132 | resourceList.add(0x00F8F1FF); 133 | resourceList.add(0x0000F0FF); 134 | resourceList.add(0x00F8F1FF); 135 | resourceList.add(0x0000F0FF); 136 | resourceList.add(0x00F8F1FF); 137 | resourceList.add(0x0000F0FF); 138 | resourceList.add(0x00F8F1FF); 139 | resourceList.add(0x0000F0FF); 140 | resourceList.add(0x00F8F1FF); 141 | resourceList.add(0x0000F0FF); 142 | resourceList.add(0x00F8F1FF); 143 | resourceList.add(0x0000F0FF); 144 | resourceList.add(0x00F8F1FF); 145 | resourceList.add(0x0000F0FF); 146 | resourceList.add(0x00F8F1FF); 147 | resourceList.add(0x0000F0FF); 148 | resourceList.add(0x00F8F1FF); 149 | resourceList.add(0x0000F0FF); 150 | resourceList.add(0x00F8F1FF); 151 | resourceList.add(0x0000F0FF); 152 | resourceList.add(0x00F8F1FF); 153 | resourceList.add(0x0000F0FF); 154 | resourceList.add(0x00F8F1FF); 155 | resourceList.add(0x0000F0FF); 156 | resourceList.add(0x00F8F1FF); 157 | resourceList.add(0x0000F0FF); 158 | resourceList.add(0x00F8F1FF); 159 | resourceList.add(0x0000F0FF); 160 | resourceList.add(0x00F8F1FF); 161 | resourceList.add(0x0000F0FF); 162 | resourceList.add(0x00F8F1FF); 163 | resourceList.add(0x0000F0FF); 164 | resourceList.add(0x00F8F1FF); 165 | resourceList.add(0x0000F0FF); 166 | resourceList.add(0x00F8F1FF); 167 | resourceList.add(0x0000F0FF); 168 | resourceList.add(0x00F8F1FF); 169 | resourceList.add(0x0000F0FF); 170 | resourceList.add(0x00F8F1FF); 171 | resourceList.add(0x0000F0FF); 172 | resourceList.add(0x00F8F1FF); 173 | resourceList.add(0x0000F0FF); 174 | resourceList.add(0x00F8F1FF); 175 | resourceList.add(0x0000F0FF); 176 | resourceList.add(0x00F8F1FF); 177 | resourceList.add(0x0000F0FF); 178 | resourceList.add(0x00F8F1FF); 179 | resourceList.add(0x0000F0FF); 180 | resourceList.add(0x00F8F1FF); 181 | resourceList.add(0x0000F0FF); 182 | resourceList.add(0x00F8F1FF); 183 | resourceList.add(0x0000F0FF); 184 | resourceList.add(0x00F8F1FF); 185 | resourceList.add(0x0000F0FF); 186 | resourceList.add(0x00F8F1FF); 187 | resourceList.add(0x0000F0FF); 188 | resourceList.add(0x00F8F1FF); 189 | resourceList.add(0x0000F0FF); 190 | resourceList.add(0x00F8F1FF); 191 | resourceList.add(0x0000F0FF); 192 | resourceList.add(0x00F8F1FF); 193 | resourceList.add(0x0000F0FF); 194 | resourceList.add(0x00F8F1FF); 195 | resourceList.add(0x0000F0FF); 196 | resourceList.add(0x00F8F1FF); 197 | resourceList.add(0x0000F0FF); 198 | resourceList.add(0x00F8F1FF); 199 | resourceList.add(0x0000F0FF); 200 | resourceList.add(0x00F8F1FF); 201 | resourceList.add(0x0000F0FF); 202 | resourceList.add(0x00F8F1FF); 203 | resourceList.add(0x0000F0FF); 204 | resourceList.add(0x00F8F1FF); 205 | resourceList.add(0x0000F0FF); 206 | resourceList.add(0x00F8F1FF); 207 | resourceList.add(0x0000F0FF); 208 | resourceList.add(0x00F8F1FF); 209 | resourceList.add(0x0000F0FF); 210 | resourceList.add(0x00F8F1FF); 211 | resourceList.add(0x0000F0FF); 212 | resourceList.add(0x00F8F1FF); 213 | resourceList.add(0x0000F0FF); 214 | resourceList.add(0x00F8F1FF); 215 | resourceList.add(0x0000F0FF); 216 | resourceList.add(0x00F8F1FF); 217 | resourceList.add(0x0000F0FF); 218 | resourceList.add(0x00F8F1FF); 219 | resourceList.add(0x0000F0FF); 220 | resourceList.add(0x00F8F1FF); 221 | resourceList.add(0x0000F0FF); 222 | resourceList.add(0x00F8F1FF); 223 | resourceList.add(0x0000F0FF); 224 | resourceList.add(0x00F8F1FF); 225 | resourceList.add(0x0000F0FF); 226 | resourceList.add(0x00F8F1FF); 227 | resourceList.add(0x0000F0FF); 228 | resourceList.add(0x00F8F1FF); 229 | resourceList.add(0x0000F0FF); 230 | resourceList.add(0x00F8F1FF); 231 | resourceList.add(0x0000F0FF); 232 | resourceList.add(0x00F8F1FF); 233 | resourceList.add(0x0000F0FF); 234 | resourceList.add(0x00F8F1FF); 235 | resourceList.add(0x0000F0FF); 236 | resourceList.add(0x00F8F1FF); 237 | resourceList.add(0x0000F0FF); 238 | resourceList.add(0x00F8F1FF); 239 | resourceList.add(0x0000F0FF); 240 | resourceList.add(0x00F8F1FF); 241 | resourceList.add(0x0000F0FF); 242 | resourceList.add(0x00F8F1FF); 243 | resourceList.add(0x0000F0FF); 244 | resourceList.add(0x00F8F1FF); 245 | resourceList.add(0x0000F0FF); 246 | resourceList.add(0x00F8F1FF); 247 | resourceList.add(0x0000F0FF); 248 | resourceList.add(0x00F8F1FF); 249 | resourceList.add(0x0000F0FF); 250 | resourceList.add(0x00F8F1FF); 251 | resourceList.add(0x0000F0FF); 252 | resourceList.add(0x00F8F1FF); 253 | resourceList.add(0x0000F0FF); 254 | resourceList.add(0x00F8F1FF); 255 | resourceList.add(0x0000F0FF); 256 | resourceList.add(0x00F8F1FF); 257 | resourceList.add(0x0000F0FF); 258 | resourceList.add(0x00F8F1FF); 259 | resourceList.add(0x0000F0FF); 260 | resourceList.add(0x00F8F1FF); 261 | resourceList.add(0x0000F0FF); 262 | resourceList.add(0x00F8F1FF); 263 | resourceList.add(0x0000F0FF); 264 | resourceList.add(0x00F8F1FF); 265 | resourceList.add(0x0000F0FF); 266 | resourceList.add(0x00F8F1FF); 267 | resourceList.add(0x0000F0FF); 268 | resourceList.add(0x00F8F1FF); 269 | resourceList.add(0x0000F0FF); 270 | resourceList.add(0x00F8F1FF); 271 | resourceList.add(0x0000F0FF); 272 | resourceList.add(0x00F8F1FF); 273 | resourceList.add(0x0000F0FF); 274 | resourceList.add(0x00F8F1FF); 275 | resourceList.add(0x0000F0FF); 276 | resourceList.add(0x00F8F1FF); 277 | resourceList.add(0x0000F0FF); 278 | resourceList.add(0x00F8F1FF); 279 | resourceList.add(0x0000F0FF); 280 | resourceList.add(0x00F8F1FF); 281 | resourceList.add(0x0000F0FF); 282 | resourceList.add(0x00F8F1FF); 283 | resourceList.add(0x0000F0FF); 284 | resourceList.add(0x00F8F1FF); 285 | resourceList.add(0x0000F0FF); 286 | resourceList.add(0x00F8F1FF); 287 | resourceList.add(0x0000F0FF); 288 | resourceList.add(0x00F8F1FF); 289 | resourceList.add(0x0000F0FF); 290 | resourceList.add(0x00F8F1FF); 291 | resourceList.add(0x0000F0FF); 292 | resourceList.add(0x00F8F1FF); 293 | resourceList.add(0x0000F0FF); 294 | resourceList.add(0x00F8F1FF); 295 | resourceList.add(0x0000F0FF); 296 | resourceList.add(0x00F8F1FF); 297 | resourceList.add(0x0000F0FF); 298 | resourceList.add(0x00F8F1FF); 299 | resourceList.add(0x0000F0FF); 300 | resourceList.add(0x00F8F1FF); 301 | resourceList.add(0x0000F0FF); 302 | resourceList.add(0x00F8F1FF); 303 | resourceList.add(0x0000F0FF); 304 | resourceList.add(0x00F8F1FF); 305 | resourceList.add(0x0000F0FF); 306 | resourceList.add(0x00F8F1FF); 307 | resourceList.add(0x0000F0FF); 308 | resourceList.add(0x00F8F1FF); 309 | resourceList.add(0x0000F0FF); 310 | resourceList.add(0x00F8F1FF); 311 | resourceList.add(0x0000F0FF); 312 | resourceList.add(0x00F8F1FF); 313 | resourceList.add(0x0000F0FF); 314 | resourceList.add(0x00F8F1FF); 315 | resourceList.add(0x0000F0FF); 316 | resourceList.add(0x00F8F1FF); 317 | resourceList.add(0x0000F0FF); 318 | resourceList.add(0x00F8F1FF); 319 | resourceList.add(0x0000F0FF); 320 | resourceList.add(0x00F8F1FF); 321 | resourceList.add(0x0000F0FF); 322 | resourceList.add(0x00F8F1FF); 323 | resourceList.add(0x0000F0FF); 324 | resourceList.add(0x00F8F1FF); 325 | resourceList.add(0x0000F0FF); 326 | resourceList.add(0x00F8F1FF); 327 | resourceList.add(0x0000F0FF); 328 | resourceList.add(0x00F8F1FF); 329 | resourceList.add(0x0000F0FF); 330 | resourceList.add(0x00F8F1FF); 331 | resourceList.add(0x0000F0FF); 332 | resourceList.add(0x00F8F1FF); 333 | resourceList.add(0x0000F0FF); 334 | resourceList.add(0x00F8F1FF); 335 | resourceList.add(0x0000F0FF); 336 | resourceList.add(0x00F8F1FF); 337 | resourceList.add(0x0000F0FF); 338 | resourceList.add(0x00F8F1FF); 339 | resourceList.add(0x0000F0FF); 340 | resourceList.add(0x00F8F1FF); 341 | resourceList.add(0x0000F0FF); 342 | resourceList.add(0x00F8F1FF); 343 | resourceList.add(0x0000F0FF); 344 | resourceList.add(0x00F8F1FF); 345 | resourceList.add(0x0000F0FF); 346 | resourceList.add(0x00F8F1FF); 347 | resourceList.add(0x0000F0FF); 348 | resourceList.add(0x00F8F1FF); 349 | resourceList.add(0x0000F0FF); 350 | resourceList.add(0x00F8F1FF); 351 | resourceList.add(0x0000F0FF); 352 | resourceList.add(0x00F8F1FF); 353 | resourceList.add(0x0000F0FF); 354 | resourceList.add(0x00F8F1FF); 355 | resourceList.add(0x0000F0FF); 356 | resourceList.add(0x00F8F1FF); 357 | resourceList.add(0x0000F0FF); 358 | resourceList.add(0x00F8F1FF); 359 | resourceList.add(0x0000F0FF); 360 | resourceList.add(0x00F8F1FF); 361 | resourceList.add(0x0000F0FF); 362 | resourceList.add(0x00F8F1FF); 363 | resourceList.add(0x0000F0FF); 364 | resourceList.add(0x00F8F1FF); 365 | resourceList.add(0x0000F0FF); 366 | resourceList.add(0x00F8F1FF); 367 | resourceList.add(0x0000F0FF); 368 | resourceList.add(0x00F8F1FF); 369 | resourceList.add(0x0000F0FF); 370 | resourceList.add(0x00F8F1FF); 371 | resourceList.add(0x0000F0FF); 372 | resourceList.add(0x00F8F1FF); 373 | resourceList.add(0x0000F0FF); 374 | resourceList.add(0x00F8F1FF); 375 | resourceList.add(0x0000F0FF); 376 | resourceList.add(0x00F8F1FF); 377 | resourceList.add(0x0000F0FF); 378 | resourceList.add(0x00F8F1FF); 379 | resourceList.add(0x0000F0FF); 380 | resourceList.add(0x00F8F1FF); 381 | resourceList.add(0x0000F0FF); 382 | resourceList.add(0x00F8F1FF); 383 | resourceList.add(0x0000F0FF); 384 | resourceList.add(0x00F8F1FF); 385 | resourceList.add(0x0000F0FF); 386 | resourceList.add(0x00F8F1FF); 387 | resourceList.add(0x0000F0FF); 388 | resourceList.add(0x00F8F1FF); 389 | resourceList.add(0x0000F0FF); 390 | resourceList.add(0x00F8F1FF); 391 | resourceList.add(0x0000F0FF); 392 | resourceList.add(0x00F8F1FF); 393 | resourceList.add(0x0000F0FF); 394 | resourceList.add(0x00F8F1FF); 395 | resourceList.add(0x0000F0FF); 396 | resourceList.add(0x00F8F1FF); 397 | resourceList.add(0x0000F0FF); 398 | resourceList.add(0x00F8F1FF); 399 | resourceList.add(0x0000F0FF); 400 | resourceList.add(0x00F8F1FF); 401 | resourceList.add(0x0000F0FF); 402 | resourceList.add(0x00F8F1FF); 403 | resourceList.add(0x0000F0FF); 404 | resourceList.add(0x00F8F1FF); 405 | resourceList.add(0x0000F0FF); 406 | resourceList.add(0x00F8F1FF); 407 | resourceList.add(0x0000F0FF); 408 | resourceList.add(0x00F8F1FF); 409 | resourceList.add(0x0000F0FF); 410 | resourceList.add(0x00F8F1FF); 411 | resourceList.add(0x0000F0FF); 412 | resourceList.add(0x00F8F1FF); 413 | resourceList.add(0x0000F0FF); 414 | resourceList.add(0x00F8F1FF); 415 | resourceList.add(0x0000F0FF); 416 | resourceList.add(0x00F8F1FF); 417 | resourceList.add(0x0000F0FF); 418 | resourceList.add(0x00F8F1FF); 419 | resourceList.add(0x0000F0FF); 420 | resourceList.add(0x00F8F1FF); 421 | resourceList.add(0x0000F0FF); 422 | resourceList.add(0x00F8F1FF); 423 | resourceList.add(0x0000F0FF); 424 | resourceList.add(0x00F8F1FF); 425 | resourceList.add(0x0000F0FF); 426 | resourceList.add(0x00F8F1FF); 427 | resourceList.add(0x0000F0FF); 428 | resourceList.add(0x00F8F1FF); 429 | resourceList.add(0x0000F0FF); 430 | resourceList.add(0x00F8F1FF); 431 | resourceList.add(0x0000F0FF); 432 | resourceList.add(0x00F8F1FF); 433 | resourceList.add(0x0000F0FF); 434 | resourceList.add(0x00F8F1FF); 435 | resourceList.add(0x0000F0FF); 436 | resourceList.add(0x00F8F1FF); 437 | resourceList.add(0x0000F0FF); 438 | resourceList.add(0x00F8F1FF); 439 | resourceList.add(0x0000F0FF); 440 | resourceList.add(0x00F8F1FF); 441 | resourceList.add(0x0000F0FF); 442 | resourceList.add(0x00F8F1FF); 443 | resourceList.add(0x0000F0FF); 444 | resourceList.add(0x00F8F1FF); 445 | resourceList.add(0x0000F0FF); 446 | resourceList.add(0x00F8F1FF); 447 | resourceList.add(0x0000F0FF); 448 | resourceList.add(0x00F8F1FF); 449 | resourceList.add(0x0000F0FF); 450 | resourceList.add(0x00F8F1FF); 451 | resourceList.add(0x0000F0FF); 452 | resourceList.add(0x00F8F1FF); 453 | resourceList.add(0x0000F0FF); 454 | resourceList.add(0x00F8F1FF); 455 | resourceList.add(0x0000F0FF); 456 | resourceList.add(0x00F8F1FF); 457 | resourceList.add(0x0000F0FF); 458 | resourceList.add(0x00F8F1FF); 459 | resourceList.add(0x0000F0FF); 460 | resourceList.add(0x00F8F1FF); 461 | resourceList.add(0x0000F0FF); 462 | resourceList.add(0x00F8F1FF); 463 | resourceList.add(0x0000F0FF); 464 | resourceList.add(0x00F8F1FF); 465 | resourceList.add(0x0000F0FF); 466 | resourceList.add(0x00F8F1FF); 467 | resourceList.add(0x0000F0FF); 468 | resourceList.add(0x00F8F1FF); 469 | resourceList.add(0x0000F0FF); 470 | resourceList.add(0x00F8F1FF); 471 | resourceList.add(0x0000F0FF); 472 | resourceList.add(0x00F8F1FF); 473 | resourceList.add(0x0000F0FF); 474 | resourceList.add(0x00F8F1FF); 475 | resourceList.add(0x0000F0FF); 476 | resourceList.add(0x00F8F1FF); 477 | resourceList.add(0x0000F0FF); 478 | resourceList.add(0x00F8F1FF); 479 | resourceList.add(0x0000F0FF); 480 | resourceList.add(0x00F8F1FF); 481 | resourceList.add(0x0000F0FF); 482 | resourceList.add(0x00F8F1FF); 483 | resourceList.add(0x0000F0FF); 484 | resourceList.add(0x00F8F1FF); 485 | resourceList.add(0x0000F0FF); 486 | resourceList.add(0x00F8F1FF); 487 | resourceList.add(0x0000F0FF); 488 | resourceList.add(0x00F8F1FF); 489 | resourceList.add(0x0000F0FF); 490 | resourceList.add(0x00F8F1FF); 491 | resourceList.add(0x0000F0FF); 492 | resourceList.add(0x00F8F1FF); 493 | resourceList.add(0x0000F0FF); 494 | resourceList.add(0x00F8F1FF); 495 | resourceList.add(0x0000F0FF); 496 | resourceList.add(0x00F8F1FF); 497 | resourceList.add(0x0000F0FF); 498 | resourceList.add(0x00F8F1FF); 499 | resourceList.add(0x0000F0FF); 500 | resourceList.add(0x00F8F1FF); 501 | resourceList.add(0x0000F0FF); 502 | resourceList.add(0x00F8F1FF); 503 | resourceList.add(0x0000F0FF); 504 | resourceList.add(0x00F8F1FF); 505 | resourceList.add(0x0000F0FF); 506 | resourceList.add(0x00F8F1FF); 507 | resourceList.add(0x0000F0FF); 508 | resourceList.add(0x00F8F1FF); 509 | resourceList.add(0x0000F0FF); 510 | resourceList.add(0x00F8F1FF); 511 | resourceList.add(0x0000F0FF); 512 | resourceList.add(0x00F8F1FF); 513 | resourceList.add(0x0000F0FF); 514 | resourceList.add(0x00F8F1FF); 515 | resourceList.add(0x0000F0FF); 516 | resourceList.add(0x00F8F1FF); 517 | resourceList.add(0x0000F0FF); 518 | resourceList.add(0x00F8F1FF); 519 | resourceList.add(0x0000F0FF); 520 | resourceList.add(0x00F8F1FF); 521 | resourceList.add(0x0000F0FF); 522 | resourceList.add(0x00F8F1FF); 523 | resourceList.add(0x0000F0FF); 524 | resourceList.add(0x00F8F1FF); 525 | resourceList.add(0x0000F0FF); 526 | resourceList.add(0x00F8F1FF); 527 | resourceList.add(0x0000F0FF); 528 | resourceList.add(0x00F8F1FF); 529 | resourceList.add(0x0000F0FF); 530 | resourceList.add(0x00F8F1FF); 531 | resourceList.add(0x0000F0FF); 532 | resourceList.add(0x00F8F1FF); 533 | resourceList.add(0x0000F0FF); 534 | resourceList.add(0x00F8F1FF); 535 | resourceList.add(0x0000F0FF); 536 | resourceList.add(0x00F8F1FF); 537 | resourceList.add(0x0000F0FF); 538 | resourceList.add(0x00F8F1FF); 539 | resourceList.add(0x0000F0FF); 540 | resourceList.add(0x00F8F1FF); 541 | resourceList.add(0x0000F0FF); 542 | resourceList.add(0x00F8F1FF); 543 | resourceList.add(0x0000F0FF); 544 | resourceList.add(0x00F8F1FF); 545 | resourceList.add(0x0000F0FF); 546 | resourceList.add(0x00F8F1FF); 547 | resourceList.add(0x0000F0FF); 548 | resourceList.add(0x00F8F1FF); 549 | resourceList.add(0x0000F0FF); 550 | resourceList.add(0x00F8F1FF); 551 | resourceList.add(0x0000F0FF); 552 | resourceList.add(0x00F8F1FF); 553 | resourceList.add(0x0000F0FF); 554 | resourceList.add(0x00F8F1FF); 555 | resourceList.add(0x0000F0FF); 556 | resourceList.add(0x00F8F1FF); 557 | resourceList.add(0x0000F0FF); 558 | resourceList.add(0x00F8F1FF); 559 | resourceList.add(0x0000F0FF); 560 | resourceList.add(0x00F8F1FF); 561 | resourceList.add(0x0000F0FF); 562 | resourceList.add(0x00F8F1FF); 563 | resourceList.add(0x0000F0FF); 564 | resourceList.add(0x00F8F1FF); 565 | resourceList.add(0x0000F0FF); 566 | resourceList.add(0x00F8F1FF); 567 | resourceList.add(0x0000F0FF); 568 | resourceList.add(0x00F8F1FF); 569 | resourceList.add(0x0000F0FF); 570 | resourceList.add(0x00F8F1FF); 571 | resourceList.add(0x0000F0FF); 572 | resourceList.add(0x00F8F1FF); 573 | resourceList.add(0x0000F0FF); 574 | resourceList.add(0x00F8F1FF); 575 | resourceList.add(0x0000F0FF); 576 | resourceList.add(0x00F8F1FF); 577 | resourceList.add(0x0000F0FF); 578 | resourceList.add(0x00F8F1FF); 579 | resourceList.add(0x0000F0FF); 580 | resourceList.add(0x00F8F1FF); 581 | resourceList.add(0x0000F0FF); 582 | resourceList.add(0x00F8F1FF); 583 | resourceList.add(0x0000F0FF); 584 | resourceList.add(0x00F8F1FF); 585 | resourceList.add(0x0000F0FF); 586 | resourceList.add(0x00F8F1FF); 587 | resourceList.add(0x0000F0FF); 588 | resourceList.add(0x00F8F1FF); 589 | resourceList.add(0x0000F0FF); 590 | resourceList.add(0x00F8F1FF); 591 | resourceList.add(0x0000F0FF); 592 | resourceList.add(0x00F8F1FF); 593 | resourceList.add(0x0000F0FF); 594 | resourceList.add(0x00F8F1FF); 595 | resourceList.add(0x0000F0FF); 596 | resourceList.add(0x00F8F1FF); 597 | resourceList.add(0x0000F0FF); 598 | resourceList.add(0x00F8F1FF); 599 | resourceList.add(0x0000F0FF); 600 | resourceList.add(0x00F8F1FF); 601 | resourceList.add(0x0000F0FF); 602 | resourceList.add(0x00F8F1FF); 603 | resourceList.add(0x0000F0FF); 604 | resourceList.add(0x00F8F1FF); 605 | resourceList.add(0x0000F0FF); 606 | resourceList.add(0x00F8F1FF); 607 | resourceList.add(0x0000F0FF); 608 | resourceList.add(0x00F8F1FF); 609 | resourceList.add(0x0000F0FF); 610 | resourceList.add(0x00F8F1FF); 611 | resourceList.add(0x0000F0FF); 612 | resourceList.add(0x00F8F1FF); 613 | resourceList.add(0x0000F0FF); 614 | resourceList.add(0x00F8F1FF); 615 | resourceList.add(0x0000F0FF); 616 | resourceList.add(0x00F8F1FF); 617 | resourceList.add(0x0000F0FF); 618 | resourceList.add(0x00F8F1FF); 619 | resourceList.add(0x0000F0FF); 620 | resourceList.add(0x00F8F1FF); 621 | resourceList.add(0x0000F0FF); 622 | resourceList.add(0x00F8F1FF); 623 | resourceList.add(0x0000F0FF); 624 | resourceList.add(0x00F8F1FF); 625 | resourceList.add(0x0000F0FF); 626 | resourceList.add(0x00F8F1FF); 627 | resourceList.add(0x0000F0FF); 628 | resourceList.add(0x00F8F1FF); 629 | resourceList.add(0x0000F0FF); 630 | resourceList.add(0x00F8F1FF); 631 | resourceList.add(0x0000F0FF); 632 | resourceList.add(0x00F8F1FF); 633 | resourceList.add(0x0000F0FF); 634 | resourceList.add(0x00F8F1FF); 635 | resourceList.add(0x0000F0FF); 636 | resourceList.add(0x00F8F1FF); 637 | resourceList.add(0x0000F0FF); 638 | resourceList.add(0x00F8F1FF); 639 | resourceList.add(0x0000F0FF); 640 | resourceList.add(0x00F8F1FF); 641 | resourceList.add(0x0000F0FF); 642 | resourceList.add(0x00F8F1FF); 643 | resourceList.add(0x0000F0FF); 644 | resourceList.add(0x00F8F1FF); 645 | resourceList.add(0x0000F0FF); 646 | resourceList.add(0x00F8F1FF); 647 | resourceList.add(0x0000F0FF); 648 | resourceList.add(0x00F8F1FF); 649 | resourceList.add(0x0000F0FF); 650 | resourceList.add(0x00F8F1FF); 651 | resourceList.add(0x0000F0FF); 652 | resourceList.add(0x00F8F1FF); 653 | resourceList.add(0x0000F0FF); 654 | resourceList.add(0x00F8F1FF); 655 | resourceList.add(0x0000F0FF); 656 | resourceList.add(0x00F8F1FF); 657 | resourceList.add(0x0000F0FF); 658 | resourceList.add(0x00F8F1FF); 659 | resourceList.add(0x0000F0FF); 660 | resourceList.add(0x00F8F1FF); 661 | resourceList.add(0x0000F0FF); 662 | resourceList.add(0x00F8F1FF); 663 | resourceList.add(0x0000F0FF); 664 | resourceList.add(0x00F8F1FF); 665 | resourceList.add(0x0000F0FF); 666 | resourceList.add(0x00F8F1FF); 667 | resourceList.add(0x0000F0FF); 668 | resourceList.add(0x00F8F1FF); 669 | resourceList.add(0x0000F0FF); 670 | resourceList.add(0x00F8F1FF); 671 | resourceList.add(0x0000F0FF); 672 | resourceList.add(0x00F8F1FF); 673 | resourceList.add(0x0000F0FF); 674 | resourceList.add(0x00F8F1FF); 675 | resourceList.add(0x0000F0FF); 676 | resourceList.add(0x00F8F1FF); 677 | resourceList.add(0x0000F0FF); 678 | resourceList.add(0x00F8F1FF); 679 | resourceList.add(0x0000F0FF); 680 | resourceList.add(0x00F8F1FF); 681 | resourceList.add(0x0000F0FF); 682 | resourceList.add(0x00F8F1FF); 683 | resourceList.add(0x0000F0FF); 684 | resourceList.add(0x00F8F1FF); 685 | resourceList.add(0x0000F0FF); 686 | resourceList.add(0x00F8F1FF); 687 | resourceList.add(0x0000F0FF); 688 | resourceList.add(0x00F8F1FF); 689 | resourceList.add(0x0000F0FF); 690 | resourceList.add(0x00F8F1FF); 691 | resourceList.add(0x0000F0FF); 692 | resourceList.add(0x00F8F1FF); 693 | resourceList.add(0x0000F0FF); 694 | resourceList.add(0x00F8F1FF); 695 | resourceList.add(0x0000F0FF); 696 | resourceList.add(0x00F8F1FF); 697 | resourceList.add(0x0000F0FF); 698 | resourceList.add(0x00F8F1FF); 699 | resourceList.add(0x0000F0FF); 700 | resourceList.add(0x00F8F1FF); 701 | resourceList.add(0x0000F0FF); 702 | resourceList.add(0x00F8F1FF); 703 | resourceList.add(0x0000F0FF); 704 | resourceList.add(0x00F8F1FF); 705 | resourceList.add(0x0000F0FF); 706 | resourceList.add(0x00F8F1FF); 707 | resourceList.add(0x0000F0FF); 708 | resourceList.add(0x00F8F1FF); 709 | resourceList.add(0x0000F0FF); 710 | resourceList.add(0x00F8F1FF); 711 | resourceList.add(0x0000F0FF); 712 | resourceList.add(0x00F8F1FF); 713 | resourceList.add(0x0000F0FF); 714 | resourceList.add(0x00F8F1FF); 715 | resourceList.add(0x0000F0FF); 716 | resourceList.add(0x00F8F1FF); 717 | resourceList.add(0x0000F0FF); 718 | resourceList.add(0x00F8F1FF); 719 | resourceList.add(0x0000F0FF); 720 | resourceList.add(0x00F8F1FF); 721 | resourceList.add(0x0000F0FF); 722 | resourceList.add(0x00F8F1FF); 723 | resourceList.add(0x0000F0FF); 724 | resourceList.add(0x00F8F1FF); 725 | resourceList.add(0x0000F0FF); 726 | resourceList.add(0x00F8F1FF); 727 | resourceList.add(0x0000F0FF); 728 | resourceList.add(0x00F8F1FF); 729 | resourceList.add(0x0000F0FF); 730 | resourceList.add(0x00F8F1FF); 731 | resourceList.add(0x0000F0FF); 732 | resourceList.add(0x00F8F1FF); 733 | resourceList.add(0x0000F0FF); 734 | resourceList.add(0x00F8F1FF); 735 | resourceList.add(0x0000F0FF); 736 | resourceList.add(0x00F8F1FF); 737 | resourceList.add(0x0000F0FF); 738 | resourceList.add(0x00F8F1FF); 739 | resourceList.add(0x0000F0FF); 740 | resourceList.add(0x00F8F1FF); 741 | resourceList.add(0x0000F0FF); 742 | resourceList.add(0x00F8F1FF); 743 | resourceList.add(0x0000F0FF); 744 | resourceList.add(0x00F8F1FF); 745 | resourceList.add(0x0000F0FF); 746 | resourceList.add(0x00F8F1FF); 747 | resourceList.add(0x0000F0FF); 748 | resourceList.add(0x00F8F1FF); 749 | resourceList.add(0x0000F0FF); 750 | resourceList.add(0x00F8F1FF); 751 | resourceList.add(0x0000F0FF); 752 | resourceList.add(0x00F8F1FF); 753 | resourceList.add(0x0000F0FF); 754 | resourceList.add(0x00F8F1FF); 755 | resourceList.add(0x0000F0FF); 756 | resourceList.add(0x00F8F1FF); 757 | resourceList.add(0x0000F0FF); 758 | resourceList.add(0x00F8F1FF); 759 | resourceList.add(0x0000F0FF); 760 | resourceList.add(0x00F8F1FF); 761 | resourceList.add(0x0000F0FF); 762 | resourceList.add(0x00F8F1FF); 763 | resourceList.add(0x0000F0FF); 764 | resourceList.add(0x00F8F1FF); 765 | resourceList.add(0x0000F0FF); 766 | resourceList.add(0x00F8F1FF); 767 | resourceList.add(0x0000F0FF); 768 | resourceList.add(0x00F8F1FF); 769 | resourceList.add(0x0000F0FF); 770 | resourceList.add(0x00F8F1FF); 771 | resourceList.add(0x0000F0FF); 772 | resourceList.add(0x00F8F1FF); 773 | resourceList.add(0x0000F0FF); 774 | resourceList.add(0x00F8F1FF); 775 | resourceList.add(0x0000F0FF); 776 | resourceList.add(0x00F8F1FF); 777 | resourceList.add(0x0000F0FF); 778 | resourceList.add(0x00F8F1FF); 779 | resourceList.add(0x0000F0FF); 780 | resourceList.add(0x00F8F1FF); 781 | resourceList.add(0x0000F0FF); 782 | resourceList.add(0x00F8F1FF); 783 | resourceList.add(0x0000F0FF); 784 | resourceList.add(0x00F8F1FF); 785 | resourceList.add(0x0000F0FF); 786 | resourceList.add(0x00F8F1FF); 787 | resourceList.add(0x0000F0FF); 788 | resourceList.add(0x00F8F1FF); 789 | resourceList.add(0x0000F0FF); 790 | resourceList.add(0x00F8F1FF); 791 | resourceList.add(0x0000F0FF); 792 | resourceList.add(0x00F8F1FF); 793 | resourceList.add(0x0000F0FF); 794 | resourceList.add(0x00F8F1FF); 795 | resourceList.add(0x0000F0FF); 796 | resourceList.add(0x00F8F1FF); 797 | resourceList.add(0x0000F0FF); 798 | resourceList.add(0x00F8F1FF); 799 | resourceList.add(0x0000F0FF); 800 | resourceList.add(0x00F8F1FF); 801 | resourceList.add(0x0000F0FF); 802 | resourceList.add(0x00F8F1FF); 803 | resourceList.add(0x0000F0FF); 804 | resourceList.add(0x00F8F1FF); 805 | resourceList.add(0x0000F0FF); 806 | resourceList.add(0x00F8F1FF); 807 | resourceList.add(0x0000F0FF); 808 | resourceList.add(0x00F8F1FF); 809 | resourceList.add(0x0000F0FF); 810 | resourceList.add(0x00F8F1FF); 811 | resourceList.add(0x0000F0FF); 812 | resourceList.add(0x00F8F1FF); 813 | resourceList.add(0x0000F0FF); 814 | resourceList.add(0x00F8F1FF); 815 | resourceList.add(0x0000F0FF); 816 | resourceList.add(0x00F8F1FF); 817 | resourceList.add(0x0000F0FF); 818 | resourceList.add(0x00F8F1FF); 819 | resourceList.add(0x0000F0FF); 820 | resourceList.add(0x00F8F1FF); 821 | resourceList.add(0x0000F0FF); 822 | resourceList.add(0x00F8F1FF); 823 | resourceList.add(0x0000F0FF); 824 | resourceList.add(0x00F8F1FF); 825 | resourceList.add(0x0000F0FF); 826 | resourceList.add(0x00F8F1FF); 827 | resourceList.add(0x0000F0FF); 828 | resourceList.add(0x00F8F1FF); 829 | resourceList.add(0x0000F0FF); 830 | resourceList.add(0x00F8F1FF); 831 | resourceList.add(0x0000F0FF); 832 | resourceList.add(0x00F8F1FF); 833 | resourceList.add(0x0000F0FF); 834 | resourceList.add(0x00F8F1FF); 835 | resourceList.add(0x0000F0FF); 836 | resourceList.add(0x00F8F1FF); 837 | resourceList.add(0x0000F0FF); 838 | resourceList.add(0x00F8F1FF); 839 | resourceList.add(0x0000F0FF); 840 | resourceList.add(0x00F8F1FF); 841 | resourceList.add(0x0000F0FF); 842 | resourceList.add(0x00F8F1FF); 843 | resourceList.add(0x0000F0FF); 844 | resourceList.add(0x00F8F1FF); 845 | resourceList.add(0x0000F0FF); 846 | resourceList.add(0x00F8F1FF); 847 | resourceList.add(0x0000F0FF); 848 | resourceList.add(0x00F8F1FF); 849 | resourceList.add(0x0000F0FF); 850 | resourceList.add(0x00F8F1FF); 851 | resourceList.add(0x0000F0FF); 852 | resourceList.add(0x00F8F1FF); 853 | resourceList.add(0x0000F0FF); 854 | resourceList.add(0x00F8F1FF); 855 | resourceList.add(0x0000F0FF); 856 | resourceList.add(0x00F8F1FF); 857 | resourceList.add(0x0000F0FF); 858 | resourceList.add(0x00F8F1FF); 859 | resourceList.add(0x0000F0FF); 860 | resourceList.add(0x00F8F1FF); 861 | resourceList.add(0x0000F0FF); 862 | resourceList.add(0x00F8F1FF); 863 | resourceList.add(0x0000F0FF); 864 | resourceList.add(0x00F8F1FF); 865 | resourceList.add(0x0000F0FF); 866 | resourceList.add(0x00F8F1FF); 867 | resourceList.add(0x0000F0FF); 868 | resourceList.add(0x00F8F1FF); 869 | resourceList.add(0x0000F0FF); 870 | resourceList.add(0x00F8F1FF); 871 | resourceList.add(0x0000F0FF); 872 | resourceList.add(0x00F8F1FF); 873 | resourceList.add(0x0000F0FF); 874 | resourceList.add(0x00F8F1FF); 875 | resourceList.add(0x0000F0FF); 876 | resourceList.add(0x00F8F1FF); 877 | resourceList.add(0x0000F0FF); 878 | resourceList.add(0x00F8F1FF); 879 | resourceList.add(0x0000F0FF); 880 | resourceList.add(0x00F8F1FF); 881 | resourceList.add(0x0000F0FF); 882 | resourceList.add(0x00F8F1FF); 883 | resourceList.add(0x0000F0FF); 884 | resourceList.add(0x00F8F1FF); 885 | resourceList.add(0x0000F0FF); 886 | resourceList.add(0x00F8F1FF); 887 | resourceList.add(0x0000F0FF); 888 | resourceList.add(0x00F8F1FF); 889 | resourceList.add(0x0000F0FF); 890 | resourceList.add(0x00F8F1FF); 891 | resourceList.add(0x0000F0FF); 892 | resourceList.add(0x00F8F1FF); 893 | resourceList.add(0x0000F0FF); 894 | resourceList.add(0x00F8F1FF); 895 | resourceList.add(0x0000F0FF); 896 | resourceList.add(0x00F8F1FF); 897 | resourceList.add(0x0000F0FF); 898 | resourceList.add(0x00F8F1FF); 899 | resourceList.add(0x0000F0FF); 900 | resourceList.add(0x00F8F1FF); 901 | resourceList.add(0x0000F0FF); 902 | resourceList.add(0x00F8F1FF); 903 | resourceList.add(0x0000F0FF); 904 | resourceList.add(0x00F8F1FF); 905 | resourceList.add(0x0000F0FF); 906 | resourceList.add(0x00F8F1FF); 907 | resourceList.add(0x0000F0FF); 908 | resourceList.add(0x00F8F1FF); 909 | resourceList.add(0x0000F0FF); 910 | resourceList.add(0x00F8F1FF); 911 | resourceList.add(0x0000F0FF); 912 | resourceList.add(0x00F8F1FF); 913 | resourceList.add(0x0000F0FF); 914 | resourceList.add(0x00F8F1FF); 915 | resourceList.add(0x0000F0FF); 916 | resourceList.add(0x00F8F1FF); 917 | resourceList.add(0x0000F0FF); 918 | resourceList.add(0x00F8F1FF); 919 | resourceList.add(0x0000F0FF); 920 | resourceList.add(0x00F8F1FF); 921 | resourceList.add(0x0000F0FF); 922 | resourceList.add(0x00F8F1FF); 923 | resourceList.add(0x0000F0FF); 924 | resourceList.add(0x00F8F1FF); 925 | resourceList.add(0x0000F0FF); 926 | resourceList.add(0x00F8F1FF); 927 | resourceList.add(0x0000F0FF); 928 | resourceList.add(0x00F8F1FF); 929 | resourceList.add(0x0000F0FF); 930 | resourceList.add(0x00F8F1FF); 931 | resourceList.add(0x0000F0FF); 932 | resourceList.add(0x00F8F1FF); 933 | resourceList.add(0x0000F0FF); 934 | resourceList.add(0x00F8F1FF); 935 | resourceList.add(0x0000F0FF); 936 | resourceList.add(0x00F8F1FF); 937 | resourceList.add(0x0000F0FF); 938 | resourceList.add(0x00F8F1FF); 939 | resourceList.add(0x0000F0FF); 940 | resourceList.add(0x00F8F1FF); 941 | resourceList.add(0x0000F0FF); 942 | resourceList.add(0x00F8F1FF); 943 | resourceList.add(0x0000F0FF); 944 | resourceList.add(0x00F8F1FF); 945 | resourceList.add(0x0000F0FF); 946 | resourceList.add(0x00F8F1FF); 947 | resourceList.add(0x0000F0FF); 948 | resourceList.add(0x00F8F1FF); 949 | resourceList.add(0x0000F0FF); 950 | resourceList.add(0x00F8F1FF); 951 | resourceList.add(0x0000F0FF); 952 | resourceList.add(0x00F8F1FF); 953 | resourceList.add(0x0000F0FF); 954 | resourceList.add(0x00F8F1FF); 955 | resourceList.add(0x0000F0FF); 956 | resourceList.add(0x00F8F1FF); 957 | resourceList.add(0x0000F0FF); 958 | resourceList.add(0x00F8F1FF); 959 | resourceList.add(0x0000F0FF); 960 | resourceList.add(0x00F8F1FF); 961 | resourceList.add(0x0000F0FF); 962 | resourceList.add(0x00F8F1FF); 963 | resourceList.add(0x0000F0FF); 964 | resourceList.add(0x00F8F1FF); 965 | resourceList.add(0x0000F0FF); 966 | resourceList.add(0x00F8F1FF); 967 | resourceList.add(0x0000F0FF); 968 | resourceList.add(0x00F8F1FF); 969 | resourceList.add(0x0000F0FF); 970 | resourceList.add(0x00F8F1FF); 971 | resourceList.add(0x0000F0FF); 972 | resourceList.add(0x00F8F1FF); 973 | resourceList.add(0x0000F0FF); 974 | resourceList.add(0x00F8F1FF); 975 | resourceList.add(0x0000F0FF); 976 | resourceList.add(0x00F8F1FF); 977 | resourceList.add(0x0000F0FF); 978 | resourceList.add(0x00F8F1FF); 979 | resourceList.add(0x0000F0FF); 980 | resourceList.add(0x00F8F1FF); 981 | resourceList.add(0x0000F0FF); 982 | resourceList.add(0x00F8F1FF); 983 | resourceList.add(0x0000F0FF); 984 | resourceList.add(0x00F8F1FF); 985 | resourceList.add(0x0000F0FF); 986 | resourceList.add(0x00F8F1FF); 987 | resourceList.add(0x0000F0FF); 988 | resourceList.add(0x00F8F1FF); 989 | resourceList.add(0x0000F0FF); 990 | resourceList.add(0x00F8F1FF); 991 | resourceList.add(0x0000F0FF); 992 | resourceList.add(0x00F8F1FF); 993 | resourceList.add(0x0000F0FF); 994 | resourceList.add(0x00F8F1FF); 995 | resourceList.add(0x0000F0FF); 996 | resourceList.add(0x00F8F1FF); 997 | resourceList.add(0x0000F0FF); 998 | resourceList.add(0x00F8F1FF); 999 | resourceList.add(0x0000F0FF); 1000 | resourceList.add(0x00F8F1FF); 1001 | resourceList.add(0x0000F0FF); 1002 | resourceList.add(0x00F8F1FF); 1003 | resourceList.add(0x0000F0FF); 1004 | resourceList.add(0x00F8F1FF); 1005 | resourceList.add(0x0000F0FF); 1006 | resourceList.add(0x00F8F1FF); 1007 | resourceList.add(0x0000F0FF); 1008 | resourceList.add(0x00F8F1FF); 1009 | resourceList.add(0x0000F0FF); 1010 | resourceList.add(0x00F8F1FF); 1011 | resourceList.add(0x0000F0FF); 1012 | resourceList.add(0x00F8F1FF); 1013 | 1014 | long time = System.currentTimeMillis(); 1015 | //getAdaptiveSlotSections(resourceList); 1016 | outputUnusedSlotSections(resourceList,null); 1017 | time = System.currentTimeMillis() - time; 1018 | Logger.logln("" + time + " ms", null); 1019 | } 1020 | 1021 | public static void outputUnusedSlotSections(ArrayList resourceList, Logger logger) { 1022 | ArrayList ats = getAdaptiveSlotSections(resourceList, 6); 1023 | 1024 | if(ats.size() > 0) { 1025 | Logger.logln("Unused Slot Section(s) for link :", logger); 1026 | 1027 | for(AdaptiveSlotSection ss : ats) { 1028 | Logger.logln("" + ss.getStartIndex() + " ~ " + (ss.getStartIndex() + ss.getSlots() - 1),logger); 1029 | } 1030 | } else { 1031 | Logger.logln("All Slots for link were used.", logger); 1032 | } 1033 | 1034 | int unused = 0; 1035 | for(Integer ss : resourceList) { 1036 | unused += bitProcess.bitCount_StaticTable(ss); 1037 | } 1038 | Logger.logln("Unused Slots : " + unused,logger); 1039 | } 1040 | 1041 | // Adaptive Slot-Section(s) 1042 | public static ArrayList getAdaptiveSlotSections(ArrayList resourceList, int minimalSlots) { 1043 | ArrayList ats = new ArrayList(); 1044 | 1045 | int size = resourceList.size(),index = 0; 1046 | 1047 | int offset = 0, bits = 0; 1048 | for(Integer resource : resourceList) { 1049 | for(int i = 0; i < 32; i ++) { 1050 | if((resource & 0x1) != 0) { 1051 | bits ++; 1052 | } else { 1053 | if(bits >= minimalSlots) { 1054 | ats.add(new AdaptiveSlotSection(offset - bits,bits)); 1055 | } 1056 | bits = 0; 1057 | } 1058 | 1059 | resource >>>= 1; 1060 | offset ++; 1061 | } 1062 | 1063 | index ++; 1064 | 1065 | if((index == size) && (bits >= minimalSlots)) { 1066 | ats.add(new AdaptiveSlotSection(offset - bits,bits)); 1067 | } 1068 | } 1069 | 1070 | return ats; 1071 | } 1072 | } --------------------------------------------------------------------------------