Go to the documentation of this file.00001 #include "RewardMovementCostRel.h"
00002 #include "VariableValue.h"
00003
00004
00005 RewardMovementCostRel::RewardMovementCostRel(SharedPointer<Variable> rewardVar, SharedPointer<Variable> actionVar, SharedPointer<ProblemParams> params)
00006 {
00007 this->actionVar = actionVar;
00008 this->rewardVar = rewardVar;
00009 this->params = params;
00010 this->addSourceVar(actionVar);
00011 this->setDestVariable(rewardVar);
00012 }
00013
00014 RewardMovementCostRel::~RewardMovementCostRel(void)
00015 {
00016 }
00017
00018 vector<SharedPointer<RelEntry> > RewardMovementCostRel::getProb(map<string, SharedPointer<IVariableValue> > sourceVals)
00019 {
00020 vector<SharedPointer<RelEntry> > result;
00021 vector<string> actions;
00022 actions.push_back("up");
00023 actions.push_back("down");
00024 actions.push_back("left");
00025 actions.push_back("right");
00026
00027
00028 FOREACH_NOCONST(string, pactionStr , actions)
00029 {
00030 if(sourceVals[actionVar->getVariableName()]->getValueName().compare(*pactionStr) == 0)
00031 {
00032
00033 SharedPointer<RelEntry> newEntry ( new RelEntry());
00034
00035
00036
00037 newEntry->prob = params->MovementCost;
00038 result.push_back(newEntry);
00039 break;
00040
00041 }
00042 else
00043 {
00044
00045 }
00046 }
00047
00048 return result;
00049 }