diff --git a/AMAKFX/src/multiagent/framework/ui/VUIMulti.java b/AMAKFX/src/multiagent/framework/ui/VUIMulti.java index f3a0de118b5de9dab0dc21a0680fa8dfdd5c89d0..4157036566546ea7d3213521c011e719b06a8f03 100644 --- a/AMAKFX/src/multiagent/framework/ui/VUIMulti.java +++ b/AMAKFX/src/multiagent/framework/ui/VUIMulti.java @@ -4,7 +4,7 @@ import java.util.*; import java.util.concurrent.locks.ReentrantLock; import multiagent.framework.tools.RunLaterHelper; -import fr.irit.smac.amak.ui.drawables.*; +import multiagent.framework.ui.drawables.*; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.Insets; diff --git a/ELLSAonAMAK/src/experiments/roboticArm/launchers/RobotLaunchExampleOneExperimentationWithArgs.java b/ELLSAonAMAK/src/experiments/roboticArm/launchers/RobotLaunchExampleOneExperimentationWithArgs.java index b2907ef1ac58a8af8db0a4ee15a39bdf47c5e8eb..ba0530b767a8523fd78c92fe705bd124831c6c8d 100644 --- a/ELLSAonAMAK/src/experiments/roboticArm/launchers/RobotLaunchExampleOneExperimentationWithArgs.java +++ b/ELLSAonAMAK/src/experiments/roboticArm/launchers/RobotLaunchExampleOneExperimentationWithArgs.java @@ -36,7 +36,6 @@ public class RobotLaunchExampleOneExperimentationWithArgs { PARAMS.nbRequestCycle = Integer.parseInt(args[2]); PARAMS.nbEpisodes = Integer.parseInt(args[3]); PARAMS.mappingErrorAllowed = ((double)Integer.parseInt(args[4]))/100; - System.out.println(PARAMS.mappingErrorAllowed); PARAMS.neighborhoodMultiplicator = Integer.parseInt(args[5]); PARAMS.extendedArmLength = Integer.parseInt(args[6]); @@ -108,43 +107,40 @@ public class RobotLaunchExampleOneExperimentationWithArgs { for (String dataName : dataStrings){ OptionalDouble averageScore = data.get(dataName).stream().mapToDouble(a->a).average(); Double deviationScore = data.get(dataName).stream().mapToDouble(a->Math.pow((a-averageScore.getAsDouble()),2)).sum(); - if(averageScore.getAsDouble()<1){ - xpCSV.write(new ArrayList<>(Arrays.asList(dataName ,"AVERAGE" ,averageScore.getAsDouble()*100+"" ,"DEVIATION","" + 100*Math.sqrt(deviationScore/data.get(dataName).size())))); - }else{ - xpCSV.write(new ArrayList<>(Arrays.asList(dataName ,"AVERAGE" ,averageScore.getAsDouble()+"" ,"DEVIATION","" + Math.sqrt(deviationScore/data.get(dataName).size())))); - } + } - xpCSV.write(new ArrayList<>(Arrays.asList(" "))); + OptionalDouble averageScoreEndo = data.get("endogenousLearningSituations").stream().mapToDouble(a->a).average(); + Double deviationScoreEndo = data.get("endogenousLearningSituations").stream().mapToDouble(a->Math.pow((a-averageScoreEndo.getAsDouble()),2)).sum(); + xpCSV.write(new ArrayList<>(Arrays.asList("endogenousLearningSituations" ,"AVERAGE" ,averageScoreEndo.getAsDouble()+"" ,"DEVIATION","" + Math.sqrt(deviationScoreEndo/data.get("endogenousLearningSituations").size())))); + //Create the formatter for round the values of scores Locale currentLocale = Locale.getDefault(); DecimalFormatSymbols otherSymbols = new DecimalFormatSymbols(currentLocale); otherSymbols.setDecimalSeparator('.'); DecimalFormat df = new DecimalFormat("##.##", otherSymbols); - xpCSV.write(new ArrayList<>(Arrays.asList("ROUNDED"))); + for (String dataName : dataStrings){ OptionalDouble averageScore = data.get(dataName).stream().mapToDouble(a->a).average(); Double deviationScore = data.get(dataName).stream().mapToDouble(a->Math.pow((a-averageScore.getAsDouble()),2)).sum(); - if(averageScore.getAsDouble()<1){ - xpCSV.write(new ArrayList<>(Arrays.asList(dataName ,"AVERAGE" ,df.format(averageScore.getAsDouble()*100)+"" ,"DEVIATION","" + df.format(100*Math.sqrt(deviationScore/data.get(dataName).size()))))); - } + } - xpCSV.write(new ArrayList<>(Arrays.asList(" "))); + for (String dataName : dataStrings){ OptionalDouble averageScore = data.get(dataName).stream().mapToDouble(a->a).average(); Double deviationScore = data.get(dataName).stream().mapToDouble(a->Math.pow((a-averageScore.getAsDouble()),2)).sum(); - if(averageScore.getAsDouble()>=1){ - xpCSV.write(new ArrayList<>(Arrays.asList(dataName ,"AVERAGE" ,df.format(averageScore.getAsDouble())+"" ,"DEVIATION","" + df.format(Math.sqrt(deviationScore/data.get(dataName).size()))))); - } + } + + xpCSV.write(new ArrayList<>(Arrays.asList(" "))); OptionalDouble averageScore = data.get("prediction").stream().mapToDouble(a->a).average(); @@ -153,12 +149,12 @@ public class RobotLaunchExampleOneExperimentationWithArgs { Double deviationScoreDisp = data.get("predictionDisp").stream().mapToDouble(a->Math.pow((a-averageScoreDisp.getAsDouble()),2)).sum(); - xpCSV.write(new ArrayList<>(Arrays.asList("PREDICTION AVERAGE" , ""+averageScore.getAsDouble() ,"DEVIATION" ,""+Math.sqrt(deviationScore/data.get("prediction").size())))); - xpCSV.write(new ArrayList<>(Arrays.asList("DISPERSION AVERAGE" , ""+averageScoreDisp.getAsDouble() ,"DEVIATION" ,""+Math.sqrt(deviationScoreDisp/data.get("predictionDisp").size())))); + xpCSV.write(new ArrayList<>(Arrays.asList("GOAL ERROR AVERAGE" , ""+averageScore.getAsDouble() ,"DEVIATION" ,""+Math.sqrt(deviationScore/data.get("prediction").size())))); + xpCSV.write(new ArrayList<>(Arrays.asList("DEVIATION AVERAGE" , ""+averageScoreDisp.getAsDouble() ,"DEVIATION" ,""+Math.sqrt(deviationScoreDisp/data.get("predictionDisp").size())))); - xpCSV.write(new ArrayList<>(Arrays.asList("PREDICTION AVERAGE %" , ""+df.format(100*averageScore.getAsDouble()) ,"DEVIATION %" ,""+df.format(100*Math.sqrt(deviationScore/data.get("prediction").size()))))); - xpCSV.write(new ArrayList<>(Arrays.asList("DISPERSION AVERAGE %" , ""+df.format(100*averageScoreDisp.getAsDouble()) ,"DEVIATION %" ,""+df.format(100*Math.sqrt(deviationScoreDisp/data.get("predictionDisp").size()))))); + xpCSV.write(new ArrayList<>(Arrays.asList("GOAL ERROR AVERAGE %" , ""+df.format(100*averageScore.getAsDouble()) ,"DEVIATION %" ,""+df.format(100*Math.sqrt(deviationScore/data.get("prediction").size()))))); + xpCSV.write(new ArrayList<>(Arrays.asList("DEVIATION AVERAGE %" , ""+df.format(100*averageScoreDisp.getAsDouble()) ,"DEVIATION %" ,""+df.format(100*Math.sqrt(deviationScoreDisp/data.get("predictionDisp").size()))))); xpCSV.close(); diff --git a/ELLSAonAMAK/src/experiments/roboticArm/launchers/RobotLaunchExampleWithUIWithArgs.java b/ELLSAonAMAK/src/experiments/roboticArm/launchers/RobotLaunchExampleWithUIWithArgs.java index e5874d65362d42e14badd0b9fa36345967bd134b..de359565fb1688746e56f364ad18a49659e4ecc4 100644 --- a/ELLSAonAMAK/src/experiments/roboticArm/launchers/RobotLaunchExampleWithUIWithArgs.java +++ b/ELLSAonAMAK/src/experiments/roboticArm/launchers/RobotLaunchExampleWithUIWithArgs.java @@ -34,7 +34,6 @@ public class RobotLaunchExampleWithUIWithArgs extends Application{ PARAMS.nbTrainingCycle = Integer.parseInt(args[1]); PARAMS.nbRequestCycle = Integer.parseInt(args[2]); PARAMS.mappingErrorAllowed = ((double)Integer.parseInt(args[3]))/100; - System.out.println(PARAMS.mappingErrorAllowed); PARAMS.neighborhoodMultiplicator = Integer.parseInt(args[4]); PARAMS.extendedArmLength = (double)Integer.parseInt(args[5]); diff --git a/ELLSAonAMAK/src/experiments/roboticArm/simulation/RobotArmManager.java b/ELLSAonAMAK/src/experiments/roboticArm/simulation/RobotArmManager.java index 4b598dc639bbf0b4e67b54cc50c92f26ca61fde6..66d4c48acdd4202501b33db15f758fedeb54ecef 100644 --- a/ELLSAonAMAK/src/experiments/roboticArm/simulation/RobotArmManager.java +++ b/ELLSAonAMAK/src/experiments/roboticArm/simulation/RobotArmManager.java @@ -388,7 +388,7 @@ public class RobotArmManager { } }else{ - if(requestCycle%50==0) TRACE.print(TRACE_LEVEL.SUBCYCLE,"REQUEST [" + requestCycle + "] "); + if(requestCycle%50==0) TRACE.print(TRACE_LEVEL.SUBCYCLE,"EXPLOITATION [" + requestCycle + "] "); goalAngles = request(angles, poseGoal, cycle); @@ -438,7 +438,7 @@ public class RobotArmManager { } }else{ finished = true; - TRACE.print(TRACE_LEVEL.SUBCYCLE,"ERROR: "+averageError.getAsDouble() + " [ DISPERSION: " + Math.sqrt(errorDispersion/allGoalErrors.size()) + " ]"); + TRACE.print(TRACE_LEVEL.SUBCYCLE,"GOAL ERROR: "+averageError.getAsDouble() + " [ STANDARD DEVIATION: " + Math.sqrt(errorDispersion/allGoalErrors.size()) + " ]"); for (int i = 0;i<jointsNb;i++){ controller.setJoint(i,angles,0.0); diff --git a/ELLSAonAMAK/src/kernel/ELLSA.java b/ELLSAonAMAK/src/kernel/ELLSA.java index 6d0896d50e008dede20d5d68f0829f2ae2c0a839..f8311cb04287019c8cbfe0f3bc6335ec23d19be2 100644 --- a/ELLSAonAMAK/src/kernel/ELLSA.java +++ b/ELLSAonAMAK/src/kernel/ELLSA.java @@ -144,7 +144,6 @@ public class ELLSA extends Amas<World> implements IELLSA { if(amasMultiUIWindow!=null) { if(getCycle()==1){ - System.out.println(getPercepts().size()); for(int i =0;i<getPercepts().size();i++){ multiUIWindow.VUInDimensions.createAndAddString(10, 10 + getPercepts().size()*10 - 10*i,getPercepts().get(i).getName()).setFixed().setShowInExplorer(false); } diff --git a/documentation/README.md b/documentation/README.md new file mode 100644 index 0000000000000000000000000000000000000000..c0b4e0df295838648cf55499dfbee77fe24edbe4 --- /dev/null +++ b/documentation/README.md @@ -0,0 +1,47 @@ +# Running Experimentations + +## Prerequisites + +Install java JRE 8 +https://docs.oracle.com/javase/8/docs/technotes/guides/install/install_overview.html + + +## Allowed parameters + +number_of_joints: `2, 3, 6, 10, 20, 30` + +learning_situations: `any positive integer (1000 is used in the paper)` + +exploitation_situations: `any positive integer (200 is used in the paper)` + +number_of_episodes: `any positive integer (15 is used in the paper)` + +precision_range (%): `any positive integer between 1 and 10 (1 and 3 are used in the paper)` + +neighborhood_size: `2, 4, 6, 8, 10, 12, 14, 16` + +arm_length: `any positive integer (50 is used in the paper)` + +## Run experimentation with UI + +``` +java -jar experimentationWithUi.jar <number_of_joints> <learning_situations> <exploitation_situations> <precision_range> <neighborhood_size> <arm_length> +``` + +Example: ``-jar experimentationWithUi.jar 2 1000 200 3 2 50`` + +To start the learning, select the speed on the bottom left of the `Robot Arm Simulation` window. Step by step running is also possible. You can see the Context Agents by clicking on the button `Allow Rendering` in the `Multi-Agent System` window. ATTENTION: do no use the speed selection on the `Multi-Agent System` window. + +During exploitation, one simulation step shows the target goal and the next simulation step shows the result of the exploitation. + +After the exploitation is done, the goal error is displayed on the console and you can set the speed to `Stop` or close the windows. + + + +## Run experimentation with several learning episodes + +``` +java -jar experimentation.jar <number_of_joints> <learning_situations> <exploitation_situations> <number_of_episodes> <precision_range> <neighborhood_size> <arm_length> +``` +Example: ``-jar experimentation.jar 2 1000 200 15 3 2 50`` +