Fawkes API
Fawkes Development Version
|
Constraint that can be queried for an edge cost factor. More...
#include <>>
Public Member Functions | |
NavGraphEdgeCostConstraint (std::string &name) | |
Constructor. More... | |
NavGraphEdgeCostConstraint (const char *name) | |
Constructor. More... | |
virtual | ~NavGraphEdgeCostConstraint () |
Virtual empty destructor. More... | |
std::string | name () |
Get name of constraint. More... | |
virtual bool | compute (void) throw () |
Perform compuations before graph search and to indicate re-planning. More... | |
virtual float | cost_factor (const fawkes::NavGraphNode &from, const fawkes::NavGraphNode &to)=0 throw () |
Get cost factor for given edge. More... | |
bool | operator== (const std::string &name) const |
Check if constraint matches name. More... | |
Protected Attributes | |
std::string | name_ |
Name of constraint. More... | |
Constraint that can be queried for an edge cost factor.
Definition at line 36 of file edge_cost_constraint.h.
fawkes::NavGraphEdgeCostConstraint::NavGraphEdgeCostConstraint | ( | std::string & | name | ) |
Constructor.
name | name of edge constraint |
Definition at line 61 of file edge_cost_constraint.cpp.
fawkes::NavGraphEdgeCostConstraint::NavGraphEdgeCostConstraint | ( | const char * | name | ) |
Constructor.
name | name of edge constraint |
Definition at line 70 of file edge_cost_constraint.cpp.
|
virtual |
Virtual empty destructor.
Definition at line 77 of file edge_cost_constraint.cpp.
|
virtual |
Perform compuations before graph search and to indicate re-planning.
The compute method is called on all constraints just before a path search is performed and to check if re-planning should be tried.
It can be used for example to cache results for the coming search run. The search guarantees that for each complete search run compute() is called once and only once and that no two search runs overlap, i.e., compute() will not be called while another search is still running.
Constraints must indicate whether any change has occured during computation or since the last compute() call through the return value. This is used to determine if re-planning should be attempted.
Reimplemented in fawkes::NavGraphStaticListEdgeCostConstraint, NavGraphClustersDistanceCostConstraint, and NavGraphClustersStaticCostConstraint.
Definition at line 110 of file edge_cost_constraint.cpp.
|
pure virtual |
Get cost factor for given edge.
This method must be implemented by constraint classes. It is called to determine a cost factor for an edge. That is, the path costs from the originating node to the destination node are multiplied with this factor and thus the chance of following that specific edge is decreased. The factor must be greater or equal to 1. That is a requirement to keep heuristics admissible and thus the search optimal.
Note that the nodes may be passed in either ordering, therefore you should not rely on a particular order, not even for directed nodes!
Further note that the method may not throw an exception. Handle this internally appropriately.
from | node from which the edge originates |
to | node to which the edge leads |
Implemented in fawkes::NavGraphStaticListEdgeCostConstraint, NavGraphClustersDistanceCostConstraint, and NavGraphClustersStaticCostConstraint.
Referenced by fawkes::NavGraphConstraintRepo::cost_factor(), and fawkes::NavGraphConstraintRepo::increases_cost().
std::string fawkes::NavGraphEdgeCostConstraint::name | ( | ) |
Get name of constraint.
Definition at line 85 of file edge_cost_constraint.cpp.
References name_.
Referenced by fawkes::NavGraphConstraintRepo::cost_factor(), NavGraphStaticConstraintsThread::finalize(), NavGraphClustersThread::finalize(), NavGraphEdgeCostConstraint(), and operator==().
bool fawkes::NavGraphEdgeCostConstraint::operator== | ( | const std::string & | name | ) | const |
Check if constraint matches name.
name | name string to compare this constraints name to |
Definition at line 122 of file edge_cost_constraint.cpp.
|
protected |
Name of constraint.
Definition at line 52 of file edge_cost_constraint.h.
Referenced by name(), NavGraphEdgeCostConstraint(), and operator==().