├── 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