Browse Source

Topologie Metric Update

Tom Troppmann 4 years ago
parent
commit
14d72357d7

+ 370 - 0
src/algorithm/objectiveFunction/GraphMetrics.java

@@ -0,0 +1,370 @@
+package algorithm.objectiveFunction;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+
+import classes.AbstractCanvasObject;
+import ui.model.Consumer;
+import ui.model.DecoratedCable;
+import ui.model.DecoratedNetwork;
+import ui.model.Passiv;
+import ui.model.Supplier;
+
+public class GraphMetrics {
+	
+	
+	public static class Vertex{
+		public int id = 0;
+		public Vertex(int id){
+			this.id = id;
+		}
+	}
+	private static class Edge{
+		public int idA, idB;
+		public double weight;
+		public Edge(int idA, int idB, double weight){
+			this.idA = idA;
+			this.idB = idB;
+			this.weight = weight;
+		}
+	}
+	
+	public static class Graph{
+		Vertex[] V;
+		Edge[] E;
+	}
+	
+	
+	
+	/**
+	 * Convert a DecoratedNetwork to a Graph
+	 * @param net
+	 * @return a equivalent Graph to the DecoratedNetwork
+	 */
+	public static Graph convertDecoratedNetworkToGraph(DecoratedNetwork net) {
+		Graph G = new Graph();
+		HashMap<AbstractCanvasObject, Integer> objectToId = new HashMap<>();
+		int count = 0;
+		for(Consumer con: net.getConsumerList()) {
+			objectToId.putIfAbsent(con.getModel(), count++);
+		}
+		for(Consumer con: net.getConsumerSelfSuppliedList()) {
+			objectToId.putIfAbsent(con.getModel(), count++);
+		}
+		for(Passiv pas: net.getPassivNoEnergyList()) {
+			objectToId.putIfAbsent(pas.getModel(), count++);
+		}
+		for(Supplier sup: net.getSupplierList()) {
+			objectToId.putIfAbsent(sup.getModel(), count++);
+		}
+		
+		
+		
+		G.E = new Edge[net.getDecoratedCableList().size()];
+		int edgeCount = 0;
+		for(DecoratedCable cable : net.getDecoratedCableList()){
+			
+			AbstractCanvasObject objectA = cable.getModel().getA();
+			AbstractCanvasObject objectB = cable.getModel().getB();
+			if(objectA == null) {
+				System.out.println("Edge: " + cable + "objectA == null");
+				continue;
+			}
+			if(objectB == null) {
+				System.out.println("Edge: " + cable + "objectB == null");
+				continue;
+			}
+			int idA = -1;
+			if(objectToId.containsKey(objectA)) {
+				idA = objectToId.get(objectA);
+			}else {
+				idA = count;
+				objectToId.put(objectA, count++);
+			}
+			int idB = -1;
+			if(objectToId.containsKey(objectB)) {
+				idB = objectToId.get(objectB);
+			}else {
+				idB = count;
+				objectToId.put(objectB, count++);
+			}
+			double length = cable.getModel().getLength();
+			G.E[edgeCount++] = new Edge(idA, idB, length);
+		}
+		G.V = new Vertex[objectToId.size()];
+		for(int i=0;i<G.V.length;i++)
+	    {
+				G.V[i] =  new Vertex(i);
+	    }
+		return G;
+	}
+	
+	public static void main(String[] args) {
+		System.out.println("Test");
+		int amountSwitches = 30;
+		double times = Math.pow(2, amountSwitches);
+		for(int i = 0; i < times; i++) {
+			System.out.print("i(" + i +"):");
+			for(int k = 0; k < amountSwitches; k++) {
+				boolean result = ((i >> k) & 1) != 0;
+				System.out.print(result +  ", ");
+			}
+			System.out.println();
+		}
+	}
+	
+	
+// Example Test
+//	 public static void main(String[] args){
+//		 Graph G = new Graph();
+//		 G.V = new Vertex[9];
+//		 for(int i=0;i<G.V.length;i++)
+//	     {
+//				G.V[i] =  new Vertex(i);
+//	     }
+//		 G.E = new Edge[18];
+//		 
+//		 G.E[0] = new Edge(0, 1, 4);
+//		 G.E[1] = new Edge(1, 2, 4);
+//		 G.E[2] = new Edge(2, 3, 4);
+//		 G.E[3] = new Edge(0, 4, 4);
+//		 G.E[4] = new Edge(0, 5, 4);
+//		 G.E[5] = new Edge(1, 4, 4);
+//		 G.E[6] = new Edge(1, 5, 4);
+//		 G.E[7] = new Edge(2, 6, 4);
+//		 G.E[8] = new Edge(2, 7, 4);
+//		 G.E[9] = new Edge(3, 6, 4);
+//		 G.E[10] = new Edge(3, 7, 4);
+//		 G.E[11] = new Edge(4, 5, 4);
+//		 G.E[12] = new Edge(5, 6, 4);
+//		 G.E[13] = new Edge(6, 7, 4);
+//		 G.E[14] = new Edge(3, 8, 4);
+//		 G.E[15] = new Edge(6, 8, 4);
+//		 G.E[16] = new Edge(7, 8, 4);
+//		 G.E[17] = new Edge(2, 5, 4);
+//		 
+//
+//		 System.out.println("k: " + minimumCut(G.V, G.E));
+//		 System.out.println("AvgShortestDistance " + averageShortestDistance(G.V, G.E));
+//		 
+//	 }
+	 
+	 static int[][] generateDisjointWeightMatrix(Vertex[] V, Edge[] E){
+			int[][] L = new int[V.length][V.length];
+			for(int i = 0; i < E.length; i++) {
+				L[E[i].idA][E[i].idB] = 1;
+				L[E[i].idB][E[i].idA] = 1;
+			}
+			return L;
+		}
+	 
+	 
+	 /**
+	  * Stoer Wagner Minimal Cut Algo
+	  * Source from
+	  * <a href="https://github.com/hunglvosu/algorithm/blob/master/algorithm/src/Stoer-Wagner.c">
+	  * https://github.com/hunglvosu/algorithm/blob/master/algorithm/src/Stoer-Wagner.c</a> <br>
+	  * in C formatted in java
+	  * @param V Vertex Array
+	  * @param E Edge Array
+	  * @return
+	  */
+	 
+	 static int minimumCut(Vertex[] V, Edge[] E) {
+		 int[][] W = generateDisjointWeightMatrix(V, E); 
+		 boolean[] Del = new boolean[V.length];
+		 int n = V.length;				// the number of veritces
+		 int m = E.length;
+		return StoerWagner(n, m, W, Del);
+		 
+	 }
+	 
+	 static int StoerWagner(int n, int m, int[][] W, boolean[] Del){
+			int C = Integer.MAX_VALUE;
+			for(int V = n; V > 1; V--){
+				int cutValue = minCutPhase(V, W, Del, n, m);
+				C = (C < cutValue ? C: cutValue);	
+			}
+			return C;
+		}
+	 
+	 static int minCutPhase(int V, int[][] W, boolean[] Del, int n, int m){
+			int i = 0, j = 0;
+			int[] s = new int[2];
+			if(V  == 2) {
+				for( i = 0; i < n; i++){
+					if(Del[i] == false){
+						s[j] = i; j++;
+					}
+				}
+				return W[s[0]][s[1]];
+			}
+			int[] L = new int[n];
+			boolean[] T = new boolean[n];
+			
+			i = 1;	// the number of vertices in the tree T
+			j = 0;
+			int v,u;
+			while( i <= V){
+				v = maxStickiness(T,L, Del, n);
+				T[v] = true;
+				for(u = 0; u < n; u++){
+					if(W[v][u] != 0 && Del[u] == false && T[u] == false){
+						L[u] = L[u] + W[u][v];
+					}
+				}
+				if( i >= V-1){
+					s[j] = v; j++;
+				}
+				i++;
+			}
+			merge(s[0], s[1], n, W, Del);
+			return L[s[1]];	
+		}
+	 
+
+		static int maxStickiness(boolean[] T, int[] L, boolean[] Del, int n){
+			int i = 0;
+			int v = 0;
+			int max = 0;
+			for(i = 0; i < n; i++){
+				if(Del[i] == false && T[i] == false && max < L[i]){
+					v = i;
+					max = L[i];
+				} 
+			}
+			return v;
+		}
+	 
+
+		static void merge(int s, int t, int n, int[][] W, boolean[] Del){
+			int v = 0;
+			for(v = 0; v < n; v++){
+				if(Del[v] == false && v != s && v!= t){
+					W[s][v] = W[s][v] + W[v][t];
+					W[v][s] = W[s][v];
+				}
+			}
+			Del[t] = true;	
+		}
+
+
+
+
+
+	static double[][] basicAllPairsShortestPath(Vertex[] V, Edge[] E){
+		 double[][] L = generateWeightMatrix(V, E);
+		 double[][] D = generateDistanceMatrix(V);
+		 boolean[] flag = generateFlagList(V);
+		 for(int i=0;i<V.length;i++) {
+			 modifiedDikstra(V[i].id, L, D, flag);
+		 }
+		 return D;
+	 }
+	 static double averageShortestDistance(Vertex[] V, Edge[] E) {
+		 if(V.length <= 1) return 0.0;
+		 double[][] D = basicAllPairsShortestPath(V, E);
+		 double sum = 0;
+		 int maxColumn = 1;
+		 for(int row = 1; row < D.length; row++) {
+			 for(int column = 0; column < maxColumn; column++) {
+				 sum += D[row][column];
+			 }
+			 maxColumn++;
+		 }
+		 int numbers = ((D.length - 1) * (D.length)) / 2;
+		 return sum / (double)numbers;
+	 } 
+	/** 
+	 * @return Updated Distance Matrix D and flag List 
+	 */
+	static void modifiedDikstra(int source, double[][] L, double[][] D, boolean[] flag) {
+		D[source][source] = 0;
+		LinkedList<Integer> visitedNotes = new LinkedList<Integer>(); 
+		LinkedList<Integer> minPriorityQueue = new LinkedList<Integer>(); 
+		minPriorityQueue.add(source);
+		
+		
+		
+		while(!minPriorityQueue.isEmpty()) {
+			minPriorityQueue.sort((a,b) -> Double.compare(D[source][a],  D[source][b]));
+			int target =  minPriorityQueue.pop();
+			if(flag[source] == true) {
+				for(int outgoingID = 0; outgoingID < L.length; outgoingID++) {
+					if(D[source][target] + L[target][outgoingID] < D[source][outgoingID]) {
+						D[source][outgoingID] = D[source][target] + L[target][outgoingID];
+					}
+				}
+			}else {
+				for(int outgoingID = 0; outgoingID < L.length; outgoingID++) {
+					if(L[target][outgoingID] == Double.POSITIVE_INFINITY) continue;
+					if(D[source][target] + L[target][outgoingID] < D[source][outgoingID]) {
+						D[source][outgoingID] = D[source][target] + L[target][outgoingID];
+						if(!visitedNotes.contains(outgoingID)) {
+							minPriorityQueue.add(outgoingID);
+						}
+					}
+				}
+			}
+			visitedNotes.add(target);
+		}
+		flag[source] = true;
+	}
+	
+	static void printMatrix(int[][] matrix) {
+		for(int i=0;i<matrix.length;i++)
+        {
+            for(int j=0;j<matrix.length;j++)
+            {
+                System.out.print(matrix[i][j] +  " ");
+            }
+            System.out.println();
+        }
+	}
+	static void printMatrix(double[][] matrix) {
+		for(int i=0;i<matrix.length;i++)
+        {
+            for(int j=0;j<matrix.length;j++)
+            {
+                System.out.print(matrix[i][j] +  " ");
+            }
+            System.out.println();
+        }
+	}
+	static double[][] generateWeightMatrix(Vertex[] V, Edge[] E){
+		double[][] L = new double[V.length][V.length];
+		for(int i = 0; i < E.length; i++) {
+			L[E[i].idA][E[i].idB] = E[i].weight;
+			L[E[i].idB][E[i].idA] = E[i].weight;
+		}
+		for(int i=0;i<L.length;i++)
+        {
+            for(int j=0;j<L.length;j++)
+            {
+                if(L[i][j]==0.0) L[i][j] = Double.POSITIVE_INFINITY;
+            }
+        }
+		for(int i=0;i<L.length;i++)
+        {
+			L[i][i] = 0.0;
+        }
+		return L;
+	}
+	static double[][] generateDistanceMatrix(Vertex[] V) {
+		double[][] D = new double[V.length][V.length];
+		for(int i=0;i<D.length;i++)
+        {
+            for(int j=0;j<D.length;j++)
+            {
+                D[i][j] = Double.POSITIVE_INFINITY;
+            }
+        }
+		return D;
+	}
+	private static boolean[] generateFlagList(Vertex[] V) {
+		boolean[] flag = new boolean[V.length];
+		return flag;
+	}
+
+
+}

+ 220 - 0
src/algorithm/objectiveFunction/TopologieObjectiveFunction.java

@@ -0,0 +1,220 @@
+package algorithm.objectiveFunction;
+
+
+import ui.model.DecoratedHolonObject;
+import ui.model.DecoratedNetwork;
+import ui.model.DecoratedState;
+import ui.model.DecoratedSwitch;
+import java.util.Locale;
+import algorithm.objectiveFunction.GraphMetrics.Graph;
+
+public class TopologieObjectiveFunction {
+	//Parameters
+	
+	//weight for f_g(H)
+	static double w_eb = .5, w_holon=.1, w_selection = .1, w_grid = .4;
+	
+	
+	//--> f_eb parameter
+	/**
+	 * Maximum Energie Difference(kappa)
+	 */
+	static double k_eb = 100000.f;
+	
+	
+	//--> f_holon parameter
+	/**
+	 * maximum penalty from holon flexibilities 
+	 */
+	static double k_holon= 200000;
+	
+	
+	//--> f_selection paramaeter;
+	/**
+	 *  average Maximum Cost for selction(kappa) of switch and elements.
+	 */
+	static double k_selection = 1000;
+	static double cost_switch = 10;
+	static double cost_element = 30;
+	//--> f_grid parameter
+	/**
+	 * The avergae shortest path maximum length -> kappa for the squash function
+	 */
+	static double k_avg_shortest_path = 400;
+	
+	
+	
+	//pre-calculated parameters for partial function terms:
+	/** 
+	 * Pre calculated for the squash function
+	 * <br>
+	 *  {@link TopologieObjectiveFunction#squash}
+	 */
+	static double squash_subtract = 1.0f / (1.f + (float) Math.exp(5.0));
+	
+	
+	static {
+        //init
+		checkParameter();
+    }
+	
+	/**
+	 * Check parameter Setting and print error when wrong values are put in.
+	 * Here should all invariants be placed to be checked on initialization.
+	 */
+	private static void checkParameter() {
+		if(!(Math.abs(w_eb + w_holon + w_selection + w_selection + w_grid - 1) < 0.001)) {
+			System.err.println("ParameterError in ObjectiveFunction: Sum of all weights should be 1");
+		}
+	}
+	
+	/**
+	 * ObjectifeFunction by Carlos.
+	 * Function computes f_g:
+	 * f_g = w1 * squash(f_eb, k1) + w2 * squash(f_state, k2) + w3 * squash(f_pro, k3) + w4 * squash(f_perf, k4) + w5 * squash(f_holon, k5) 
+	 * 
+	 * 
+	 * squash is the squashing function {@link TopologieObjectiveFunction#squash}
+	 * 
+	 * 
+	 * @param state
+	 * @return f_g value between 0 and 100
+	 */
+	static public float getFitnessValueForState(DecoratedState state) {
+		
+		
+
+		//Calculate f_eb the penalty for unbalenced energy in the network
+		double f_eb = 0;
+		for(DecoratedNetwork net : state.getNetworkList()) {
+			double netEnergyDifference = 0;
+			netEnergyDifference += net.getConsumerList().stream().map(con -> con.getEnergySelfSupplied() - con.getEnergyFromConsumingElemnets()).reduce(0.f, Float::sum);
+			netEnergyDifference += net.getConsumerSelfSuppliedList().stream().map(con -> con.getEnergySelfSupplied() - con.getEnergyFromConsumingElemnets()).reduce(0.f, Float::sum);
+			netEnergyDifference += net.getSupplierList().stream().map(sup -> sup.getEnergyProducing() - sup.getEnergySelfConsuming()).reduce(0.f, Float::sum);
+			//abs
+			f_eb += Math.abs(netEnergyDifference);
+		}
+		
+		//calculate f_holon
+		double f_holon = 0;
+		for(DecoratedNetwork net : state.getNetworkList()) {
+			double f_elements_diviation_production = net.getDiviationInProductionInNetworkForHolonObjects();
+			double f_elements_diviation_consumption = net.getDiviationInProductionInNetworkForHolonObjects();
+			double f_flexibility_diviation_consumption = net.getDiviationInFlexibilityConsumption();
+			double f_flexibility_diviation_production = net.getDiviationInFlexibilityProduction();
+			
+			double f_element = f_elements_diviation_production +f_elements_diviation_consumption;
+			double f_flexibility = f_flexibility_diviation_consumption +f_flexibility_diviation_production;
+				
+			f_holon += f_element + f_flexibility ;
+		}
+		
+		//calculating f_selection
+		double f_selection = 0;
+		int amountOfElemetsInWildcard = 0;
+		for(DecoratedNetwork net : state.getNetworkList()) {
+			for(DecoratedHolonObject dHobject : net.getConsumerList()) {
+				if(dHobject.getModel().getObjName().equals("Wildcard")){
+					amountOfElemetsInWildcard += dHobject.getModel().getNumberOfElements();
+				}
+			}
+			for(DecoratedHolonObject dHobject : net.getConsumerList()) {
+				if(dHobject.getModel().getObjName().equals("Wildcard")){
+					amountOfElemetsInWildcard += dHobject.getModel().getNumberOfElements();
+				}
+			}
+			for(DecoratedHolonObject dHobject : net.getSupplierList()) {
+				if(dHobject.getModel().getObjName().equals("Wildcard")){
+					amountOfElemetsInWildcard += dHobject.getModel().getNumberOfElements();
+				}
+			}
+		}
+		f_selection += cost_switch * amountOfElemetsInWildcard;
+		int amountOfAddedSwitch = 0;
+		for(DecoratedSwitch sw : state.getDecoratedSwitches()) {
+			if(sw.getModel().getObjName().equals("AddedSwitch")) {
+				amountOfAddedSwitch++;
+			}
+		}
+		f_selection += cost_switch * amountOfAddedSwitch;
+		
+		
+		
+		
+		//calculating f_grid
+		double f_grid = 0;
+		//each network is a holon
+		for(DecoratedNetwork net: state.getNetworkList()) {
+			Graph G = GraphMetrics.convertDecoratedNetworkToGraph(net);
+			//We have to penalize single Networks;
+			if(G.V.length <= 1) {
+				f_grid += 100;
+				continue;
+			}
+			
+			//k-edge-conneted
+			
+			double avgShortestPath = GraphMetrics.averageShortestDistance(G.V,  G.E);
+			double squached = squash(avgShortestPath, k_avg_shortest_path);
+			//System.out.println("AVG:" + avgShortestPath + "  squached:" + squached);
+			
+			int maximumK = G.V.length - 1;
+			if(maximumK != 0) {
+				int k = GraphMetrics.minimumCut(G.V, G.E);				
+				double proportion = k/(double)maximumK;
+				//System.out.println("proportion ("+ k+"/"+ maximumK+")=" + proportion);
+				squached =  0.5 * squash(1.0-proportion, 1) + 0.5 *squached;
+			}
+			f_grid += squached;
+		}
+		if(!state.getNetworkList().isEmpty()) {
+			f_grid /= state.getNetworkList().size();		
+		}
+		//System.out.println("f_grid:" + f_grid);
+		
+		
+		System.out.print(" f_eb(" + w_eb * squash(f_eb, k_eb) + ") ");
+		System.out.print(" f_holon(" + w_holon * squash(f_holon, k_holon)  + ") ");
+		System.out.print(" f_selection(" + w_selection * squash(f_selection, k_selection)  + ") ");
+		System.out.println(" f_grid(" + w_grid * f_grid + ") ");
+		
+		/**
+		 * F_grid is already squashed
+		 */
+		return (float) (w_eb * squash(f_eb, k_eb) 
+				+ w_holon * squash(f_holon, k_holon) 
+				+ w_selection * squash(f_selection, k_selection) 
+				+ w_grid * f_grid);
+	}
+
+	private static String doubleToString(double value) {
+		return String.format (Locale.US, "%.2f", value);
+	}
+	
+	
+	
+	
+	
+	/**
+	 * The squashing function in paper
+	 * @param x the input
+	 * @param kappa the corresponding kappa
+	 * @return
+	 */
+	static public double squash(double x, double kappa) {
+		return 100.f/(1.0f + Math.exp(-(10.f * (x - kappa/2.f))/ kappa)) - squash_subtract;
+	}
+	
+	/**
+	 * f_sup in paper
+	 * @param supply from 0 to 1
+	 * @return
+	 */
+	static public double supplyPenalty(double supply) {
+		double supplyPercentage = 100 * supply;
+		//	double test = (supplyPercentage < 100) ? -0.5 * supplyPercentage + 50: supplyPercentage - 100;
+		return (supplyPercentage < 100) ? -0.5 * supplyPercentage + 50: supplyPercentage - 100;
+	}
+	
+
+}

+ 2 - 1
src/algorithm/topologie/GaAlgorithm.java

@@ -7,6 +7,7 @@ import java.util.TreeSet;
 import java.util.stream.Collectors;
 
 import algorithm.objectiveFunction.ObjectiveFunctionByCarlos;
+import algorithm.objectiveFunction.TopologieObjectiveFunction;
 import api.TopologieAlgorithmFramework;
 import api.AlgorithmFrameworkFlex.Individual;
 import ui.model.DecoratedState;
@@ -41,7 +42,7 @@ public class GaAlgorithm extends TopologieAlgorithmFramework {
 	}
 	@Override
 	protected double evaluateState(DecoratedState actualstate) {
-		return ObjectiveFunctionByCarlos.getFitnessValueForState(actualstate);
+		return TopologieObjectiveFunction.getFitnessValueForState(actualstate);
 	}
 
 	@Override

+ 33 - 10
src/api/TopologieAlgorithmFramework.java

@@ -452,20 +452,44 @@ public abstract class TopologieAlgorithmFramework implements AddOn{
 	
 	protected double evaluatePosition(List<Integer> positionToEvaluate) {
 		runProgressbar.step();
-//		long startTime = System.currentTimeMillis(), endTime;
-		control.getSimManager().resetFlexManagerForTimeStep(control.getModel().getCurIteration()); // execution time critical
-//		endTime = System.currentTimeMillis();
-//		console.print(" a:" + (endTime - startTime)); 
-//		startTime = endTime;
+		control.getSimManager().resetFlexManagerForTimeStep(control.getModel().getCurIteration());
+		
 		setState(positionToEvaluate); // execution time critical
 
 		return evaluateNetwork();
 	}
 
 	private double evaluateNetwork() {
-		control.calculateStateOnlyForCurrentTimeStep();
-		DecoratedState actualstate = control.getSimManager().getActualDecorState();
-		return evaluateState(actualstate);
+		
+		// Not possible due exponentiak growing
+//		double times = Math.pow(2, switchList.size());
+//		double sum = 0;
+//		for(int i = 0; i < times; i++) {
+//			int positionInBitString = 0;
+//			for(HolonSwitch hSwitch: switchList) {
+//				boolean result = ((i >> positionInBitString++) & 1) != 0;
+//				hSwitch.setManualState(result);
+//			}	
+//			sum += evaluateNetwork() / times;
+//		}
+		
+		System.out.println("-->");
+		double sum = 0;
+		double step = 0.1;
+		int steppsDone = 0;
+		for(double actual = 0; actual <= 1 ; actual += step) {
+			for(HolonSwitch hSwitch: switchList) {
+				hSwitch.setManualMode(true);
+				hSwitch.setManualState(Random.nextDouble() < actual);
+			}
+			control.calculateStateOnlyForCurrentTimeStep();
+			DecoratedState actualstate = control.getSimManager().getActualDecorState();
+			sum += evaluateState(actualstate);
+			steppsDone++;
+		}
+		System.out.println("<--");
+		
+		return sum /(double) steppsDone;
 	}
 	
 	
@@ -787,7 +811,7 @@ public abstract class TopologieAlgorithmFramework implements AddOn{
 			AbstractCanvasObject toObject =  accessIntToObject.get(cable.second);
 			int middleX = (fromObject.getPosition().x +   toObject.getPosition().x)/2;
 			int middleY = (fromObject.getPosition().y +   toObject.getPosition().y)/2;
-			HolonSwitch newSwitch = new HolonSwitch("Switch");
+			HolonSwitch newSwitch = new HolonSwitch("AddedSwitch");
 			newSwitch.setPosition(middleX, middleY);
 			//If fromObject is in Group
 			if(accessGroupNode.containsKey(fromObject)) {
@@ -803,7 +827,6 @@ public abstract class TopologieAlgorithmFramework implements AddOn{
 			}
 			//else if toObject is in Group
 			this.switchList.add(newSwitch);
-			
 			//Generate Cable From Object A To Switch
 			Edge edge1 = new Edge(fromObject, newSwitch);
 			edge1.setUnlimitedCapacity(true);

+ 2 - 28
src/ui/view/Main.java

@@ -23,36 +23,10 @@ public class Main {
 	 *            standard
 	 */
 	public static void main(String[] args) {
-		//System.out.println(System.getProperty("os.name"));
-//		if (!System.getProperty("os.name").startsWith("Linux")) {
-//			// *Design
-//			try {
-//			
-//			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
-//			} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
-//			e.printStackTrace();
-//			}
-//		}else {
-////			try {
-////				UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
-////			} catch (ClassNotFoundException | InstantiationException | IllegalAccessException
-////					| UnsupportedLookAndFeelException e) {
-////				e.printStackTrace();
-////			}
-//		}
-		
-		if (System.getProperty("os.name").startsWith("Linux")) {
-//			try {
-//				UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
-//			} catch (ClassNotFoundException | InstantiationException | IllegalAccessException
-//					| UnsupportedLookAndFeelException e) {
-//				e.printStackTrace();
-//			}
-		}else {
+		if (!System.getProperty("os.name").startsWith("Linux")) {
 			loadNotLinuxLookAndFeel();	
 		}
-			
-
+		
         EventQueue.invokeLater(() -> {
             try {
                 Model model = new Model();