diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index fe4c5cf..7cd87f8 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -10,7 +10,7 @@
-
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..15a15b2
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 0548357..5755a99 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,5 +1,12 @@
+
+
+
diff --git a/AHP_Fuzzy_TOPSIS.iml b/AHP_Fuzzy_TOPSIS.iml
index 6603c53..33e33e9 100644
--- a/AHP_Fuzzy_TOPSIS.iml
+++ b/AHP_Fuzzy_TOPSIS.iml
@@ -1,20 +1,16 @@
-
-
-
+
+
+
+
-
+
+
+
+
-
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/src/AHP.java b/src/main/java/AHP.java
similarity index 93%
rename from src/AHP.java
rename to src/main/java/AHP.java
index 01776d1..14db341 100644
--- a/src/AHP.java
+++ b/src/main/java/AHP.java
@@ -5,22 +5,22 @@
public class AHP {
// Random Consistency Index
- private static double RI[] = {0.0, 0.0, 0.58, 0.9, 1.12, 1.24, 1.32, 1.41, 1.45, 1.49};
+ private static double[] RI = {0.0, 0.0, 0.58, 0.9, 1.12, 1.24, 1.32, 1.41, 1.45, 1.49};
// The matrix
private Array2DRowRealMatrix mtx;
// Pairwise Comparison Array of criteria
- private double pairwiseComparisonArray[];
+ private double[] pairwiseComparisonArray;
// Number of alternatives
private int nrAlternatives;
// The resulting weights/priorities
- private double weights[];
+ private double[] weights;
// Corresponds to the weights
- private String labels[] = null;
+ private String[] labels = null;
private EigenDecomposition evd;
@@ -35,7 +35,7 @@ public class AHP {
*/
private int evIdx = 0; // index of actual eigenvalue/-vector
- AHP(String labels[]) {
+ AHP(String[] labels) {
this(labels.length);
this.labels = labels;
}
@@ -79,7 +79,7 @@ int getNrOfPairwiseComparisons() {
* Set the pairwise comparison scores and calculate all relevant numbers
* @param a
*/
- void setPairwiseComparisonArray(double a[]) {
+ void setPairwiseComparisonArray(double[] a) {
int i = 0;
for (int row = 0; row < nrAlternatives; row++) {
for (int col = row + 1; col < nrAlternatives; col++) {
@@ -126,6 +126,7 @@ int[] getIndicesForPairwiseComparison(int arrayIdx) {
* @return resulting weights for alternatives
*/
double[] getWeights() {
+ final double[] weights = this.weights;
return weights;
}
diff --git a/src/Config.java b/src/main/java/Config.java
similarity index 94%
rename from src/Config.java
rename to src/main/java/Config.java
index adfcfde..4b48cfa 100644
--- a/src/Config.java
+++ b/src/main/java/Config.java
@@ -3,10 +3,10 @@
class Config {
// Set your alternatives here
- static String alternatives[] = new String[]{"Mobile", "Edge", "Public"};
+ static String[] alternatives = new String[]{"Mobile", "Edge", "Public"};
// Set your criteria here
- static String criteria[] = new String[]{"Bandwidth", "Speed", "Availability", "Security", "Price"};
+ static String[] criteria = new String[]{"Bandwidth", "Speed", "Availability", "Security", "Price"};
// Set true for benefir criterion, false for cost criterion
static boolean[] costCriteria = new boolean[]{false, false, false, false, true}; // price is cost
diff --git a/src/Fuzzy.java b/src/main/java/Fuzzy.java
similarity index 100%
rename from src/Fuzzy.java
rename to src/main/java/Fuzzy.java
diff --git a/src/Test.java b/src/main/java/Test.java
similarity index 93%
rename from src/Test.java
rename to src/main/java/Test.java
index 6f8456f..337cd0f 100644
--- a/src/Test.java
+++ b/src/main/java/Test.java
@@ -1,14 +1,10 @@
-import java.util.HashMap;
-import java.util.Map;
-import java.util.TreeMap;
-
public class Test {
private void calculateAHP(){
AHP ahp = new AHP(Config.criteria);
- double compArray[] = ahp.getPairwiseComparisonArray();
+ double[] compArray = ahp.getPairwiseComparisonArray();
// Set the pairwise comparison values
compArray[0] = Config.BANDWIDTH_SPEED;
diff --git a/src/Topsis.java b/src/main/java/Topsis.java
similarity index 96%
rename from src/Topsis.java
rename to src/main/java/Topsis.java
index 5e0266c..84b94bf 100644
--- a/src/Topsis.java
+++ b/src/main/java/Topsis.java
@@ -5,19 +5,19 @@
import java.util.Map;
import java.util.TreeMap;
-public class Topsis {
+class Topsis {
private HashMap> sitesMatrix;
private HashMap> availableSites;
private ArrayList criteriaImportance;
- public Topsis(){
+ Topsis(){
criteriaImportance = new ArrayList<>();
- sitesMatrix =new HashMap<>();
+ sitesMatrix = new HashMap<>();
availableSites = new HashMap<>();
}
- public void start(){
+ void start(){
for (String alternative : Config.alternatives) {
criteriaImportance = profileNode(alternative);
availableSites.put(alternative, criteriaImportance);
@@ -47,7 +47,7 @@ private HashMap> calculateFuzzyTopsis(HashMap weightedMatrix = new ArrayList<>();
+ ArrayList weightedMatrix = new ArrayList();
for (int k = 0; k < entry.getValue().size(); k++) {
for (double fuzzyValue:entry.getValue().get(k).getValue()) {
@@ -112,7 +112,7 @@ else if (node.equalsIgnoreCase(Config.alternatives[1])) { // Edge
private HashMap calculateDistance(HashMap> sitesMatrix, boolean ideal) {
EuclideanDistance distance = new EuclideanDistance();
// The normalized values for the ideal solution and negative ideal solution on criteria are always (1,1,1) and (0,0,0) respectively
- Double dValue = 0.0;
+ double dValue = 0.0;
HashMap results = new HashMap<>();
for (Map.Entry> entry: sitesMatrix.entrySet()) {
diff --git a/target/classes/AHP.class b/target/classes/AHP.class
new file mode 100644
index 0000000..a848a71
Binary files /dev/null and b/target/classes/AHP.class differ
diff --git a/target/classes/Config.class b/target/classes/Config.class
new file mode 100644
index 0000000..a0ee299
Binary files /dev/null and b/target/classes/Config.class differ
diff --git a/target/classes/Fuzzy.class b/target/classes/Fuzzy.class
new file mode 100644
index 0000000..87c7aed
Binary files /dev/null and b/target/classes/Fuzzy.class differ
diff --git a/target/classes/Test.class b/target/classes/Test.class
new file mode 100644
index 0000000..4dd63a2
Binary files /dev/null and b/target/classes/Test.class differ
diff --git a/target/classes/Topsis.class b/target/classes/Topsis.class
new file mode 100644
index 0000000..4eb4590
Binary files /dev/null and b/target/classes/Topsis.class differ