Fawkes API  Fawkes Development Version
fawkes::NavGraphStaticListEdgeCostConstraint Class Reference

Constraint that hold cost factors for a static list of edges. More...

#include <>>

Inheritance diagram for fawkes::NavGraphStaticListEdgeCostConstraint:

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...
 
- Public Member Functions inherited from fawkes::NavGraphEdgeCostConstraint
 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

- Protected Attributes inherited from fawkes::NavGraphEdgeCostConstraint
std::string name_
 Name of constraint. More...
 

Detailed Description

Constraint that hold cost factors for a static list of edges.

Author
Tim Niemueller

Definition at line 38 of file static_list_edge_cost_constraint.h.

Constructor & Destructor Documentation

◆ NavGraphStaticListEdgeCostConstraint()

fawkes::NavGraphStaticListEdgeCostConstraint::NavGraphStaticListEdgeCostConstraint ( std::string  name)

Constructor.

Parameters
namename of edge constraint

Definition at line 41 of file static_list_edge_cost_constraint.cpp.

◆ ~NavGraphStaticListEdgeCostConstraint()

fawkes::NavGraphStaticListEdgeCostConstraint::~NavGraphStaticListEdgeCostConstraint ( )
virtual

Virtual empty destructor.

Definition at line 49 of file static_list_edge_cost_constraint.cpp.

Member Function Documentation

◆ add_edge()

void fawkes::NavGraphStaticListEdgeCostConstraint::add_edge ( const fawkes::NavGraphEdge edge,
const float  cost_factor 
)

Add a single edge to constraint list.

Parameters
edgeedge to add to constraint list
cost_factorcost 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().

◆ add_edges()

void fawkes::NavGraphStaticListEdgeCostConstraint::add_edges ( const std::vector< std::pair< fawkes::NavGraphEdge, float >> &  edges)

Add multiple edges to constraint list.

Parameters
edgesedges to add to constraint list

Definition at line 90 of file static_list_edge_cost_constraint.cpp.

References add_edge().

◆ clear_edges()

void fawkes::NavGraphStaticListEdgeCostConstraint::clear_edges ( )

Remove all edges.

Definition at line 146 of file static_list_edge_cost_constraint.cpp.

◆ compute()

bool fawkes::NavGraphStaticListEdgeCostConstraint::compute ( void  )
throw (
)
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.

Returns
true if a change has occured during computation or since the last call, false otherwise

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().

◆ cost_factor()

float fawkes::NavGraphStaticListEdgeCostConstraint::cost_factor ( const fawkes::NavGraphNode from,
const fawkes::NavGraphNode to 
)
throw (
)
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.

Parameters
fromnode from which the edge originates
tonode to which the edge leads
Returns
cost factor, a number x >= 1.0

Implements fawkes::NavGraphEdgeCostConstraint.

Definition at line 156 of file static_list_edge_cost_constraint.cpp.

◆ edge_cost_list()

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.

Returns
list of blocked edges

Definition at line 138 of file static_list_edge_cost_constraint.cpp.

◆ has_edge()

bool fawkes::NavGraphStaticListEdgeCostConstraint::has_edge ( const fawkes::NavGraphEdge edge)

Check if constraint has a specific edge.

Parameters
edgeedge to check
Returns
true if edge is in list, false otherwise

Definition at line 121 of file static_list_edge_cost_constraint.cpp.

Referenced by add_edge().

◆ remove_edge()

void fawkes::NavGraphStaticListEdgeCostConstraint::remove_edge ( const fawkes::NavGraphEdge edge)

Remove a single edge from the constraint list.

Parameters
edgeedge to remote

Definition at line 102 of file static_list_edge_cost_constraint.cpp.

References fawkes::LockVector< Type >::erase_locked().


The documentation for this class was generated from the following files: