hyper_graph.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * Software License Agreement
4  *
5  * Copyright (c) 2020,
6  * TU Dortmund - Institute of Control Theory and Systems Engineering.
7  * All rights reserved.
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 3 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 General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <https://www.gnu.org/licenses/>.
21  *
22  * Authors: Christoph Rösmann
23  *********************************************************************/
24 
25 #ifndef SRC_OPTIMIZATION_INCLUDE_CORBO_OPTIMIZATION_HYPER_GRAPH_HYPER_GRAPH_H_
26 #define SRC_OPTIMIZATION_INCLUDE_CORBO_OPTIMIZATION_HYPER_GRAPH_HYPER_GRAPH_H_
27 
28 #include <corbo-core/types.h>
31 
32 #include <memory>
33 #include <vector>
34 
35 namespace corbo {
36 
47 {
48  public:
49  using Ptr = std::shared_ptr<HyperGraph>;
50 
51  // enum class EdgeType { Objective, Equality, Inequality };
52 
54  {
55  setEdgeSet(std::make_shared<OptimizationEdgeSet>());
56  setVertexSet(std::make_shared<VertexSet>());
57  }
58 
60  {
61  setEdgeSet(edges);
62  setVertexSet(vertices);
63  }
64 
65  virtual ~HyperGraph() {}
66 
67  void setEdgeSet(OptimizationEdgeSet::Ptr edges) { _edges = edges; }
68  void setVertexSet(VertexSetInterface::Ptr vertices) { _vertices = vertices; }
69 
70  bool hasEdgeSet() const { return (bool)_edges; }
71  bool hasVertexSet() const { return (bool)_vertices; }
72 
75 
76  OptimizationEdgeSet* getEdgeSetRaw() const { return _edges.get(); }
77  VertexSetInterface* getVertexSetRaw() const { return _vertices.get(); }
78 
80  // int numObjectiveEdges() { return (int)_edges_objective.size(); }
82  // int numEqualityEdges() { return (int)_edges_equalities.size(); }
84  // int numInequalityEdges() { return (int)_edges_inequalities.size(); }
86  // int numVertices() { return (int)_vertices.size(); }
87 
89  // void addVertex(VertexInterface* vtx);
91  // void addObjectiveEdge(EdgeInterface::UPtr edge);
93  // void addEqualityConstraintEdge(EdgeInterface::UPtr edge);
95  // void addInequalityConstraintEdge(EdgeInterface::UPtr edge);
96 
98 
105  // void resetStructure();
106 
108  bool checkGraphConsistency();
109 
110  protected:
111  OptimizationEdgeSet::Ptr _edges; // TODO(roesmann): generalize to EdgeSetInterface?
113 
114  // internal states
115  // bool _edge_obj_idx_precomputed = false;
116  // bool _edge_eq_idx_precomputed = false;
117  // bool _edge_ineq_idx_precomputed = false;
118  // bool _vertex_idx_precomputed = false;
119  // int _finite_bounds_precomputed = false;
120 };
121 
122 } // namespace corbo
123 
124 #endif // SRC_OPTIMIZATION_INCLUDE_CORBO_OPTIMIZATION_HYPER_GRAPH_HYPER_GRAPH_H_
OptimizationEdgeSet::Ptr getEdgeSet() const
Definition: hyper_graph.h:73
Abstract class representing a set of vertices.
Definition: vertex_set.h:45
VertexSetInterface * getVertexSetRaw() const
Definition: hyper_graph.h:77
hyper-graph representation
Definition: hyper_graph.h:46
bool checkGraphConsistency()
Return number of objective edges.
Definition: hyper_graph.cpp:50
virtual ~HyperGraph()
Definition: hyper_graph.h:65
std::shared_ptr< HyperGraph > Ptr
Definition: hyper_graph.h:49
void setVertexSet(VertexSetInterface::Ptr vertices)
Definition: hyper_graph.h:68
HyperGraph(OptimizationEdgeSet::Ptr edges, VertexSetInterface::Ptr vertices)
Definition: hyper_graph.h:59
std::shared_ptr< OptimizationEdgeSet > Ptr
Definition: edge_set.h:77
OptimizationEdgeSet::Ptr _edges
Definition: hyper_graph.h:111
bool hasVertexSet() const
Definition: hyper_graph.h:71
std::shared_ptr< VertexSetInterface > Ptr
Definition: vertex_set.h:48
VertexSetInterface::Ptr getVertexSet() const
Definition: hyper_graph.h:74
OptimizationEdgeSet * getEdgeSetRaw() const
Definition: hyper_graph.h:76
void setEdgeSet(OptimizationEdgeSet::Ptr edges)
Definition: hyper_graph.h:67
VertexSetInterface::Ptr _vertices
Definition: hyper_graph.h:112
bool hasEdgeSet() const
Definition: hyper_graph.h:70


control_box_rst
Author(s): Christoph Rösmann
autogenerated on Mon Feb 28 2022 22:06:54