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

ADD: new minimal mains for amoeba

parent 3a7db9ca
Branches
No related tags found
1 merge request!4Exp rein
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()));
}
}
}
package experiments;
import fr.irit.smac.amak.Configuration;
import kernel.AMOEBA;
import kernel.StudiedSystem;
......@@ -8,15 +9,32 @@ import kernel.StudiedSystem;
* @author Hugo
*
*/
public class MinimalMain {
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("resources/twoDimensionsLauncher.xml", studiedSystem);
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()));
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment