72 lines
1.6 KiB
C++
72 lines
1.6 KiB
C++
/*
|
||
* © Copyright 2014 – Urheberrechtshinweis
|
||
* Alle Rechte vorbehalten / All Rights Reserved
|
||
*
|
||
* Programmcode ist urheberrechtlich geschuetzt.
|
||
* Das Urheberrecht liegt, soweit nicht ausdruecklich anders gekennzeichnet, bei Frank Ebner.
|
||
* Keine Verwendung ohne explizite Genehmigung.
|
||
* (vgl. § 106 ff UrhG / § 97 UrhG)
|
||
*/
|
||
|
||
#ifndef WALKMODULENODEIMPORTANCE_H
|
||
#define WALKMODULENODEIMPORTANCE_H
|
||
|
||
#include "WalkModule.h"
|
||
#include "WalkStateHeading.h"
|
||
|
||
#include "../../../../Assertions.h"
|
||
|
||
/**
|
||
* favor edges based on the importance-factor of the next node.
|
||
* @see struct GridNodeImportance
|
||
*/
|
||
template <typename Node, typename WalkState> class WalkModuleNodeImportance : public WalkModule<Node, WalkState> {
|
||
|
||
private:
|
||
|
||
public:
|
||
|
||
/** ctor */
|
||
WalkModuleNodeImportance() {
|
||
;
|
||
}
|
||
|
||
|
||
virtual void updateBefore(WalkState& state, const Node& startNode) override {
|
||
(void) state;
|
||
(void) startNode;
|
||
}
|
||
|
||
virtual void updateAfter(WalkState& state, const Node& startNode, const Node& endNode) override {
|
||
(void) state;
|
||
(void) startNode;
|
||
(void) endNode;
|
||
}
|
||
|
||
virtual void step(WalkState& state, const Node& curNode, const Node& nextNode) override {
|
||
(void) state;
|
||
(void) curNode;
|
||
(void) nextNode;
|
||
}
|
||
|
||
double getProbability(const WalkState& state, const Node& startNode, const Node& curNode, const Node& potentialNode) const override {
|
||
|
||
(void) state;
|
||
(void) startNode;
|
||
(void) curNode;
|
||
|
||
//const double prob = potentialNode.getWalkImportance();
|
||
|
||
const float i1 = curNode.getWalkImportance();
|
||
const float i2 = potentialNode.getWalkImportance();
|
||
const double prob = (i2 > i1) ? (0.9) : (0.1);
|
||
|
||
return prob;
|
||
|
||
}
|
||
|
||
|
||
};
|
||
|
||
#endif // WALKMODULENODEIMPORTANCE_H
|