mCRL2
Loading...
Searching...
No Matches
stategraph_influence.h
Go to the documentation of this file.
1// Author(s): Wieger Wesselink
2// Copyright: see the accompanying file COPYING or copy at
3// https://github.com/mCRL2org/mCRL2/blob/master/COPYING
4//
5// Distributed under the Boost Software License, Version 1.0.
6// (See accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8//
9/// \file mcrl2/pbes/detail/stategraph_influence.h
10/// \brief add your file description here.
11
12#ifndef MCRL2_PBES_DETAIL_STATEGRAPH_INFLUENCE_H
13#define MCRL2_PBES_DETAIL_STATEGRAPH_INFLUENCE_H
14
15#include "mcrl2/pbes/detail/pfnf_pbes.h"
16#include "mcrl2/pbes/detail/stategraph_pbes.h"
17
18namespace mcrl2::pbes_system::detail {
19
20/// \brief Algorithm class for the stategraph algorithm
22{
23 public:
25 : m_pbes(p)
26 {}
27
28 // vertex of the influence graph
30 {
31 core::identifier_string X;
33
34 std::string print() const
35 {
36 std::ostringstream out;
37 out << X << ", " << v;
38 return out.str();
39 }
40
41 influence_vertex(const core::identifier_string& X_, const data::variable& v_)
42 : X(X_), v(v_)
43 {}
44 };
45
46 // influence_edge of the influence graph
48 {
51
52 std::string print() const
53 {
54 std::ostringstream out;
55 out << core::pp(source->X) << " ---> " << core::pp(target->X);
56 return out.str();
57 }
58
59 influence_edge(const influence_vertex* source_, const influence_vertex* target_)
60 : source(source_), target(target_)
61 {}
62 };
63
65 {
66 mCRL2log(log::log_level_t::verbose) << "--- influence graph ---\n";
67 for (const auto& v: m_influence_vertices)
68 {
69 mCRL2log(log::log_level_t::verbose) << v.print() << std::endl;
70 }
71 for (const auto& e: m_influence_edges)
72 {
73 mCRL2log(log::log_level_t::verbose) << e.print() << std::endl;
74 }
75 }
76
77 protected:
78 // the pbes that is considered
80
81 // vertices of the influence graph
83
84 // edges of the influence graph
86
87 // very inefficient
88 std::vector<influence_vertex>::const_iterator find_vertex(const core::identifier_string& X, const data::variable& v) const
89 {
90 for (auto i = m_influence_vertices.begin(); i != m_influence_vertices.end(); ++i)
91 {
92 if (i->X == X && i->v == v)
93 {
94 return i;
95 }
96 }
98 }
99
101 {
102 using utilities::detail::contains;
103
104 // compute the vertices
105 auto const& equations = m_pbes.equations();
107 {
108 auto const& X = equation.variable().name();
109 auto const& Xparams = equation.parameters();
110 for (const auto & Xparam : Xparams)
111 {
113 }
114 }
115
116 // compute the edges
118 {
122 for (const auto & predvar : predvars)
123 {
124 auto const& Y = predvar.variable();
127 const std::vector<data::variable>& d_Y = eqn.parameters();
128 for (std::size_t p = 0; p < Yparameters.size(); p++)
129 {
131 for (const data::variable& v: d_X)
132 {
133 if (contains(freevars, v))
134 {
135 auto source = find_vertex(Xname, v);
136 auto target = find_vertex(Y.name(), d_Y[p]);
137 influence_edge e(&(*source), &(*target));
139 }
140 }
141 }
142 }
143 }
144 }
145
146 public:
147
148 void run()
149 {
152 }
153 };
154
155} // namespace mcrl2::pbes_system::detail
156
157#endif // MCRL2_PBES_DETAIL_STATEGRAPH_INFLUENCE_H
aterm_string(const aterm_string &t) noexcept=default
\brief A data variable
Definition variable.h:25
variable(const variable &) noexcept=default
Move semantics.
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
Definition logger.h:435
influence_edge(const influence_vertex *source_, const influence_vertex *target_)
influence_vertex(const core::identifier_string &X_, const data::variable &v_)