diff --git a/build.gradle b/build.gradle
index 7ea77b1..8aa69cf 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,6 +1,5 @@
plugins {
id 'java'
- id 'org.openjfx.javafxplugin' version '0.0.8'
}
group 'net.lwenstrom.jan'
@@ -19,8 +18,8 @@ dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
compileOnly 'org.projectlombok:lombok:1.18.10'
annotationProcessor 'org.projectlombok:lombok:1.18.10'
-}
+ compile 'org.javatuples:javatuples:1.2'
+ // https://mvnrepository.com/artifact/org.javatuples/javatuples
+ compile group: 'org.javatuples', name: 'javatuples', version: '1.2'
-javafx {
- modules = [ 'javafx.controls', 'javafx.fxml' ]
}
diff --git a/src/main/java/core/algo/MC/MonteCarloOnPolicyEGreedy.java b/src/main/java/core/algo/MC/MonteCarloOnPolicyEGreedy.java
index e9b02c9..f1a6d89 100644
--- a/src/main/java/core/algo/MC/MonteCarloOnPolicyEGreedy.java
+++ b/src/main/java/core/algo/MC/MonteCarloOnPolicyEGreedy.java
@@ -3,7 +3,7 @@ package core.algo.mc;
import core.*;
import core.algo.EpisodicLearning;
import core.policy.EpsilonGreedyPolicy;
-import javafx.util.Pair;
+import org.javatuples.Pair;
import java.io.IOException;
import java.io.ObjectInputStream;
@@ -82,12 +82,13 @@ public class MonteCarloOnPolicyEGreedy extends EpisodicLearning<
for (StepResult sr : episode) {
stateActionPairs.add(new Pair<>(sr.getState(), sr.getAction()));
}
+
//System.out.println("stateActionPairs " + stateActionPairs.size());
for (Pair stateActionPair : stateActionPairs) {
int firstOccurenceIndex = 0;
// find first occurance of state action pair
for (StepResult sr : episode) {
- if (stateActionPair.getKey().equals(sr.getState()) && stateActionPair.getValue().equals(sr.getAction())) {
+ if (stateActionPair.getValue0().equals(sr.getState()) && stateActionPair.getValue1().equals(sr.getAction())) {
break;
}
firstOccurenceIndex++;
@@ -101,7 +102,7 @@ public class MonteCarloOnPolicyEGreedy extends EpisodicLearning<
// if the key does not exists, it will create a new entry with G as default value
returnSum.merge(stateActionPair, G, Double::sum);
returnCount.merge(stateActionPair, 1, Integer::sum);
- stateActionTable.setValue(stateActionPair.getKey(), stateActionPair.getValue(), returnSum.get(stateActionPair) / returnCount.get(stateActionPair));
+ stateActionTable.setValue(stateActionPair.getValue0(), stateActionPair.getValue1(), returnSum.get(stateActionPair) / returnCount.get(stateActionPair));
}
}
diff --git a/src/main/java/core/gui/View.java b/src/main/java/core/gui/View.java
index af63a8f..dce75c6 100644
--- a/src/main/java/core/gui/View.java
+++ b/src/main/java/core/gui/View.java
@@ -3,8 +3,8 @@ package core.gui;
import core.Environment;
import core.algo.Learning;
import core.listener.ViewListener;
-import javafx.util.Pair;
import lombok.Getter;
+import org.javatuples.Pair;
import org.knowm.xchart.QuickChart;
import org.knowm.xchart.XChartPanel;
import org.knowm.xchart.XYChart;
@@ -132,8 +132,8 @@ public class View implements LearningView{
}else{
if(learningInfoPanel.isSmoothenGraphSelected()){
Pair, List> XYvalues = smoothenGraph(rewardHistory);
- xValues = XYvalues.getKey();
- yValues = XYvalues.getValue();
+ xValues = XYvalues.getValue0();
+ yValues = XYvalues.getValue1();
}else{
xValues = null;
yValues = rewardHistory;