Browse Source

fitness stuff

Rolf Egert 5 years ago
parent
commit
ca58f480cc
1 changed files with 4 additions and 3 deletions
  1. 4 3
      src/exampleAlgorithms/PSOAlgotihm.java

+ 4 - 3
src/exampleAlgorithms/PSOAlgotihm.java

@@ -613,7 +613,7 @@ public class PSOAlgotihm implements Algorithm {
 		int maxElements = obj.getElements().size();
 		
 		//result = (float) Math.pow((maxElements -activeElements),2)*10;
-		result = (float) Math.pow(5, 4* ( (float) maxElements - (float) activeElements)/ (float) maxElements) - 1 ;
+		result = (float) Math.pow(5, 4* ( (float) maxElements - (float) activeElements)/ (float) maxElements) - 1;
 		//System.out.println("max: " + maxElements + " active: " + activeElements + " results in penalty: " + result);
 	return result;
 		
@@ -769,7 +769,7 @@ public class PSOAlgotihm implements Algorithm {
 		 */
 		public void printToStream(BufferedWriter out) throws IOException {
 			try {
-				out.write(maxIterations + "," + allRuns.size() + "," + swarmSize);
+				out.write(maxIterations + 2 + "," + allRuns.size() + "," + swarmSize);
 				out.newLine();
 
 			}
@@ -784,10 +784,11 @@ public class PSOAlgotihm implements Algorithm {
 					println(e.getMessage());
 				}
 			} );
-			out.write("AverageRun:");
+		/*	out.write("AverageRun:");
 			out.newLine();
 			out.write(calculateAverageRun().stream().map(Object::toString).collect(Collectors.joining(", ")));
 			out.newLine();
+			*/
 		}
 		
 		private List<Double> calculateAverageRun(){