Fawkes API
Fawkes Development Version
|
Constraint repository to maintain blocks on nodes. More...
#include <>>
Public Types | |
typedef std::vector< fawkes::NavGraphNodeConstraint * > | NodeConstraintList |
List of navgraph node constraints. More... | |
typedef std::vector< fawkes::NavGraphEdgeConstraint * > | EdgeConstraintList |
List of navgraph edge constraints. More... | |
typedef std::vector< fawkes::NavGraphEdgeCostConstraint * > | EdgeCostConstraintList |
List of navgraph edge cost constraints. More... | |
Public Member Functions | |
NavGraphConstraintRepo () | |
Constructor. More... | |
~NavGraphConstraintRepo () | |
Destructor. More... | |
void | register_constraint (NavGraphNodeConstraint *constraint) |
Register a constraint. More... | |
void | register_constraint (NavGraphEdgeConstraint *constraint) |
Register a constraint. More... | |
void | register_constraint (NavGraphEdgeCostConstraint *constraint) |
Register an edge cost constraint. More... | |
void | unregister_constraint (std::string name) |
Unregister a constraint by name. More... | |
bool | has_constraint (std::string &name) |
Check by name if a constraint has been registered. More... | |
fawkes::NavGraphNodeConstraint * | get_node_constraint (std::string &name) |
Get a node constraint by name. More... | |
fawkes::NavGraphEdgeConstraint * | get_edge_constraint (std::string &name) |
Get an edge constraint by name. More... | |
fawkes::NavGraphEdgeCostConstraint * | get_edge_cost_constraint (std::string &name) |
Get an edge cost constraint by name. More... | |
const NodeConstraintList & | node_constraints () const |
Get a list of registered node constraints. More... | |
const EdgeConstraintList & | edge_constraints () const |
Get a list of registered edge constraints. More... | |
const EdgeCostConstraintList & | edge_cost_constraints () const |
Get a list of registered edge cost constraints. More... | |
bool | has_constraints () const |
Check if there are any constraints at all. More... | |
bool | compute () |
Call compute method on all registered constraints. More... | |
NavGraphNodeConstraint * | blocks (const fawkes::NavGraphNode &node) |
Check if any constraint in the repo blocks the node. More... | |
NavGraphEdgeConstraint * | blocks (const fawkes::NavGraphNode &from, const fawkes::NavGraphNode &to) |
Check if any constraint in the repo blocks the edge. More... | |
NavGraphEdgeCostConstraint * | increases_cost (const fawkes::NavGraphNode &from, const fawkes::NavGraphNode &to) |
Check if any constraint in the repo increases the cost of the edge. More... | |
NavGraphEdgeCostConstraint * | increases_cost (const fawkes::NavGraphNode &from, const fawkes::NavGraphNode &to, float &cost_factor) |
Check if any constraint in the repo increases the cost of the edge. More... | |
float | cost_factor (const fawkes::NavGraphNode &from, const fawkes::NavGraphNode &to) |
Get the highest increasing cost factor for an edge. More... | |
std::map< std::string, std::string > | blocks (const std::vector< fawkes::NavGraphNode > &nodes) |
Check if any constraint in the repo blocks (some) nodes. More... | |
std::map< std::pair< std::string, std::string >, std::string > | blocks (const std::vector< fawkes::NavGraphEdge > &edges) |
Check if any constraint in the repo blocks (some) edges. More... | |
std::list< std::tuple< std::string, std::string, std::string, float > > | cost_factor (const std::vector< fawkes::NavGraphEdge > &edges) |
Get the highest increasing cost factor for an edge. More... | |
bool | modified (bool reset_modified=false) |
Check if the constraint repo has been modified. More... | |
Constraint repository to maintain blocks on nodes.
Definition at line 41 of file constraint_repo.h.
typedef std::vector<fawkes::NavGraphEdgeConstraint*> fawkes::NavGraphConstraintRepo::EdgeConstraintList |
List of navgraph edge constraints.
Definition at line 47 of file constraint_repo.h.
typedef std::vector<fawkes::NavGraphEdgeCostConstraint*> fawkes::NavGraphConstraintRepo::EdgeCostConstraintList |
List of navgraph edge cost constraints.
Definition at line 49 of file constraint_repo.h.
typedef std::vector<fawkes::NavGraphNodeConstraint*> fawkes::NavGraphConstraintRepo::NodeConstraintList |
List of navgraph node constraints.
Definition at line 45 of file constraint_repo.h.
fawkes::NavGraphConstraintRepo::NavGraphConstraintRepo | ( | ) |
Constructor.
Definition at line 40 of file constraint_repo.cpp.
fawkes::NavGraphConstraintRepo::~NavGraphConstraintRepo | ( | ) |
Destructor.
Definition at line 46 of file constraint_repo.cpp.
fawkes::NavGraphNodeConstraint * fawkes::NavGraphConstraintRepo::blocks | ( | const fawkes::NavGraphNode & | node | ) |
Check if any constraint in the repo blocks the node.
node | Node to check for a block |
Definition at line 279 of file constraint_repo.cpp.
Referenced by fawkes::NavGraphSearchState::is_goal(), and NavGraphVisualizationThread::loop().
fawkes::NavGraphEdgeConstraint * fawkes::NavGraphConstraintRepo::blocks | ( | const fawkes::NavGraphNode & | from, |
const fawkes::NavGraphNode & | to | ||
) |
Check if any constraint in the repo blocks the edge.
from | node from which the edge originates |
to | node to which the edge leads |
Definition at line 320 of file constraint_repo.cpp.
std::map< std::string, std::string > fawkes::NavGraphConstraintRepo::blocks | ( | const std::vector< fawkes::NavGraphNode > & | nodes | ) |
Check if any constraint in the repo blocks (some) nodes.
nodes | vector of nodes to check for a block |
nodes
that are not blocked will not appear in the map. Definition at line 298 of file constraint_repo.cpp.
std::map< std::pair< std::string, std::string >, std::string > fawkes::NavGraphConstraintRepo::blocks | ( | const std::vector< fawkes::NavGraphEdge > & | edges | ) |
Check if any constraint in the repo blocks (some) edges.
edges | vector of edges to check for a block |
edges
that are not blocked will not appear in the map. Definition at line 390 of file constraint_repo.cpp.
bool fawkes::NavGraphConstraintRepo::compute | ( | ) |
Call compute method on all registered constraints.
Definition at line 256 of file constraint_repo.cpp.
Referenced by NavGraphThread::loop().
float fawkes::NavGraphConstraintRepo::cost_factor | ( | const fawkes::NavGraphNode & | from, |
const fawkes::NavGraphNode & | to | ||
) |
Get the highest increasing cost factor for an edge.
This methods goes through all of the given edges and queries all edge cost constraints. If any constraint increases the cost of an edge (cost >= 1.00001), it adds a tuple of the start node name, end node name, constraint name, and cost factor of the constraint that returned the highest cost factor to the list.
from | start node of the edge |
to | destination node of edge |
Definition at line 456 of file constraint_repo.cpp.
Referenced by NavGraphVisualizationThread::loop().
std::list< std::tuple< std::string, std::string, std::string, float > > fawkes::NavGraphConstraintRepo::cost_factor | ( | const std::vector< fawkes::NavGraphEdge > & | edges | ) |
Get the highest increasing cost factor for an edge.
This methods goes through all of the given edges and queries all edge cost constraints. If any constraint increases the cost of an edge (cost >= 1.00001), it adds a tuple of the start node name, end node name, constraint name, and cost factor of the constraint that returned the highest cost factor to the list.
edges | vector of edges to check for a block |
Definition at line 421 of file constraint_repo.cpp.
References fawkes::NavGraphEdgeCostConstraint::cost_factor(), and fawkes::NavGraphEdgeCostConstraint::name().
const NavGraphConstraintRepo::EdgeConstraintList & fawkes::NavGraphConstraintRepo::edge_constraints | ( | ) | const |
Get a list of registered edge constraints.
Definition at line 225 of file constraint_repo.cpp.
Referenced by NavGraphVisualizationThread::loop().
const NavGraphConstraintRepo::EdgeCostConstraintList & fawkes::NavGraphConstraintRepo::edge_cost_constraints | ( | ) | const |
Get a list of registered edge cost constraints.
Definition at line 234 of file constraint_repo.cpp.
fawkes::NavGraphEdgeConstraint * fawkes::NavGraphConstraintRepo::get_edge_constraint | ( | std::string & | name | ) |
Get an edge constraint by name.
name | name of constraint to retrieve |
Definition at line 176 of file constraint_repo.cpp.
fawkes::NavGraphEdgeCostConstraint * fawkes::NavGraphConstraintRepo::get_edge_cost_constraint | ( | std::string & | name | ) |
Get an edge cost constraint by name.
name | name of constraint to retrieve |
Definition at line 196 of file constraint_repo.cpp.
fawkes::NavGraphNodeConstraint * fawkes::NavGraphConstraintRepo::get_node_constraint | ( | std::string & | name | ) |
Get a node constraint by name.
name | name of constraint to retrieve |
Definition at line 157 of file constraint_repo.cpp.
bool fawkes::NavGraphConstraintRepo::has_constraint | ( | std::string & | name | ) |
Check by name if a constraint has been registered.
name | name of constraint to look for |
Definition at line 125 of file constraint_repo.cpp.
bool fawkes::NavGraphConstraintRepo::has_constraints | ( | ) | const |
Check if there are any constraints at all.
Definition at line 244 of file constraint_repo.cpp.
fawkes::NavGraphEdgeCostConstraint * fawkes::NavGraphConstraintRepo::increases_cost | ( | const fawkes::NavGraphNode & | from, |
const fawkes::NavGraphNode & | to | ||
) |
Check if any constraint in the repo increases the cost of the edge.
from | node from which the edge originates |
to | node to which the edge leads |
Definition at line 339 of file constraint_repo.cpp.
Referenced by fawkes::NavGraphSearchState::is_goal().
fawkes::NavGraphEdgeCostConstraint * fawkes::NavGraphConstraintRepo::increases_cost | ( | const fawkes::NavGraphNode & | from, |
const fawkes::NavGraphNode & | to, | ||
float & | cost_factor | ||
) |
Check if any constraint in the repo increases the cost of the edge.
from | node from which the edge originates |
to | node to which the edge leads |
cost_factor | upon return with a non-NULL edge cost constraints contains the cost increase. |
Definition at line 361 of file constraint_repo.cpp.
References fawkes::NavGraphEdgeCostConstraint::cost_factor().
bool fawkes::NavGraphConstraintRepo::modified | ( | bool | reset_modified = false | ) |
Check if the constraint repo has been modified.
reset_modified | true to reset the modified flag, false to leave it |
Definition at line 476 of file constraint_repo.cpp.
Referenced by NavGraphThread::loop().
const NavGraphConstraintRepo::NodeConstraintList & fawkes::NavGraphConstraintRepo::node_constraints | ( | ) | const |
Get a list of registered node constraints.
Definition at line 215 of file constraint_repo.cpp.
Referenced by NavGraphVisualizationThread::loop().
void fawkes::NavGraphConstraintRepo::register_constraint | ( | NavGraphNodeConstraint * | constraint | ) |
Register a constraint.
constraint | node constraint to register |
Definition at line 55 of file constraint_repo.cpp.
void fawkes::NavGraphConstraintRepo::register_constraint | ( | NavGraphEdgeConstraint * | constraint | ) |
Register a constraint.
constraint | edge constraint to register |
Definition at line 65 of file constraint_repo.cpp.
void fawkes::NavGraphConstraintRepo::register_constraint | ( | NavGraphEdgeCostConstraint * | constraint | ) |
Register an edge cost constraint.
constraint | edge cost constraint to register |
Definition at line 75 of file constraint_repo.cpp.
void fawkes::NavGraphConstraintRepo::unregister_constraint | ( | std::string | name | ) |
Unregister a constraint by name.
name | name of constraint to remove. |
Definition at line 86 of file constraint_repo.cpp.