diff --git a/maca_common/include/LimitedStack.hpp b/maca_common/include/LimitedStack.hpp index 06d08608a91588f71a672a45a5d3ad6dfddf062a..46400380493aac26bea01b954bfaeca4220bdc9b 100644 --- a/maca_common/include/LimitedStack.hpp +++ b/maca_common/include/LimitedStack.hpp @@ -13,11 +13,12 @@ namespace std { template<> - struct hash< std::pair<std::string, Action> > + struct hash< pair<string, Action> > { - size_t operator()(const std::pair<std::string, Action> &p) const + size_t operator()(const pair<std::string, Action> & p) const { - return 0; + static hash<string> h; + return h(p.first + p.second.name); } }; } @@ -43,6 +44,7 @@ class LimitedStack { nbElements = 0; lastElementIndex = -1; + present.clear(); } void push(T elem) diff --git a/trainer/src/Trainer.cpp b/trainer/src/Trainer.cpp index b035da2935394476ed8ae3d100ca2d22567a2dce..fd46e97d4d5e78b8ad407554fa4d0aaf062bfcff 100644 --- a/trainer/src/Trainer.cpp +++ b/trainer/src/Trainer.cpp @@ -381,7 +381,6 @@ void Trainer::doStepTrain() } std::string normalClassifierName(buffer); - auto & errorHistory = trainConfig.getActionsHistory(tm.getCurrentClassifier()->name); auto & normalHistory = trainConfig.getActionsHistory(normalClassifierName); // If a BACK just happened diff --git a/transition_machine/include/Config.hpp b/transition_machine/include/Config.hpp index de3dd7a1792343e9f35f099e0c67ae9f9cba92b8..9aba457bffa52f274d01ca11507e287d6d8daabd 100644 --- a/transition_machine/include/Config.hpp +++ b/transition_machine/include/Config.hpp @@ -134,7 +134,7 @@ class Config private : - const unsigned int HISTORY_SIZE = 100000000; + const unsigned int HISTORY_SIZE = 100000; /// @brief The name of the current state of the TransitionMachine. std::string currentStateName; /// @brief For each state of the TransitionMachine, an history of the Action that have been applied to this Config. diff --git a/transition_machine/src/Config.cpp b/transition_machine/src/Config.cpp index f4612e013bd917937452b8b4e2e461e0703f6768..64cad5abe5771618891e0b6a18d9816f56c46cc9 100644 --- a/transition_machine/src/Config.cpp +++ b/transition_machine/src/Config.cpp @@ -437,7 +437,7 @@ void Config::addToEntropyHistory(float entropy) std::size_t Config::computeHash() { - static int window = 3; + static int window = 10; int start = std::max(0, head-window); int end = std::min(tapes[0].refSize()-1, head+window);