Fawkes API
Fawkes Development Version
|
Constraint that hold cost factors for a static list of edges. More...
#include <>>
Public Member Functions | |
NavGraphStaticListEdgeCostConstraint (std::string name) | |
Constructor. More... | |
virtual | ~NavGraphStaticListEdgeCostConstraint () |
Virtual empty destructor. More... | |
const std::vector< std::pair< fawkes::NavGraphEdge, float > > & | edge_cost_list () const |
Get list of blocked edges. More... | |
void | add_edge (const fawkes::NavGraphEdge &edge, const float cost_factor) |
Add a single edge to constraint list. More... | |
void | add_edges (const std::vector< std::pair< fawkes::NavGraphEdge, float >> &edge_costs) |
Add multiple edges to constraint list. More... | |
void | remove_edge (const fawkes::NavGraphEdge &edge) |
Remove a single edge from the constraint list. More... | |
void | clear_edges () |
Remove all edges. More... | |
bool | has_edge (const fawkes::NavGraphEdge &edge) |
Check if constraint has a specific edge. 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) throw () |
Get cost factor for given edge. More... | |
![]() | |
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... | |
bool | operator== (const std::string &name) const |
Check if constraint matches name. More... | |
Additional Inherited Members | |
![]() | |
std::string | name_ |
Name of constraint. More... | |
Constraint that hold cost factors for a static list of edges.
Definition at line 38 of file static_list_edge_cost_constraint.h.
fawkes::NavGraphStaticListEdgeCostConstraint::NavGraphStaticListEdgeCostConstraint | ( | std::string | name | ) |
Constructor.
name | name of edge constraint |
Definition at line 41 of file static_list_edge_cost_constraint.cpp.
|
virtual |
Virtual empty destructor.
Definition at line 49 of file static_list_edge_cost_constraint.cpp.
void fawkes::NavGraphStaticListEdgeCostConstraint::add_edge | ( | const fawkes::NavGraphEdge & | edge, |
const float | cost_factor | ||
) |
Add a single edge to constraint list.
edge | edge to add to constraint list |
cost_factor | cost factor for this edge, must be >= 1.00001 |
Definition at line 74 of file static_list_edge_cost_constraint.cpp.
References has_edge(), and fawkes::LockVector< Type >::push_back_locked().
Referenced by add_edges(), and NavGraphStaticConstraintsThread::init().
void fawkes::NavGraphStaticListEdgeCostConstraint::add_edges | ( | const std::vector< std::pair< fawkes::NavGraphEdge, float >> & | edges | ) |
Add multiple edges to constraint list.
edges | edges to add to constraint list |
Definition at line 90 of file static_list_edge_cost_constraint.cpp.
References add_edge().
void fawkes::NavGraphStaticListEdgeCostConstraint::clear_edges | ( | ) |
Remove all edges.
Definition at line 146 of file static_list_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 from fawkes::NavGraphEdgeCostConstraint.
Definition at line 55 of file static_list_edge_cost_constraint.cpp.
References fawkes::LockVector< Type >::lock(), and fawkes::LockVector< Type >::unlock().
|
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 |
Implements fawkes::NavGraphEdgeCostConstraint.
Definition at line 156 of file static_list_edge_cost_constraint.cpp.
const std::vector< std::pair< fawkes::NavGraphEdge, float > > & fawkes::NavGraphStaticListEdgeCostConstraint::edge_cost_list | ( | ) | const |
Get list of blocked edges.
Note that this is the list as it is currently used on queries. Any operations (adding/removing edges) that have been performed without compute() being called are not reflected.
Definition at line 138 of file static_list_edge_cost_constraint.cpp.
bool fawkes::NavGraphStaticListEdgeCostConstraint::has_edge | ( | const fawkes::NavGraphEdge & | edge | ) |
Check if constraint has a specific edge.
edge | edge to check |
Definition at line 121 of file static_list_edge_cost_constraint.cpp.
Referenced by add_edge().
void fawkes::NavGraphStaticListEdgeCostConstraint::remove_edge | ( | const fawkes::NavGraphEdge & | edge | ) |
Remove a single edge from the constraint list.
edge | edge to remote |
Definition at line 102 of file static_list_edge_cost_constraint.cpp.
References fawkes::LockVector< Type >::erase_locked().