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
32namespace fawkes {
33
35{
36public:
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) noexcept;
50
51 virtual float cost_factor(const fawkes::NavGraphNode &from,
52 const fawkes::NavGraphNode &to) noexcept;
53
54private:
55 std::vector<std::pair<fawkes::NavGraphEdge, float>> edge_cost_list_;
57 bool modified_;
58};
59
60} // end namespace fawkes
61
62#endif
Vector with a lock.
Definition: lock_vector.h:36
Constraint that can be queried for an edge cost factor.
std::string name()
Get name of constraint.
Topological graph edge.
Definition: navgraph_edge.h:38
Topological graph node.
Definition: navgraph_node.h:36
Constraint that hold cost factors for a static list of edges.
const std::vector< std::pair< fawkes::NavGraphEdge, float > > & edge_cost_list() const
Get list of blocked edges.
virtual float cost_factor(const fawkes::NavGraphNode &from, const fawkes::NavGraphNode &to) noexcept
Get cost factor for given edge.
void add_edges(const std::vector< std::pair< fawkes::NavGraphEdge, float > > &edge_costs)
Add multiple edges to constraint list.
void add_edge(const fawkes::NavGraphEdge &edge, const float cost_factor)
Add a single edge to constraint list.
virtual bool compute(void) noexcept
Perform compuations before graph search and to indicate re-planning.
void remove_edge(const fawkes::NavGraphEdge &edge)
Remove a single edge from the constraint list.
bool has_edge(const fawkes::NavGraphEdge &edge)
Check if constraint has a specific edge.
virtual ~NavGraphStaticListEdgeCostConstraint()
Virtual empty destructor.
Fawkes library namespace.