syn_ctrlpfx.h
Go to the documentation of this file.
1/** @file syn_ctrlpfx.h Controllability prefix */
2
3/* FAU Discrete Event Systems Library (libfaudes)
4
5 Copyright (C) 2025 Thomas Moor
6 Exclusive copyright is granted to Klaus Schmidt
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
21
22
23#ifndef FAUDES_SYN_CTRLPFX_H
24#define FAUDES_SYN_CTRLPFX_H
25
26#include "corefaudes.h"
27
28namespace faudes {
29
30
31/**
32 * Operator on state sets
33 *
34 * Light weight base class to be used in fixpoint iterations. See
35 * faudes::CtrlPfxOperator for an example of a derived class.
36 *
37 * @ingroup SynthesisPlugIn
38 */
40
41public:
42
43 /** construct */
45
46 /** disable copy construct */
48
49 /** destruct */
51
52 /**
53 * Domain
54 *
55 * Some operations need to take complements and thus refer to the full state set.
56 * The base class returns the empty set as a dummy. Reimplement this function
57 * if you need that extra functionality. See faudes::CtrlPfxOperator for a derived class.
58 *
59 * @return
60 * Full state set.
61 **/
62 virtual const StateSet& Domain(void) const;
63
64 /**
65 * Evaluate opertor on arguments
66 *
67 * This is a wrapper for the protected method DoEvaluate. The latter
68 * should be re-implemented by derived classes to encode the actual operator.
69 *
70 * @param rArgs
71 * State-set valued arguments the operator performs on
72 * @param rRes
73 * Resulting state set
74 **/
75 void Evaluate(StateSetVector& rArgs, StateSet& rRes) const;
76
77 /**
78 * Evaluate opertor on arguments
79 *
80 * This is a convenience wrapper for the protected method DoEvaluate for
81 * operators with only one argument.
82 *
83 * @param rArg
84 * State-set valued argument
85 * @param rRes
86 * Resulting state set
87 **/
88 void Evaluate(StateSet& rArg, StateSet& rRes) const;
89
90 /**
91 * Evaluate opertor on arguments
92 *
93 * This is a convenience wrapper for the protected method DoEvaluate for
94 * operators with no arguments.
95 *
96 * @param rRes
97 * Resulting state set
98 **/
99 void Evaluate(StateSet& rRes) const;
100
101 /** signature, i.e., the number of arguments we expect */
102 StateSetVector::Position ArgCount(void) const;
103
104 /** signature, i.e., argument names (cosmetic) */
105 const std::string& ArgName(StateSetVector::Position pos) const;
106
107 /** argument stats (debugging/development) */
108 std::string ArgStatistics(const StateSetVector& rArgs) const;
109
110 /** indent (cosmetic) */
111 virtual const std::string& Indent(void) const;
112
113 /** indent (cosmetic) */
114 virtual void Indent(const std::string& indent) const;
115
116protected:
117
118 /** signature */
120
121 /** support cosmetic siganture */
122 std::vector<std::string> mArgNames;
123
124 /** support cosmetic */
125 std::string mIndent;
126
127
128 /**
129 * Evaluate opertor on arguments (protected virtual)
130 *
131 * The arguments are given as a vector of state sets. For fixpoint iterations, the last
132 * entry in the vector becomes the iteration variable, while the remaining entries are constant
133 * parameters. Re-implement this function for the oparater you want to iterate on. See
134 * faudes::CtrlPfxOperator for a derived class.
135 *
136 * @param rAggs
137 * State-set valued arguments the operator performs on
138 * @param rRes
139 * Resulting state set
140 **/
141 virtual void DoEvaluate(StateSetVector& rArgs, StateSet& rRes) =0;
142
143};
144
145/**
146 * Operator used for the computation of the controllability prefix.
147 *
148 * @ingroup SynthesisPlugIn
149 */
151
152public:
153
154 /** construct */
155 CtrlPfxOperator(const vGenerator& rGenerator, const EventSet& rSigmaCtrl);
156
157 /** destruct */
159
160 /**
161 * Domain
162 *
163 * Report the universe of all states, as given by the generator on construction.
164 *
165 * @return
166 * Full state set.
167 **/
168 virtual const StateSet& Domain(void) const;
169
170protected:
171
172 /**
173 * Evaluate opertor on arguments
174 *
175 * For the purpose of the controllability prefix, we evalate to
176 *
177 * eval([Y,X]) =
178 * (pre_exitential(X) union marked_states) intersected with pre_universal_ctrl(Y)
179 *
180 * Note: the order of the argument vector matters. The last entry is the iterate
181 * in the inner most iteration.
182 *
183 * @param rArgs
184 * Argument [Y,X] in that order
185 * @param rRes
186 * Resulting state set
187 **/
188 virtual void DoEvaluate(StateSetVector& rArgs, StateSet& rRes);
189
190
191 /** set up context references */
193
194 /** set up conbtext references */
196
197 /** set up context references */
199
200 /** have a reverse transition relation*/
202
203};
204
205/**
206 * Mu-iterations on state sets.
207 *
208 * Given an opertor on state stes, this class facilitates nested
209 * fixpoint iterations as in the mu-calculus. In tis specific class,
210 * we implement the mu-iteration, i.e., we seek for the smallest fixpoint.
211 *
212 * The implementation is meant for a simple API, we do not care about
213 * performance at this stage.
214 *
215 * @ingroup SynthesisPlugIn
216 */
218
219 public:
220
221 /**
222 * Construct from operator
223 *
224 * The last entry of the operator argument becomes the variable we iterate in.
225 * The preceeding entries are interpreted ans constant paramters in our scope.
226 *
227 * @param rOp
228 * Operator to iterate
229 */
230 MuIteration(const StateSetOperator& rOp);
231
232 /** detsruct */
234
235 /**
236 * Domain
237 *
238 * Report the universe of all states, as given by the operator on construction.
239 *
240 * @return
241 * Full state set.
242 **/
243 virtual const StateSet& Domain(void) const;
244
245 /**
246 * Evaluate opertor on arguments and return ranking
247 *
248 * The ranking is the loop count at which a state was newly added
249 * to the result.
250 *
251 * @param rArgs
252 * State-set valued arguments the operator performs on
253 * @param rRMap
254 * Result with rank attached.
255 **/
256 void Rank(StateSetVector& rArgs, std::map<Idx,int>& rRMap) const;
257
258 /**
259 * Evaluate opertor on arguments and return ranking
260 *
261 * This is a convenience wrapper for Rank addressing operators
262 * with orny one argument.
263 *
264 * @param rArg
265 * State-set argument the operator performs on
266 * @param rRMap
267 * Result with rank attached.
268 **/
269 void Rank(StateSet& rArg, std::map<Idx,int>& rRMap) const;
270
271 /**
272 * Evaluate opertor on arguments and return ranking
273 *
274 * This is a convenience wrapper for Rank addressing operators
275 * with no arguments.
276 *
277 * @param rRMap
278 * Result with rank attached.
279 **/
280 void Rank(std::map<Idx,int>& rRMap) const;
281
282
283 /** indent (cosmetic) */
284 using StateSetOperator::Indent;
285 virtual void Indent(const std::string& indent) const;
286
287protected:
288
289 /**
290 * Implement the mu-iteration to find the smallest fixpoint.
291 *
292 * Given the parameter vector rArgs, we append one additional state set
293 * X for which we seek a fixpoint of Op(rArgs,X). Effectively we iterate
294 *
295 * X(0) = emptyset
296 * X(i+1) = Op(rArgs,X(i))
297 *
298 * until the fixpoint is achieved.
299 *
300 * @param rArgs
301 * Arguments the operator performs on
302 * @param rRes
303 * Resulting state set
304 **/
305 virtual void DoEvaluate(StateSetVector& rArgs, StateSet& rRes);
306
307 /** the base operator to iterate with */
309};
310
311
312/**
313 * Nu-iterations on state sets.
314 *
315 * Given an opertor on state stes, this class facilitates nested
316 * fixpoint iterations as in the mu-calculus. In tis specific class,
317 * we implement the nu-iteration, i.e., we seek for the greatest fixpoint.
318 *
319 * The implementation is meant for a simple API, we do not care about
320 * performance at this stage.
321 *
322 * @ingroup SynthesisPlugIn
323 */
325
326 public:
327
328 /**
329 * Construct from operator
330 *
331 * The last entry of the operator argument becomes the variable we iterate in.
332 * The preceeding entries are interpreted ans constant paramters in our scope.
333 *
334 * @param rOp
335 * Operator to iterate
336 */
337 NuIteration(const StateSetOperator& rOp);
338
339 /** detsruct */
341
342 /**
343 * Domain
344 *
345 * Report the universe of all states, as given by the operator on construction.
346 *
347 * @return
348 * Full state set.
349 **/
350 virtual const StateSet& Domain(void) const;
351
352
353 /** reimplemengt indent */
354 using StateSetOperator::Indent;
355 virtual void Indent(const std::string& indent) const;
356
357protected:
358
359 /**
360 * Implement the nu-iteration to find the smallest fixpoint.
361 *
362 * Given the parameter vector rArgs, we append one additional state set
363 * X for which we seek a fixpoint of Op(rArgs,X). Effectively we iterate
364 *
365 * X(0) = Domain
366 * X(i+1) = Op(rArgs,X(i))
367 *
368 * until the fixpoint is achieved.
369 *
370 * @param rArgs
371 * Arguments the operator performs on
372 * @param rRes
373 * Resulting state set
374 **/
375 virtual void DoEvaluate(StateSetVector& rArgs, StateSet& rRes);
376
377 /** the base operator to iterate on */
379};
380
381
382
383
384
385
386} // namespace faudes
387
388#endif
389
390
#define FAUDES_API
const TransSet & rTransRel
const vGenerator & rGen
TransSetX2EvX1 mRevTransRel
const StateSetOperator & mrOp
const StateSetOperator & mrOp
StateSetOperator(const StateSetOperator &)=delete
std::vector< std::string > mArgNames
virtual void DoEvaluate(StateSetVector &rArgs, StateSet &rRes)=0
StateSetVector::Position mArgCount
std::vector< int >::size_type Position

libFAUDES 2.33k --- 2025.09.16 --- c++ api documentaion by doxygen