RewardAtGoal.cpp
Go to the documentation of this file.
00001 #include "RewardAtGoal.h"
00002 #include "VariableValue.h"
00003 
00004 
00005 RewardAtGoal::RewardAtGoal(SharedPointer<Variable> rewardVar, SharedPointer<Map2DPosVar> auvPos, SharedPointer<Map2DPath> path, SharedPointer<ProblemParams> params)
00006 {
00007         this->auvPos = auvPos;
00008         this->rewardVar = rewardVar;
00009         this->params = params;
00010         this->path = path;
00011 
00012         this->addSourceVar(auvPos);
00013         this->setDestVariable(rewardVar);
00014 }
00015 
00016 RewardAtGoal::~RewardAtGoal(void)
00017 {
00018 }
00019 
00020 vector<SharedPointer<RelEntry> > RewardAtGoal::getProb(map<string, SharedPointer<IVariableValue> > sourceVals)
00021 {
00022         vector<SharedPointer<Map2DPosValue> > pathSteps = path->getPath();
00023         SharedPointer<Map2DPosValue> lastStep = pathSteps[pathSteps.size() - 1];
00024         SharedPointer<IVariableValue> curPos = sourceVals[auvPos->getVariableName()];
00025 
00026         vector<SharedPointer<RelEntry> > result;
00027         
00028         if(lastStep->equals(curPos))
00029         {
00030                 SharedPointer<RelEntry> newEntry ( new RelEntry());
00031                 //newEntry->sourceValues[lastStep->getVariableName()] = lastStep;
00032                 newEntry->prob = params->OnGoalReward;
00033                 result.push_back(newEntry);
00034         }
00035     return result;
00036 }


appl
Author(s): petercai
autogenerated on Tue Jan 7 2014 11:02:29