Go to the documentation of this file.00001 #include "RewardOnPath.h"
00002 #include "VariableValue.h"
00003 #include <set>
00004
00005 using namespace std;
00006
00007
00008 RewardOnPath::RewardOnPath(SharedPointer<Variable> rewardVar, SharedPointer<Map2DPosVar> auvPos, SharedPointer<Map2DPath> path, SharedPointer<ProblemParams> params)
00009 {
00010 this->auvPos = auvPos;
00011 this->rewardVar = rewardVar;
00012 this->params = params;
00013 this->path = path;
00014
00015 this->addSourceVar(auvPos);
00016 this->setDestVariable(rewardVar);
00017 }
00018
00019 RewardOnPath::~RewardOnPath(void)
00020 {
00021 }
00022
00023 vector<SharedPointer<RelEntry> > RewardOnPath::getProb(map<string, SharedPointer<IVariableValue> > sourceVals)
00024 {
00025 vector<SharedPointer<Map2DPosValue> > pathSteps = path->getPath();
00026
00027 SharedPointer<IVariableValue> curPos = sourceVals[auvPos->getVariableName()];
00028
00029 vector<SharedPointer<RelEntry> > result;
00030
00031
00032 FOREACH_NOCONST(SharedPointer<Map2DPosValue>, pCurStep , pathSteps)
00033 {
00034 SharedPointer<Map2DPosValue> curStep = *pCurStep;
00035 if(curStep->equals(curPos))
00036 {
00037 SharedPointer<RelEntry> newEntry ( new RelEntry());
00038
00039 newEntry->prob = params->OnPathReward;
00040 result.push_back(newEntry);
00041 }
00042
00043 }
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059 return result;
00060 }