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

FIX: vui init

parent d6f731d2
No related branches found
No related tags found
1 merge request!4Exp rein
......@@ -166,7 +166,8 @@ public class Amas<E extends Environment> implements Schedulable {
amasMultiUIWindow = window;
vuiMulti = vui;
vuiMulti.addTabbedDefaultPanel(amasMultiUIWindow);
amasMultiUIWindow.addTabbedPanel(vuiMulti.title, vuiMulti.getPanel());
//vuiMulti.addTabbedDefaultPanel(amasMultiUIWindow);
executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(Configuration.allowedSimultaneousAgentsExecution);
......
......@@ -41,6 +41,9 @@ import javafx.scene.text.TextAlignment;
*
*/
public class VUIMulti {
public String title;
/**
* The toolbar of the VUI.
*/
......@@ -178,8 +181,9 @@ public class VUIMulti {
* @param title
* The title used for the vui
*/
private VUIMulti(String title) {
private VUIMulti(String titleValue) {
this.title = titleValue;
Semaphore done = new Semaphore(0);
RunLaterHelper.runLater(() -> {
panel = new BorderPane();
......
......@@ -70,7 +70,6 @@ public class F_N_LauncherMultiUI extends Application implements Serializable {
VUIMulti amoebaVUI = VUIMulti.get("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);
......@@ -101,86 +100,91 @@ public class F_N_LauncherMultiUI extends Application implements Serializable {
studiedSystem.playOneStep();
amoeba.learn(studiedSystem.getOutput());
studiedSystem.playOneStep();
amoeba.learn(studiedSystem.getOutput());
studiedSystem.playOneStep();
amoeba.learn(studiedSystem.getOutput());
studiedSystem.playOneStep();
amoeba.learn(studiedSystem.getOutput());
VUIMulti amoebaVUI2 = VUIMulti.get("2D");
AmoebaMultiUIWindow amoebaUI2 = new AmoebaMultiUIWindow("ELLSA", amoebaVUI2);
AMOEBA amoeba2 = new AMOEBA(amoebaUI2, amoebaVUI2);
StudiedSystem studiedSystem2 = new F_N_Manager(spaceSize, dimension, nbOfModels, normType, randomExploration, explorationIncrement,explorationWidht,limitedToSpaceZone, oracleNoiseRange);
amoeba2.setStudiedSystem(studiedSystem2);
IBackupSystem backupSystem2 = new BackupSystem(amoeba2);
File file2 = new File("resources/twoDimensionsLauncher.xml");
backupSystem2.load(file2);
amoeba2.saver = new SaveHelperImpl(amoeba2);
amoeba2.allowGraphicalScheduler(true);
amoeba2.setRenderUpdate(true);
amoeba2.data.learningSpeed = learningSpeed;
amoeba2.data.numberOfPointsForRegression = regressionPoints;
amoeba2.getEnvironment().setMappingErrorAllowed(mappingErrorAllowed);
// Exemple for adding a tool in the toolbar
Slider slider2 = new Slider(0.01, 0.1, mappingErrorAllowed);
slider2.setShowTickLabels(true);
slider2.setShowTickMarks(true);
long start = System.currentTimeMillis();
for (int i = 0; i < 100; ++i) {
System.out.println(i);
studiedSystem.playOneStep();
amoeba.learn(studiedSystem.getOutput());
}
long end = System.currentTimeMillis();
System.out.println("Done in : " + (end - start) );
slider2.valueProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
System.out.println("new Value "+newValue);
mappingErrorAllowed = (double)newValue;
amoeba2.getEnvironment().setMappingErrorAllowed(mappingErrorAllowed);
}
});
amoebaUI2.addToolbar(slider2);
// VUIMulti amoebaVUI2 = VUIMulti.get("2D");
// AmoebaMultiUIWindow amoebaUI2 = new AmoebaMultiUIWindow("ELLSA", amoebaVUI2);
// AMOEBA amoeba2 = new AMOEBA(amoebaUI2, amoebaVUI2);
//
// StudiedSystem studiedSystem2 = new F_N_Manager(spaceSize, dimension, nbOfModels, normType, randomExploration, explorationIncrement,explorationWidht,limitedToSpaceZone, oracleNoiseRange);
// amoeba2.setStudiedSystem(studiedSystem2);
// IBackupSystem backupSystem2 = new BackupSystem(amoeba2);
// File file2 = new File("resources/twoDimensionsLauncher.xml");
// backupSystem2.load(file2);
//
// amoeba2.saver = new SaveHelperImpl(amoeba2);
// amoeba2.allowGraphicalScheduler(true);
// amoeba2.setRenderUpdate(true);
// amoeba2.data.learningSpeed = learningSpeed;
// amoeba2.data.numberOfPointsForRegression = regressionPoints;
// amoeba2.getEnvironment().setMappingErrorAllowed(mappingErrorAllowed);
//
// // Exemple for adding a tool in the toolbar
// Slider slider2 = new Slider(0.01, 0.1, mappingErrorAllowed);
// slider2.setShowTickLabels(true);
// slider2.setShowTickMarks(true);
//
// slider2.valueProperty().addListener(new ChangeListener<Number>() {
// @Override
// public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
// System.out.println("new Value "+newValue);
// mappingErrorAllowed = (double)newValue;
// amoeba2.getEnvironment().setMappingErrorAllowed(mappingErrorAllowed);
// }
// });
// amoebaUI2.addToolbar(slider2);
//
// studiedSystem2.playOneStep();
// amoeba2.learn(studiedSystem2.getOutput());
studiedSystem2.playOneStep();
amoeba2.learn(studiedSystem2.getOutput());
// try {
// Thread.sleep(2000) ;
// } catch (InterruptedException e) {
// // gestion de l'erreur
// }
//
// 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) );
}
@Override
public void stop() throws Exception {
super.stop();
System.exit(0);
}
public static void launch() throws IOException{
// Set AMAK configuration before creating an AMOEBA
AMOEBA amoeba = new AMOEBA(null, VUIMulti.get("2D"));
StudiedSystem studiedSystem = new F_N_Manager(spaceSize, dimension, nbOfModels, normType, randomExploration, explorationIncrement,explorationWidht,limitedToSpaceZone, oracleNoiseRange);
amoeba.setStudiedSystem(studiedSystem);
IBackupSystem backupSystem = new BackupSystem(amoeba);
File file = new File("resources/twoDimensionsLauncher.xml");
backupSystem.load(file);
amoeba.saver = new SaveHelperImpl(amoeba);
amoeba.allowGraphicalScheduler(true);
amoeba.setRenderUpdate(true);
amoeba.data.learningSpeed = learningSpeed;
amoeba.data.numberOfPointsForRegression = regressionPoints;
amoeba.getEnvironment().setMappingErrorAllowed(mappingErrorAllowed);
// Exemple for adding a tool in the toolbar
Slider slider = new Slider(0.01, 0.1, mappingErrorAllowed);
slider.setShowTickLabels(true);
slider.setShowTickMarks(true);
slider.valueProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
System.out.println("new Value "+newValue);
mappingErrorAllowed = (double)newValue;
amoeba.getEnvironment().setMappingErrorAllowed(mappingErrorAllowed);
}
});
AmoebaWindow.addToolbar(slider);
studiedSystem.playOneStep();
amoeba.learn(studiedSystem.getOutput());
/* AUTOMATIC */
// long start = System.currentTimeMillis();
......
......@@ -58,7 +58,7 @@ public class AmoebaMultiUIWindow extends AmasMultiUIWindow{
mainVUI.setDefaultView(200, 0, 0);
addTabbedPanel("2D VUI", mainVUI.getPanel());
//addTabbedPanel("2D VUI", mainVUI.getPanel());
// scheduler toolbar
schedulerToolbar = new SchedulerToolbar("AMOEBA", amoeba.getScheduler());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment