Fawkes API  Fawkes Development Version
fawkes::NavGraphEdgeCostConstraint Class Referenceabstract

Constraint that can be queried for an edge cost factor. More...

#include <>>

Inheritance diagram for fawkes::NavGraphEdgeCostConstraint:

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

Detailed Description

Constraint that can be queried for an edge cost factor.

Author
Tim Niemueller

Definition at line 36 of file edge_cost_constraint.h.

Constructor & Destructor Documentation

◆ NavGraphEdgeCostConstraint() [1/2]

fawkes::NavGraphEdgeCostConstraint::NavGraphEdgeCostConstraint ( std::string &  name)

Constructor.

Parameters
namename of edge constraint

Definition at line 61 of file edge_cost_constraint.cpp.

References name(), and name_.

◆ NavGraphEdgeCostConstraint() [2/2]

fawkes::NavGraphEdgeCostConstraint::NavGraphEdgeCostConstraint ( const char *  name)

Constructor.

Parameters
namename of edge constraint

Definition at line 70 of file edge_cost_constraint.cpp.

References name(), and name_.

◆ ~NavGraphEdgeCostConstraint()

fawkes::NavGraphEdgeCostConstraint::~NavGraphEdgeCostConstraint ( )
virtual

Virtual empty destructor.

Definition at line 77 of file edge_cost_constraint.cpp.

Member Function Documentation

◆ compute()

bool fawkes::NavGraphEdgeCostConstraint::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 in fawkes::NavGraphStaticListEdgeCostConstraint, NavGraphClustersDistanceCostConstraint, and NavGraphClustersStaticCostConstraint.

Definition at line 110 of file edge_cost_constraint.cpp.

◆ cost_factor()

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

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

Implemented in fawkes::NavGraphStaticListEdgeCostConstraint, NavGraphClustersDistanceCostConstraint, and NavGraphClustersStaticCostConstraint.

Referenced by fawkes::NavGraphConstraintRepo::cost_factor(), and fawkes::NavGraphConstraintRepo::increases_cost().

◆ name()

std::string fawkes::NavGraphEdgeCostConstraint::name ( )

◆ operator==()

bool fawkes::NavGraphEdgeCostConstraint::operator== ( const std::string &  name) const

Check if constraint matches name.

Parameters
namename string to compare this constraints name to
Returns
true if the given name is the same as this constraint's name, false otherwise

Definition at line 122 of file edge_cost_constraint.cpp.

References name(), and name_.

Member Data Documentation

◆ name_

std::string fawkes::NavGraphEdgeCostConstraint::name_
protected

Name of constraint.

Definition at line 52 of file edge_cost_constraint.h.

Referenced by name(), NavGraphEdgeCostConstraint(), and operator==().


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