Skip to content
Snippets Groups Projects
Commit 6115b867 authored by BrunoDatoMeneses's avatar BrunoDatoMeneses
Browse files

SUB: code submited to AAAI

parent 3325c421
Branches AAAI
No related tags found
No related merge requests found
......@@ -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;
......
......@@ -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();
......
......@@ -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]);
......
......@@ -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);
......
......@@ -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);
}
......
# 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``
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment