HOG2
|
#include <WeightedMap2DEnvironment.h>
Public Member Functions | |
WeightedMap2DEnvironment (MapAbstraction *ma) | |
Constructor for the WeightedMap2DEnvironment. More... | |
WeightedMap2DEnvironment (AbsMapEnvironment *ame) | |
virtual | ~WeightedMap2DEnvironment () |
Destructor for the WeightedMap2DEnvironment. More... | |
void | ApplyAction (xyLoc &s, tDirection dir) const |
ApplyAction is called when an action is applied. More... | |
virtual double | GCost (const xyLoc &node1, const xyLoc &node2) const |
virtual double | GCost (const xyLoc &node1, const tDirection &act) const |
virtual BaseMapOccupancyInterface * | GetOccupancyInfo () |
void | OpenGLDraw () const |
void | OpenGLDraw (const xyLoc &l) const |
void | OpenGLDraw (const xyLoc &s, const tDirection &dir) const |
void | OpenGLDraw (const xyLoc &l1, const xyLoc &l2, float v) const |
void | DrawEdge (const edge *e) const |
void | UpdateAngle (const xyLoc &old, const xyLoc &s, double t) |
void | SetWeight (double wt) |
Set the cost of moving in the "wrong" direction. More... | |
void | SetProportionOld (double prop) |
Set the weight (proportion) of the old angle. More... | |
void | SetUpdateOnQuery (bool b) |
void | SetQueryProportionOld (double prop) |
Set the weight (proportion) of the old angle for queried edge updates. More... | |
void | SetUpdateSurrounding (bool b) |
void | SetSurroundingProportion (double prop) |
void | UseWindow (bool b) |
void | SetWindowCenter (xyLoc l) |
void | SetWindowSize (double d) |
void | SetAngle (xyLoc &l, Vector2D angle) |
Vector2D | GetAngle (xyLoc &l) |
void | SetNoWeighting (bool b) |
void | UsePerceptron (double lr) |
double | ComputeArrowMetric (bool timed=false, double time=0, bool DoNormalize=false, double maxtime=0) |
Vector2D | GetAngleFromDirection (tDirection dir) const |
Private Types | |
typedef std::unordered_map< AngleUtil::AngleSearchNode, Vector2D, AngleUtil::SearchNodeHash, AngleUtil::SearchNodeEqual > | AngleLookupTable |
Private Member Functions | |
void | UpdateAngle (const xyLoc &old, const xyLoc &s, double prop, double t) |
Private Attributes | |
BaseMapOccupancyInterface * | oi |
AngleLookupTable | angleLookup |
double | diffWeight |
double | oldProportion |
xyLoc | windowCenter |
bool | useWindow |
double | windowSize |
bool | noWeighting |
bool | updateOnQuery |
double | queryOldProportion |
bool | updateSurrounding |
double | surroundingProportion |
bool | usePerceptron |
double | learningRate |
Definition at line 120 of file WeightedMap2DEnvironment.h.
|
private |
Definition at line 171 of file WeightedMap2DEnvironment.h.
WeightedMap2DEnvironment::WeightedMap2DEnvironment | ( | MapAbstraction * | mapAbs | ) |
Constructor for the WeightedMap2DEnvironment.
ma | The map abstraction the environment uses |
Definition at line 10 of file WeightedMap2DEnvironment.cpp.
References diffWeight, learningRate, noWeighting, oi, oldProportion, queryOldProportion, surroundingProportion, updateOnQuery, updateSurrounding, usePerceptron, and useWindow.
WeightedMap2DEnvironment::WeightedMap2DEnvironment | ( | AbsMapEnvironment * | ame | ) |
Definition at line 41 of file WeightedMap2DEnvironment.cpp.
References diffWeight, learningRate, noWeighting, oi, oldProportion, queryOldProportion, surroundingProportion, updateOnQuery, updateSurrounding, usePerceptron, and useWindow.
|
virtual |
Destructor for the WeightedMap2DEnvironment.
Definition at line 64 of file WeightedMap2DEnvironment.cpp.
References angleLookup.
void WeightedMap2DEnvironment::ApplyAction | ( | xyLoc & | s, |
tDirection | dir | ||
) | const |
ApplyAction is called when an action is applied.
The current state, occupancy interface, and edge weight are updated if the action can be applied.
s | The current state |
dir | The action taken from the current state |
Definition at line 77 of file WeightedMap2DEnvironment.cpp.
References kE, kN, kNE, kNW, kS, kSE, kSW, kW, xyLoc::x, and xyLoc::y.
double WeightedMap2DEnvironment::ComputeArrowMetric | ( | bool | timed = false , |
double | time = 0 , |
||
bool | DoNormalize = false , |
||
double | maxtime = 0 |
||
) |
Definition at line 639 of file WeightedMap2DEnvironment.cpp.
References GetAngle(), GetAngleFromDirection(), Graph::getNodeIter(), Vector2D::GetUpdateTime(), kE, GraphAbstractionConstants::kFirstData, kN, kNE, kNW, kS, kSE, kStay, kSW, kW, Graph::nodeIterNext(), Vector2D::Normalize(), xyLoc::x, Vector2D::x, xyLoc::y, and Vector2D::y.
Referenced by WeightedUnitGroup< state, action, environment >::ComputeArrowMetric().
void WeightedMap2DEnvironment::DrawEdge | ( | const edge * | e | ) | const |
Definition at line 540 of file WeightedMap2DEnvironment.cpp.
References edge::getFrom(), edge::GetLabelL(), node::GetLabelL(), Graph::GetNode(), edge::getTo(), kBackwardCount, GraphAbstractionConstants::kFirstData, and kForwardCount.
Referenced by OpenGLDraw().
|
inlinevirtual |
Definition at line 128 of file WeightedMap2DEnvironment.h.
l1 | The first location |
l2 | The second location |
Definition at line 379 of file WeightedMap2DEnvironment.cpp.
References angleLookup, diffWeight, fgreater(), GetAngleFromDirection(), noWeighting, ROOT_TWO, useWindow, windowCenter, windowSize, Vector2D::x, and Vector2D::y.
Referenced by AbsGraphEnvironment::GCost().
Definition at line 627 of file WeightedMap2DEnvironment.cpp.
References angleLookup.
Referenced by ComputeArrowMetric(), GreedyDMUnit< environment >::MakeMove(), and WeightedUnitGroup< state, action, environment >::UpdateLocalWeights().
Vector2D WeightedMap2DEnvironment::GetAngleFromDirection | ( | tDirection | dir | ) | const |
Definition at line 725 of file WeightedMap2DEnvironment.cpp.
References kE, kN, kNE, kNW, kS, kSE, kSW, kW, Vector2D::Normalize(), and Vector2D::Set().
Referenced by ComputeArrowMetric(), GCost(), and GreedyDMUnit< environment >::MakeMove().
|
inlinevirtual |
Definition at line 130 of file WeightedMap2DEnvironment.h.
References oi.
void WeightedMap2DEnvironment::OpenGLDraw | ( | ) | const |
Definition at line 473 of file WeightedMap2DEnvironment.cpp.
References angleLookup, Graph::getNodeIter(), GraphAbstractionConstants::kFirstData, Graph::nodeIterNext(), xyLoc::x, Vector2D::x, xyLoc::y, and Vector2D::y.
Referenced by WeightedUnitGroup< state, action, environment >::OpenGLDraw().
|
inline |
Definition at line 132 of file WeightedMap2DEnvironment.h.
|
inline |
Definition at line 134 of file WeightedMap2DEnvironment.h.
References MapEnvironment::OpenGLDraw().
void WeightedMap2DEnvironment::OpenGLDraw | ( | const xyLoc & | s, |
const tDirection & | dir | ||
) | const |
Definition at line 591 of file WeightedMap2DEnvironment.cpp.
References DrawEdge(), Graph::FindEdge(), node::GetNum(), kE, kN, kNE, kNW, kS, kSE, kSW, kW, xyLoc::x, and xyLoc::y.
Definition at line 621 of file WeightedMap2DEnvironment.cpp.
References angleLookup.
Referenced by WeightedUnitGroup< state, action, environment >::UpdateLocalWeights().
|
inline |
Definition at line 159 of file WeightedMap2DEnvironment.h.
References noWeighting.
Referenced by WeightedUnitGroup< state, action, environment >::MakeMove(), and WeightedUnitGroup< state, action, environment >::UpdateLocation().
|
inline |
Set the weight (proportion) of the old angle.
Definition at line 142 of file WeightedMap2DEnvironment.h.
References oldProportion.
Referenced by WeightedUnitGroup< state, action, environment >::MakeMove(), and WeightedUnitGroup< state, action, environment >::UpdateLocation().
|
inline |
Set the weight (proportion) of the old angle for queried edge updates.
Definition at line 146 of file WeightedMap2DEnvironment.h.
References queryOldProportion.
Referenced by WeightedUnitGroup< state, action, environment >::MakeMove(), and WeightedUnitGroup< state, action, environment >::UpdateLocation().
|
inline |
Definition at line 149 of file WeightedMap2DEnvironment.h.
References surroundingProportion.
Referenced by WeightedUnitGroup< state, action, environment >::MakeMove(), and WeightedUnitGroup< state, action, environment >::UpdateLocation().
|
inline |
Definition at line 144 of file WeightedMap2DEnvironment.h.
References updateOnQuery.
Referenced by WeightedUnitGroup< state, action, environment >::MakeMove(), and WeightedUnitGroup< state, action, environment >::UpdateLocation().
|
inline |
Definition at line 148 of file WeightedMap2DEnvironment.h.
References updateSurrounding.
Referenced by WeightedUnitGroup< state, action, environment >::MakeMove(), and WeightedUnitGroup< state, action, environment >::UpdateLocation().
|
inline |
Set the cost of moving in the "wrong" direction.
Definition at line 140 of file WeightedMap2DEnvironment.h.
References diffWeight.
Referenced by WeightedUnitGroup< state, action, environment >::MakeMove(), and WeightedUnitGroup< state, action, environment >::UpdateLocation().
|
inline |
Definition at line 153 of file WeightedMap2DEnvironment.h.
References windowCenter.
Referenced by WeightedUnitGroup< state, action, environment >::MakeMove().
|
inline |
Definition at line 154 of file WeightedMap2DEnvironment.h.
References d, and windowSize.
Referenced by WeightedUnitGroup< state, action, environment >::MakeMove(), and WeightedUnitGroup< state, action, environment >::UpdateLocation().
|
private |
Definition at line 150 of file WeightedMap2DEnvironment.cpp.
References angleLookup, kE, kN, kNE, kNW, kS, kSE, kSW, kW, learningRate, Vector2D::Normalize(), Vector2D::Set(), Vector2D::SetUpdateTime(), surroundingProportion, updateSurrounding, usePerceptron, Vector2D::x, and Vector2D::y.
Definition at line 367 of file WeightedMap2DEnvironment.cpp.
References oldProportion.
Referenced by WeightedUnitGroup< state, action, environment >::UpdateLocation().
|
inline |
Definition at line 162 of file WeightedMap2DEnvironment.h.
References learningRate, and usePerceptron.
Referenced by WeightedUnitGroup< state, action, environment >::MakeMove(), and WeightedUnitGroup< state, action, environment >::UpdateLocation().
|
inline |
Definition at line 152 of file WeightedMap2DEnvironment.h.
References useWindow.
Referenced by WeightedUnitGroup< state, action, environment >::MakeMove(), and WeightedUnitGroup< state, action, environment >::UpdateLocation().
|
private |
Definition at line 172 of file WeightedMap2DEnvironment.h.
Referenced by GCost(), GetAngle(), OpenGLDraw(), SetAngle(), UpdateAngle(), and ~WeightedMap2DEnvironment().
|
private |
Definition at line 176 of file WeightedMap2DEnvironment.h.
Referenced by GCost(), SetWeight(), and WeightedMap2DEnvironment().
|
private |
Definition at line 193 of file WeightedMap2DEnvironment.h.
Referenced by UpdateAngle(), UsePerceptron(), and WeightedMap2DEnvironment().
|
private |
Definition at line 184 of file WeightedMap2DEnvironment.h.
Referenced by GCost(), SetNoWeighting(), and WeightedMap2DEnvironment().
|
private |
Definition at line 168 of file WeightedMap2DEnvironment.h.
Referenced by GetOccupancyInfo(), and WeightedMap2DEnvironment().
|
private |
Definition at line 177 of file WeightedMap2DEnvironment.h.
Referenced by SetProportionOld(), UpdateAngle(), and WeightedMap2DEnvironment().
|
private |
Definition at line 187 of file WeightedMap2DEnvironment.h.
Referenced by SetQueryProportionOld(), and WeightedMap2DEnvironment().
|
private |
Definition at line 190 of file WeightedMap2DEnvironment.h.
Referenced by SetSurroundingProportion(), UpdateAngle(), and WeightedMap2DEnvironment().
|
private |
Definition at line 186 of file WeightedMap2DEnvironment.h.
Referenced by SetUpdateOnQuery(), and WeightedMap2DEnvironment().
|
private |
Definition at line 189 of file WeightedMap2DEnvironment.h.
Referenced by SetUpdateSurrounding(), UpdateAngle(), and WeightedMap2DEnvironment().
|
private |
Definition at line 192 of file WeightedMap2DEnvironment.h.
Referenced by UpdateAngle(), UsePerceptron(), and WeightedMap2DEnvironment().
|
private |
Definition at line 181 of file WeightedMap2DEnvironment.h.
Referenced by GCost(), UseWindow(), and WeightedMap2DEnvironment().
|
private |
Definition at line 180 of file WeightedMap2DEnvironment.h.
Referenced by GCost(), and SetWindowCenter().
|
private |
Definition at line 182 of file WeightedMap2DEnvironment.h.
Referenced by GCost(), and SetWindowSize().