diff --git a/AMOEBAonAMAK/src/experiments/Benchmark.java b/AMOEBAonAMAK/src/experiments/Benchmark.java index 17c5376ea16351c8290ce2ca1e704656b83408ba..f4b7946335f0af9b5b0ebfa1620d425d9caf8837 100644 --- a/AMOEBAonAMAK/src/experiments/Benchmark.java +++ b/AMOEBAonAMAK/src/experiments/Benchmark.java @@ -43,7 +43,7 @@ public class Benchmark { private static void execLearn(int nbCycle, String configFile) { System.out.println("Start "+nbCycle+" learning cycles."); - AMOEBA amoeba = new AMOEBA(); + AMOEBA amoeba = new AMOEBA(null,null); BackupSystem bs = new BackupSystem(amoeba); bs.load(new File(configFile)); StudiedSystem ss = new NDimCube(50, amoeba.getPercepts().size()); @@ -67,7 +67,7 @@ public class Benchmark { private static void execRequest(int nbCycle, String configFile) { System.out.println("Start "+nbCycle+" request cycles."); - AMOEBA amoeba = new AMOEBA(); + AMOEBA amoeba = new AMOEBA(null,null); BackupSystem bs = new BackupSystem(amoeba); bs.load(new File(configFile)); StudiedSystem ss = new NDimCube(50, amoeba.getPercepts().size()); diff --git a/AMOEBAonAMAK/src/experiments/BenchmarkThreading.java b/AMOEBAonAMAK/src/experiments/BenchmarkThreading.java index 58529462bf7b4a9ae7054e3d2860d7408c912bea..e858a57d5a32a96d3da7d0661794a92bde08cfa7 100644 --- a/AMOEBAonAMAK/src/experiments/BenchmarkThreading.java +++ b/AMOEBAonAMAK/src/experiments/BenchmarkThreading.java @@ -116,7 +116,7 @@ public class BenchmarkThreading { // setup cache --- (very important to reduce impact of the 1st measure) Configuration.allowedSimultaneousAgentsExecution = 1; StudiedSystem learnSystem = new NDimCube(50.0, 100); - AMOEBA amoeba = new AMOEBA(); + AMOEBA amoeba = new AMOEBA(null,null); amoeba.setStudiedSystem(learnSystem); IBackupSystem backupSystem = new BackupSystem(amoeba); backupSystem.load(file); @@ -127,7 +127,7 @@ public class BenchmarkThreading { for(int thd = 1; thd <= 8; thd *= 2) { Configuration.allowedSimultaneousAgentsExecution = thd; learnSystem = new NDimCube(50.0, 100); - amoeba = new AMOEBA(); + amoeba = new AMOEBA(null,null); backupSystem = new BackupSystem(amoeba); backupSystem.load(file); List<List<Double>> bench = benchmark(amoeba, learnSystem, learnSystem, 0, 10000, 1000, null); diff --git a/AMOEBAonAMAK/src/experiments/Main.java b/AMOEBAonAMAK/src/experiments/Main.java index 4cd5643ea4f16c72567fe716d54b72cd9223787b..721e209ebdd996c13a773954808eb66aa9d84c38 100644 --- a/AMOEBAonAMAK/src/experiments/Main.java +++ b/AMOEBAonAMAK/src/experiments/Main.java @@ -39,7 +39,7 @@ public class Main { } System.out.println("Creating the amoeba"); - AMOEBA amoeba = new AMOEBA(configFile, ss); + AMOEBA amoeba = new AMOEBA(null,null,configFile, ss); synchronized (Thread.currentThread()){ try { diff --git a/AMOEBAonAMAK/src/experiments/SimpleReinforcement.java b/AMOEBAonAMAK/src/experiments/SimpleReinforcement.java index 85be42842f749fcb26b09c7ae377c9c3a386bf30..5e5ffcf7c8b290b14382bbca045fa8d7c2dc3c7d 100644 --- a/AMOEBAonAMAK/src/experiments/SimpleReinforcement.java +++ b/AMOEBAonAMAK/src/experiments/SimpleReinforcement.java @@ -49,7 +49,7 @@ public class SimpleReinforcement { } Configuration.commandLineMode = true; - AMOEBA amoeba = new AMOEBA(config.getAbsolutePath(), null); + AMOEBA amoeba = new AMOEBA(null,null,config.getAbsolutePath(), null); amoeba.saver = new SaveHelperDummy(); SimpleReinforcement env = new SimpleReinforcement(); diff --git a/AMOEBAonAMAK/src/experiments/UnityLauncher/Main.java b/AMOEBAonAMAK/src/experiments/UnityLauncher/Main.java index 099acfb8fc051ddd4d8bdc9e921b199dc79844f7..80756bc9c9159796e795102ae6fd2530802cef93 100644 --- a/AMOEBAonAMAK/src/experiments/UnityLauncher/Main.java +++ b/AMOEBAonAMAK/src/experiments/UnityLauncher/Main.java @@ -76,7 +76,7 @@ public class Main implements Runnable { Configuration.waitForGUI = true; Configuration.plotMilliSecondsUpdate = 20000; - AMOEBA amoeba = new AMOEBA(); + AMOEBA amoeba = new AMOEBA(null,null); StudiedSystem studiedSystem = new F_N_Manager(spaceSize, dimension, nbOfModels, normType, randomExploration, explorationIncrement,explorationWidht,limitedToSpaceZone, oracleNoiseRange); amoeba.setStudiedSystem(studiedSystem); IBackupSystem backupSystem = new BackupSystem(amoeba); diff --git a/AMOEBAonAMAK/src/experiments/nDimensionsLaunchers/F_N_Launcher.java b/AMOEBAonAMAK/src/experiments/nDimensionsLaunchers/F_N_Launcher.java index ffd17fe59ad4e7b8d2bcd7b5023e7057099d6127..f984ebe3760c85448c5f8e3cdfbd7817b1892753 100644 --- a/AMOEBAonAMAK/src/experiments/nDimensionsLaunchers/F_N_Launcher.java +++ b/AMOEBAonAMAK/src/experiments/nDimensionsLaunchers/F_N_Launcher.java @@ -7,10 +7,14 @@ import java.util.ArrayList; import experiments.FILE; import fr.irit.smac.amak.Configuration; +import fr.irit.smac.amak.ui.VUIMulti; +import gui.AmoebaMultiUIWindow; import gui.AmoebaWindow; +import javafx.application.Application; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.scene.control.Slider; +import javafx.stage.Stage; import kernel.AMOEBA; import kernel.StudiedSystem; import kernel.backup.BackupSystem; @@ -21,7 +25,7 @@ import kernel.backup.SaveHelperImpl; /** * The Class BadContextLauncherEasy. */ -public class F_N_Launcher implements Serializable { +public class F_N_Launcher extends Application implements Serializable { public static final double oracleNoiseRange = 0.5; @@ -43,27 +47,28 @@ public class F_N_Launcher implements Serializable { public static void main(String[] args) throws IOException { - // Instantiating the MainWindow before usage. - // It also allows you to change some of its behavior before creating an AMOEBA. - // If you use Configuration.commandLineMode = True , then you should skip it. - AmoebaWindow.instance(); - launch(); + + + Application.launch(args); + + } + @Override + public void start(Stage arg0) throws Exception { + - public static void launch() throws IOException{ - - - - // Set AMAK configuration before creating an AMOEBA + Configuration.multiUI=true; Configuration.commandLineMode = false; Configuration.allowedSimultaneousAgentsExecution = 1; Configuration.waitForGUI = true; Configuration.plotMilliSecondsUpdate = 20000; - AMOEBA amoeba = new AMOEBA(); + VUIMulti amoebaVUI = new VUIMulti("2D"); + AmoebaMultiUIWindow amoebaUI = new AmoebaMultiUIWindow("ELLSA", amoebaVUI); + AMOEBA amoeba = new AMOEBA(amoebaUI, amoebaVUI); StudiedSystem studiedSystem = new F_N_Manager(spaceSize, dimension, nbOfModels, normType, randomExploration, explorationIncrement,explorationWidht,limitedToSpaceZone, oracleNoiseRange); amoeba.setStudiedSystem(studiedSystem); IBackupSystem backupSystem = new BackupSystem(amoeba); @@ -90,65 +95,66 @@ public class F_N_Launcher implements Serializable { amoeba.getEnvironment().setMappingErrorAllowed(mappingErrorAllowed); } }); - AmoebaWindow.addToolbar(slider); + amoebaUI.addToolbar(slider); studiedSystem.playOneStep(); amoeba.learn(studiedSystem.getOutput()); /* AUTOMATIC */ -// long start = System.currentTimeMillis(); -// for (int i = 0; i < nbCycle; ++i) { -// studiedSystem.playOneStep(); -// amoeba.learn(studiedSystem.getOutput()); -// } -// long end = System.currentTimeMillis(); -// System.out.println("Done in : " + (end - start) ); -// -// start = System.currentTimeMillis(); -// for (int i = 0; i < nbCycle; ++i) { -// studiedSystem.playOneStep(); -// amoeba.request(studiedSystem.getOutput()); -// } -// end = System.currentTimeMillis(); -// System.out.println("Done in : " + (end - start) ); - - -// /* XP PIERRE */ -// -// String fileName = fileName(new ArrayList<String>(Arrays.asList("GaussiennePierre"))); -// -// FILE Pierrefile = new FILE("Pierre",fileName); -// for (int i = 0; i < nbCycle; ++i) { -// studiedSystem.playOneStep(); -// amoeba.learn(studiedSystem.getOutput()); -// if(amoeba.getHeadAgent().isActiveLearning()) { -// studiedSystem.setActiveLearning(true); -// studiedSystem.setSelfRequest(amoeba.getHeadAgent().getSelfRequest()); -// -// } -// } -// -// for (int i = 0; i < 10; ++i) { -// studiedSystem.playOneStep(); -// System.out.println(studiedSystem.getOutput()); -// System.out.println(amoeba.request(studiedSystem.getOutput())); -// -// -// } -// -// Pierrefile.write(new ArrayList<String>(Arrays.asList("ID contexte","Coeff Cte","Coeff X0","Coeff X1","Min Value","Max Value"))); -// -// for(Context ctxt : amoeba.getContexts()) { -// -// writeMessage(Pierrefile, ctxt.toStringArrayPierre()); +// long start = System.currentTimeMillis(); +// for (int i = 0; i < nbCycle; ++i) { +// studiedSystem.playOneStep(); +// amoeba.learn(studiedSystem.getOutput()); +// } +// long end = System.currentTimeMillis(); +// System.out.println("Done in : " + (end - start) ); +// +// start = System.currentTimeMillis(); +// for (int i = 0; i < nbCycle; ++i) { +// studiedSystem.playOneStep(); +// amoeba.request(studiedSystem.getOutput()); +// } +// end = System.currentTimeMillis(); +// System.out.println("Done in : " + (end - start) ); + + +// /* XP PIERRE */ +// +// String fileName = fileName(new ArrayList<String>(Arrays.asList("GaussiennePierre"))); +// +// FILE Pierrefile = new FILE("Pierre",fileName); +// for (int i = 0; i < nbCycle; ++i) { +// studiedSystem.playOneStep(); +// amoeba.learn(studiedSystem.getOutput()); +// if(amoeba.getHeadAgent().isActiveLearning()) { +// studiedSystem.setActiveLearning(true); +// studiedSystem.setSelfRequest(amoeba.getHeadAgent().getSelfRequest()); +// +// } +// } +// +// for (int i = 0; i < 10; ++i) { +// studiedSystem.playOneStep(); +// System.out.println(studiedSystem.getOutput()); +// System.out.println(amoeba.request(studiedSystem.getOutput())); +// +// +// } +// +// Pierrefile.write(new ArrayList<String>(Arrays.asList("ID contexte","Coeff Cte","Coeff X0","Coeff X1","Min Value","Max Value"))); +// +// for(Context ctxt : amoeba.getContexts()) { +// +// writeMessage(Pierrefile, ctxt.toStringArrayPierre()); // -// } -// -// -// Pierrefile.close(); +// } +// +// +// Pierrefile.close(); - } + + public static String fileName(ArrayList<String> infos) { String fileName = ""; @@ -171,4 +177,8 @@ public class F_N_Launcher implements Serializable { file.sendManualMessage(); } + + + + } diff --git a/AMOEBAonAMAK/src/experiments/nDimensionsLaunchers/F_N_LauncherMultiUI.java b/AMOEBAonAMAK/src/experiments/nDimensionsLaunchers/F_N_LauncherMultiUI.java index a428677290f1152cd3399a677b2069727c685347..123a9434a2a39f554370f34d16f84012a502d566 100644 --- a/AMOEBAonAMAK/src/experiments/nDimensionsLaunchers/F_N_LauncherMultiUI.java +++ b/AMOEBAonAMAK/src/experiments/nDimensionsLaunchers/F_N_LauncherMultiUI.java @@ -67,7 +67,7 @@ public class F_N_LauncherMultiUI extends Application implements Serializable { Configuration.waitForGUI = true; Configuration.plotMilliSecondsUpdate = 20000; - VUIMulti amoebaVUI = VUIMulti.get("2D"); + VUIMulti amoebaVUI = new VUIMulti("2D"); AmoebaMultiUIWindow amoebaUI = new AmoebaMultiUIWindow("ELLSA", amoebaVUI); AMOEBA amoeba = new AMOEBA(amoebaUI, amoebaVUI); StudiedSystem studiedSystem = new F_N_Manager(spaceSize, dimension, nbOfModels, normType, randomExploration, explorationIncrement,explorationWidht,limitedToSpaceZone, oracleNoiseRange); diff --git a/AMOEBAonAMAK/src/ros/Main.java b/AMOEBAonAMAK/src/ros/Main.java index e5d502c6c7e510dba9e4612e0145f5fc8a0561b6..b0a594150f3710bc932385dcdff4813a7769b2f8 100644 --- a/AMOEBAonAMAK/src/ros/Main.java +++ b/AMOEBAonAMAK/src/ros/Main.java @@ -30,7 +30,7 @@ public class Main { } } - AMOEBA amoeba = new AMOEBA(config, null); + AMOEBA amoeba = new AMOEBA(null,null,config, null); amoeba.allowGraphicalScheduler(false); RosBridge bridge = new RosBridge();