Fawkes API  Fawkes Development Version
static_list_edge_cost_constraint.h
1 /***************************************************************************
2  * static_list_edge_cost_constraint.h - edge constraint that holds cost
3  * factors for edges in a static list
4  *
5  * Created: Fri Jul 18 15:37:10 2014 (Ouro Branco Hotel, Joao Pessoa, Brazil)
6  * Copyright 2014 Tim Niemueller
7  ****************************************************************************/
8 
9 /* This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU Library General Public License for more details.
18  *
19  * Read the full text in the LICENSE.GPL file in the doc directory.
20  */
21 
22 #ifndef _NAVGRAPH_CONSTRAINTS_STATIC_LIST_EDGE_COST_CONSTRAINT_H_
23 #define _NAVGRAPH_CONSTRAINTS_STATIC_LIST_EDGE_COST_CONSTRAINT_H_
24 
25 #include <core/utils/lock_vector.h>
26 #include <navgraph/constraints/edge_cost_constraint.h>
27 #include <navgraph/navgraph.h>
28 
29 #include <string>
30 #include <vector>
31 
32 namespace fawkes {
33 
34 class NavGraphStaticListEdgeCostConstraint : public NavGraphEdgeCostConstraint
35 {
36 public:
38 
40 
41  const std::vector<std::pair<fawkes::NavGraphEdge, float>> &edge_cost_list() const;
42 
43  void add_edge(const fawkes::NavGraphEdge &edge, const float cost_factor);
44  void add_edges(const std::vector<std::pair<fawkes::NavGraphEdge, float>> &edge_costs);
45  void remove_edge(const fawkes::NavGraphEdge &edge);
46  void clear_edges();
47  bool has_edge(const fawkes::NavGraphEdge &edge);
48 
49  virtual bool compute(void) throw();
50 
51  virtual float cost_factor(const fawkes::NavGraphNode &from,
52  const fawkes::NavGraphNode &to) throw();
53 
54 private:
55  std::vector<std::pair<fawkes::NavGraphEdge, float>> edge_cost_list_;
57  bool modified_;
58 };
59 
60 } // end namespace fawkes
61 
62 #endif
fawkes::NavGraphStaticListEdgeCostConstraint::compute
virtual bool compute(void)
Perform compuations before graph search and to indicate re-planning.
Definition: static_list_edge_cost_constraint.cpp:53
fawkes::NavGraphNode
Definition: navgraph_node.h:38
fawkes::NavGraphStaticListEdgeCostConstraint::remove_edge
void remove_edge(const fawkes::NavGraphEdge &edge)
Remove a single edge from the constraint list.
Definition: static_list_edge_cost_constraint.cpp:98
fawkes::NavGraphStaticListEdgeCostConstraint::add_edge
void add_edge(const fawkes::NavGraphEdge &edge, const float cost_factor)
Add a single edge to constraint list.
Definition: static_list_edge_cost_constraint.cpp:71
fawkes::NavGraphStaticListEdgeCostConstraint::NavGraphStaticListEdgeCostConstraint
NavGraphStaticListEdgeCostConstraint(std::string name)
Constructor.
Definition: static_list_edge_cost_constraint.cpp:41
fawkes::NavGraphEdge
Definition: navgraph_edge.h:40
fawkes::LockVector
Definition: lock_vector.h:39
fawkes::NavGraphStaticListEdgeCostConstraint::cost_factor
virtual float cost_factor(const fawkes::NavGraphNode &from, const fawkes::NavGraphNode &to)
Definition: static_list_edge_cost_constraint.cpp:151
fawkes::NavGraphStaticListEdgeCostConstraint::has_edge
bool has_edge(const fawkes::NavGraphEdge &edge)
Check if constraint has a specific edge.
Definition: static_list_edge_cost_constraint.cpp:118
fawkes::NavGraphStaticListEdgeCostConstraint::edge_cost_list
const std::vector< std::pair< fawkes::NavGraphEdge, float > > & edge_cost_list() const
Get list of blocked edges.
Definition: static_list_edge_cost_constraint.cpp:135
fawkes
fawkes::NavGraphStaticListEdgeCostConstraint::add_edges
void add_edges(const std::vector< std::pair< fawkes::NavGraphEdge, float >> &edge_costs)
Add multiple edges to constraint list.
Definition: static_list_edge_cost_constraint.cpp:86
fawkes::NavGraphStaticListEdgeCostConstraint::clear_edges
void clear_edges()
Remove all edges.
Definition: static_list_edge_cost_constraint.cpp:142
fawkes::NavGraphStaticListEdgeCostConstraint::~NavGraphStaticListEdgeCostConstraint
virtual ~NavGraphStaticListEdgeCostConstraint()
Virtual empty destructor.
Definition: static_list_edge_cost_constraint.cpp:48
fawkes::NavGraphEdgeCostConstraint::name
std::string name()
Get name of constraint.
Definition: edge_cost_constraint.cpp:82