Skip to content
Snippets Groups Projects
Commit f6f90445 authored by Franck Dary's avatar Franck Dary
Browse files

Deleted argument headMvt from setInfos

parent 332565c7
No related branches found
No related tags found
No related merge requests found
...@@ -180,7 +180,7 @@ void applyActionAndTakeTransition(TransitionMachine & tm, const std::string & ac ...@@ -180,7 +180,7 @@ void applyActionAndTakeTransition(TransitionMachine & tm, const std::string & ac
{ {
Action * action = tm.getCurrentClassifier()->getAction(actionName); Action * action = tm.getCurrentClassifier()->getAction(actionName);
TransitionMachine::Transition * transition = tm.getTransition(actionName); TransitionMachine::Transition * transition = tm.getTransition(actionName);
action->setInfos(transition->headMvt, tm.getCurrentClassifier()->name); action->setInfos(tm.getCurrentClassifier()->name);
config.addToActionsHistory(tm.getCurrentClassifier()->name, actionName, 0); config.addToActionsHistory(tm.getCurrentClassifier()->name, actionName, 0);
action->apply(config); action->apply(config);
tm.takeTransition(transition); tm.takeTransition(transition);
......
...@@ -75,7 +75,7 @@ void Trainer::computeScoreOnDev() ...@@ -75,7 +75,7 @@ void Trainer::computeScoreOnDev()
std::string neededActionName = tm.getCurrentClassifier()->getActionName(neededActionIndex); std::string neededActionName = tm.getCurrentClassifier()->getActionName(neededActionIndex);
Action * action = tm.getCurrentClassifier()->getAction(neededActionName); Action * action = tm.getCurrentClassifier()->getAction(neededActionName);
TransitionMachine::Transition * transition = tm.getTransition(neededActionName); TransitionMachine::Transition * transition = tm.getTransition(neededActionName);
action->setInfos(transition->headMvt, tm.getCurrentClassifier()->name); action->setInfos(tm.getCurrentClassifier()->name);
action->apply(*devConfig); action->apply(*devConfig);
tm.takeTransition(transition); tm.takeTransition(transition);
...@@ -134,7 +134,7 @@ void Trainer::computeScoreOnDev() ...@@ -134,7 +134,7 @@ void Trainer::computeScoreOnDev()
} }
TransitionMachine::Transition * transition = tm.getTransition(actionName); TransitionMachine::Transition * transition = tm.getTransition(actionName);
action->setInfos(transition->headMvt, tm.getCurrentClassifier()->name); action->setInfos(tm.getCurrentClassifier()->name);
devConfig->addToActionsHistory(tm.getCurrentClassifier()->name, actionName, tm.getCurrentClassifier()->getActionCost(*devConfig, actionName)); devConfig->addToActionsHistory(tm.getCurrentClassifier()->name, actionName, tm.getCurrentClassifier()->getActionCost(*devConfig, actionName));
action->apply(*devConfig); action->apply(*devConfig);
...@@ -210,7 +210,7 @@ void Trainer::doStepNoTrain() ...@@ -210,7 +210,7 @@ void Trainer::doStepNoTrain()
Action * action = tm.getCurrentClassifier()->getAction(neededActionName); Action * action = tm.getCurrentClassifier()->getAction(neededActionName);
TransitionMachine::Transition * transition = tm.getTransition(neededActionName); TransitionMachine::Transition * transition = tm.getTransition(neededActionName);
action->setInfos(transition->headMvt, tm.getCurrentClassifier()->name); action->setInfos(tm.getCurrentClassifier()->name);
trainConfig.addToActionsHistory(tm.getCurrentClassifier()->name, action->name, tm.getCurrentClassifier()->getActionCost(trainConfig, action->name)); trainConfig.addToActionsHistory(tm.getCurrentClassifier()->name, action->name, tm.getCurrentClassifier()->getActionCost(trainConfig, action->name));
action->apply(trainConfig); action->apply(trainConfig);
...@@ -464,7 +464,7 @@ void Trainer::doStepTrain() ...@@ -464,7 +464,7 @@ void Trainer::doStepTrain()
Action * action = tm.getCurrentClassifier()->getAction(actionName); Action * action = tm.getCurrentClassifier()->getAction(actionName);
TransitionMachine::Transition * transition = tm.getTransition(actionName); TransitionMachine::Transition * transition = tm.getTransition(actionName);
action->setInfos(transition->headMvt, tm.getCurrentClassifier()->name); action->setInfos(tm.getCurrentClassifier()->name);
trainConfig.addToActionsHistory(tm.getCurrentClassifier()->name, actionName, tm.getCurrentClassifier()->getActionCost(trainConfig, actionName)); trainConfig.addToActionsHistory(tm.getCurrentClassifier()->name, actionName, tm.getCurrentClassifier()->getActionCost(trainConfig, actionName));
......
...@@ -66,8 +66,6 @@ class Action ...@@ -66,8 +66,6 @@ class Action
/// This is useful to maintain a history of past actions, keeping only the type of the actions. /// This is useful to maintain a history of past actions, keeping only the type of the actions.
std::string namePrefix; std::string namePrefix;
/// @brief The movement of the machine's head associated with this action.
int headMovement;
/// @brief The name of the machine's current state when this action was performed. /// @brief The name of the machine's current state when this action was performed.
std::string stateName; std::string stateName;
...@@ -109,9 +107,8 @@ class Action ...@@ -109,9 +107,8 @@ class Action
/// ///
/// These informations will be usefull when undoing the Action. /// These informations will be usefull when undoing the Action.
/// ///
/// @param headMovement The movement of the machine's head associated with this action.
/// @param stateName The name of the machine's current state when this action was performed. /// @param stateName The name of the machine's current state when this action was performed.
void setInfos(int headMovement, std::string stateName); void setInfos(std::string stateName);
}; };
#endif #endif
...@@ -18,8 +18,6 @@ void Action::apply(Config & config) ...@@ -18,8 +18,6 @@ void Action::apply(Config & config)
config.getCurrentStateHistory().push(name); config.getCurrentStateHistory().push(name);
config.pastActions.push(std::pair<std::string, Action>(config.getCurrentStateName(), *this)); config.pastActions.push(std::pair<std::string, Action>(config.getCurrentStateName(), *this));
config.moveHead(headMovement);
} }
bool Action::appliable(Config & config) bool Action::appliable(Config & config)
...@@ -33,12 +31,6 @@ bool Action::appliable(Config & config) ...@@ -33,12 +31,6 @@ bool Action::appliable(Config & config)
void Action::undo(Config & config) void Action::undo(Config & config)
{ {
if (ProgramParameters::debug)
fprintf(stderr, "Head = %d, will move back of %d\n", config.getHead(), headMovement);
config.moveHead(-headMovement);
if (ProgramParameters::debug)
fprintf(stderr, "Head = %d\n", config.getHead());
for(int i = sequence.size()-1; i >= 0; i--) for(int i = sequence.size()-1; i >= 0; i--)
sequence[i].undo(config, sequence[i]); sequence[i].undo(config, sequence[i]);
...@@ -77,12 +69,6 @@ void Action::undo(Config & config) ...@@ -77,12 +69,6 @@ void Action::undo(Config & config)
void Action::undoOnlyStack(Config & config) void Action::undoOnlyStack(Config & config)
{ {
if (ProgramParameters::debug)
fprintf(stderr, "Head = %d, will move back of %d\n", config.getHead(), headMovement);
config.moveHead(-headMovement);
if (ProgramParameters::debug)
fprintf(stderr, "Head = %d\n", config.getHead());
for(int i = sequence.size()-1; i >= 0; i--) for(int i = sequence.size()-1; i >= 0; i--)
{ {
auto type = sequence[i].type; auto type = sequence[i].type;
...@@ -141,9 +127,8 @@ void Action::printForDebug(FILE * output) ...@@ -141,9 +127,8 @@ void Action::printForDebug(FILE * output)
fprintf(output, "\n"); fprintf(output, "\n");
} }
void Action::setInfos(int headMovement, std::string stateName) void Action::setInfos(std::string stateName)
{ {
this->headMovement = headMovement;
this->stateName = stateName; this->stateName = stateName;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment