diff --git a/AMOEBAonAMAK/src/experiments/MinimalMain.java b/AMOEBAonAMAK/src/experiments/MinimalMain.java deleted file mode 100644 index b9b0bde35821831dfe658b762a50be32ceb0540a..0000000000000000000000000000000000000000 --- a/AMOEBAonAMAK/src/experiments/MinimalMain.java +++ /dev/null @@ -1,22 +0,0 @@ -package experiments; - -import kernel.AMOEBA; -import kernel.StudiedSystem; - -/** - * The most minimal main possible producing a functioning amoeba. - * @author Hugo - * - */ -public class MinimalMain { - - public static void main(String[] args) throws InterruptedException { - // create a system to be studied - StudiedSystem studiedSystem = new F_XY_System(50.0); - // create the amoeba - // Make sure the path to the config file is correct. - AMOEBA amoeba = new AMOEBA("resources/twoDimensionsLauncher.xml", studiedSystem); - // a window should have appeared, allowing you to control and visualize the amoeba. - } - -} diff --git a/AMOEBAonAMAK/src/experiments/MinimalMainCommandLineMode.java b/AMOEBAonAMAK/src/experiments/MinimalMainCommandLineMode.java new file mode 100644 index 0000000000000000000000000000000000000000..d57dfb6fab68c4228f1c088e2d2c2cc19b06b0bf --- /dev/null +++ b/AMOEBAonAMAK/src/experiments/MinimalMainCommandLineMode.java @@ -0,0 +1,40 @@ +package experiments; + +import fr.irit.smac.amak.Configuration; +import kernel.AMOEBA; +import kernel.StudiedSystem; + +/** + * The most minimal main possible producing a functioning amoeba. + * @author Hugo + * + */ +public class MinimalMainCommandLineMode { + + public static void main(String[] args) throws InterruptedException { + + Configuration.commandLineMode = true; + + // create a system to be studied + StudiedSystem studiedSystem = new F_XY_System(50.0); + // create the amoeba + // Make sure the path to the config file is correct. + AMOEBA amoeba = new AMOEBA(null,null,"resources/twoDimensionsLauncher.xml", studiedSystem); + // a window should have appeared, allowing you to control and visualize the amoeba. + + // Learning and Request example + long start = System.currentTimeMillis(); + for (int i = 0; i < 1001; ++i) { + studiedSystem.playOneStep(); + amoeba.learn(studiedSystem.getOutput()); + } + long end = System.currentTimeMillis(); + System.out.println("Done in : " + (end - start) + " ms"); + + for (int i = 0; i < 10; ++i) { + studiedSystem.playOneStep(); + System.out.println(amoeba.request(studiedSystem.getOutput())); + } + } + +} diff --git a/AMOEBAonAMAK/src/experiments/MinimalMainUI.java b/AMOEBAonAMAK/src/experiments/MinimalMainUI.java new file mode 100644 index 0000000000000000000000000000000000000000..074596944882d8c54c4c104060d81602d3365698 --- /dev/null +++ b/AMOEBAonAMAK/src/experiments/MinimalMainUI.java @@ -0,0 +1,40 @@ +package experiments; + +import fr.irit.smac.amak.Configuration; +import kernel.AMOEBA; +import kernel.StudiedSystem; + +/** + * The most minimal main possible producing a functioning amoeba. + * @author Hugo + * + */ +public class MinimalMainUI {//TODO + + public static void main(String[] args) throws InterruptedException { + + Configuration.commandLineMode = false; + + // create a system to be studied + StudiedSystem studiedSystem = new F_XY_System(50.0); + // create the amoeba + // Make sure the path to the config file is correct. + AMOEBA amoeba = new AMOEBA(null,null,"resources/twoDimensionsLauncher.xml", studiedSystem); + // a window should have appeared, allowing you to control and visualize the amoeba. + + // Learning and Request example + long start = System.currentTimeMillis(); + for (int i = 0; i < 1001; ++i) { + studiedSystem.playOneStep(); + amoeba.learn(studiedSystem.getOutput()); + } + long end = System.currentTimeMillis(); + System.out.println("Done in : " + (end - start) + " ms"); + + for (int i = 0; i < 10; ++i) { + studiedSystem.playOneStep(); + System.out.println(amoeba.request(studiedSystem.getOutput())); + } + } + +}