From b9c3f65b0984301c9ed5f5728b3ceb4482949294 Mon Sep 17 00:00:00 2001
From: Franck Dary <franck.dary@lis-lab.fr>
Date: Mon, 1 Jul 2019 14:16:13 +0200
Subject: [PATCH] Improved systematic backtracking oracle

---
 transition_machine/src/ActionBank.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/transition_machine/src/ActionBank.cpp b/transition_machine/src/ActionBank.cpp
index 4dbf8e3..cadee4f 100644
--- a/transition_machine/src/ActionBank.cpp
+++ b/transition_machine/src/ActionBank.cpp
@@ -567,6 +567,11 @@ std::vector<Action::BasicAction> ActionBank::str2sequence(const std::string & na
           if (c.pastActions.size() == 0)
             return false;
 
+          if (c.getCurrentStateHistory().size() > 0 && c.getCurrentStateHistory().top() != "EPSILON")
+          {
+            return false;
+          }
+
           const std::string & classifierName = c.pastActions.top().first;
 
           if (c.hashHistory.contains(c.computeHash()))
@@ -580,10 +585,10 @@ std::vector<Action::BasicAction> ActionBank::str2sequence(const std::string & na
             {
               topIndex++;
 
-              if (topIndex >= c.pastActions.size())
+              if (topIndex > c.pastActions.size())
                 return;
 
-              if (c.pastActions.getElem(topIndex).first == classifierName)
+              if (c.pastActions.getElem(topIndex-1).first == classifierName)
                 return;
             }
           };
-- 
GitLab