mtc_supcon.h
Go to the documentation of this file.
1 /** @file mtc_supcon.h
2 
3 Supremal controllable sublanguage and controllablity
4 
5 */
6 
7 /* FAU Discrete Event Systems Library (libfaudes)
8 
9  Copyright (C) 2008 Matthias Singer
10  Copyright (C) 2006 Bernd Opitz
11  Exclusive copyright is granted to Klaus Schmidt
12 
13  This library is free software; you can redistribute it and/or
14  modify it under the terms of the GNU Lesser General Public
15  License as published by the Free Software Foundation; either
16  version 2.1 of the License, or (at your option) any later version.
17 
18  This library is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  Lesser General Public License for more details.
22 
23  You should have received a copy of the GNU Lesser General Public
24  License along with this library; if not, write to the Free Software
25  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
26 
27 
28 #ifndef MTC_SUPCON_H
29 #define MTC_SUPCON_H
30 
31 #include "corefaudes.h"
32 #include "mtc_generator.h"
33 #include "mtc_project.h"
34 #include "mtc_parallel.h"
35 #include <stack>
36 
37 
38 namespace faudes {
39 
40 /**
41  * Nonblocking Supremal Controllable Sublanguage (wrapper function)
42  *
43  * Computes symbolic state names in resulting supervisor automaton
44  * if symbolic state names are enabled in rPlantGen and rSpecGen
45  *
46  * @param rPlantGen
47  * Plant MtcSystem
48  * @param rSpecGen
49  * Specification MtcSystem
50  * @param rResGen
51  * Reference to resulting MtcSystem, the
52  * minimal restrictive nonblocking supervisor
53  *
54  * @exception Exception
55  * - Alphabets of generators don't match (id 500)
56  * - plant nondeterministic (id 501)
57  * - spec nondeterministic (id 503)
58  * - plant and spec nondeterministic (id 504)
59  *
60  * <h4>Example: Synthesis of a strongly nonblocking supervisor for a model and a corresponding specification </h4>
61  * <table border=0> <tr> <td>
62  * <table width=100%>
63  * <tr> <td> <center> Model MtcSystem </center> </td> </tr>
64  * <tr> <td> @image html tmp_mtc_functions_5_plant.png </td> </tr>
65  * <tr> <td> <center> The model contains one state that results in a blocking behavior. </center> </td> </tr>
66  * </table>
67  * </td> </tr>
68  * <table width=100%>
69  * <tr> <td> <center> Specification MtcSystem </center> </td> </tr>
70  * <tr> <td> @image html tmp_mtc_functions_5_spec.png </td> </tr>
71  * <tr> <td> <center> The specification expresses, that after an event b an event c has to occur before b can happen again. Furthermore, it forbids that event c occurs before event b has taken place.
72  *
73  * Before being able to compute a supervisor, an inverse projection step has to be applied on the specification. It inserts self-loops for event a in both states, as the alphabets of model and specification must be identical. </center> </td> </tr>
74  * </table>
75  * </td> </tr>
76  * <tr> <td>
77  * <table width=100%>
78  * <tr> <td> <center> Strongly nonblocking supervisor </center> </td> </tr>
79  * <tr> <td> @image html tmp_mtc_functions_5_supernb.png </td> </tr>
80  * <tr> <td> <center> The synthesized supervisor ensures that the specification condition is fulfilled. That is why state 5 of the model and the corresponding transitions are erased. Observe that the operation does not make a generator nonblocking, as is shown in the example where state 3 is still existing. </center> </td> </tr>
81  * </table>
82  * </td> </tr>
83  * </table>
84  *
85  * @ingroup MultitaskingPlugin
86  */
87 extern FAUDES_API void mtcSupConNB(const MtcSystem& rPlantGen, const MtcSystem& rSpecGen,
88  MtcSystem& rResGen);
89 
90 
91 /**
92  * Nonblocking Supremal Controllable Sublanguage.
93  *
94  * Only for deterministic plant + spec. Throws exception if plant or
95  * spec is nondeterministic.
96  *
97  * Real mtcSupConNB function
98  *
99  * Finds the "largest" sublanguage of h for that language of g is
100  * controllable with respect to h. Differing from theory the marked
101  * language of h may not be a sublanguage of g but both must share the
102  * same alphabet.
103  *
104  * See "C.G CASSANDRAS AND S. LAFORTUNE. Introduction to Discrete Event
105  * Systems. Kluwer, 1999." for base algorithm.
106  *
107  * This version creates a "reverse composition map" given as reference
108  * parameter.
109  *
110  * @param rPlantGen
111  * Plant MtcSystem
112  * @param rSpecGen
113  * Specification MtcSystem
114  * @param rReverseCompositionMap
115  * std::map< std::pair<Idx,Idx>, Idx> as in the parallel composition function
116  * @param rResGen
117  * Reference to resulting MtcSystem, the
118  * minimal restrictive nonblocking supervisor
119  *
120  * @exception Exception
121  * - Alphabets of generators don't match (id 500)
122  * - plant nondeterministic (id 501)
123  * - spec nondeterministic (id 503)
124  * - plant and spec nondeterministic (id 504)
125  */
126 extern FAUDES_API void mtcSupConNB(const MtcSystem& rPlantGen, const MtcSystem& rSpecGen,
127  std::map< std::pair<Idx,Idx>,Idx >& rReverseCompositionMap, MtcSystem& rResGen);
128 
129 
130 /**
131  * Supremal Controllable Sublanguage (wrapper function)
132  *
133  * @param rPlantGen
134  * Plant MtcSystem
135  * @param rSpecGen
136  * Specification MtcSystem
137  * @param rResGen
138  * Reference to resulting MtcSystem, the
139  * minimal restrictive supervisor
140  *
141  * @exception Exception
142  * - Alphabets of generators don't match (id 500)
143  * - plant nondeterministic (id 501)
144  * - spec nondeterministic (id 503)
145  * - plant and spec nondeterministic (id 504)
146  *
147  * <h4>Example: Synthesis of a multitasking supervisor for a model and a corresponding specification. Supervisor does not take care of nonblocking behavior. </h4>
148  * <table border=0> <tr> <td>
149  * <table width=100%>
150  * <tr> <td> <center> Model MtcSystem </center> </td> </tr>
151  * <tr> <td> @image html tmp_mtc_functions_5_plant.png </td> </tr>
152  * <tr> <td> <center> The model contains one state that results in a blocking behavior. </center> </td> </tr>
153  * </table>
154  * </td> </tr>
155  * <table width=100%>
156  * <tr> <td> <center> Specification MtcSystem </center> </td> </tr>
157  * <tr> <td> @image html tmp_mtc_functions_5_spec.png </td> </tr>
158  * <tr> <td> <center> The specification expresses, that after an event b an event c has to occur before b can happen again. Furthermore, it forbids that event c occurs before event b has taken place.
159  *
160  * Before being able to compute a supervisor, an inverse projection step has to be applied on the specification. It inserts self-loops for event a in both states, as the alphabets of model and specification must be identical. </center> </td> </tr>
161  * </table>
162  * </td> </tr>
163  * <tr> <td>
164  * <table width=100%>
165  * <tr> <td> <center> Strongly nonblocking supervisor </center> </td> </tr>
166  * <tr> <td> @image html tmp_mtc_functions_5_super.png </td> </tr>
167  * <tr> <td> <center> The supervisor synthesized by this function is strongly nonblocking. Of course, it ensures that the specification condition is fulfilled. </center> </td> </tr>
168  * </table>
169  * </td> </tr>
170  * </table>
171  *
172  * @ingroup MultitaskingPlugin
173  */
174 extern FAUDES_API void mtcSupConClosed(const MtcSystem& rPlantGen, const MtcSystem& rSpecGen,
175  MtcSystem& rResGen);
176 
177 
178 /**
179  * Supremal Controllable Sublanguage.
180  *
181  * Only for deterministic plant + spec. Throws exception if plant or
182  * spec is nondeterministic.
183  *
184  * Real mtcSupCon function
185  *
186  * Finds the "largest" sublanguage of h for that language of g is
187  * controllable with respect to h. Differing from theory the marked
188  * language of h may not be a sublanguage of g but both must share the
189  * same alphabet.
190  *
191  * See "C.G CASSANDRAS AND S. LAFORTUNE. Introduction to Discrete Event
192  * Systems. Kluwer, 1999." for base algorithm.
193  *
194  * This version creates a "reverse composition map" given as reference
195  * parameter.
196  *
197  * @param rPlantGen
198  * Plant MtcSystem
199  * @param rSpecGen
200  * Specification MtcSystem
201  * @param rReverseCompositionMap
202  * std::map< std::pair<Idx,Idx>, Idx> as in the parallel composition function
203  * @param rResGen
204  * Reference to resulting MtcSystem, the
205  * minimal restrictive supervisor
206  *
207  * @exception Exception
208  * - Alphabets of generators don't match (id 500)
209  * - plant nondeterministic (id 501)
210  * - spec nondeterministic (id 503)
211  * - plant and spec nondeterministic (id 504)
212  */
213 extern FAUDES_API void mtcSupConClosed(const MtcSystem& rPlantGen, const MtcSystem& rSpecGen,
214  std::map< std::pair<Idx,Idx>,Idx >& rReverseCompositionMap, MtcSystem& rResGen);
215 
216 /**
217  * Fast parallel composition for computation for the mtcSupConNB.
218  * Composition stops at transition paths that leave the specification
219  * by uncontrollable events in plant.
220  *
221  * @param rPlantGen
222  * Plant MtcSystem
223  * @param rSpecGen
224  * Specification MtcSystem
225  * @param rUAlph
226  * Uncontrollable Events
227  * @param rReverseCompositionMap
228  * std::map< std::pair<Idx,Idx>, Idx> as in the parallel composition function
229  * @param rResGen
230  * Reference to resulting MtcSystem, the
231  * less restrictive supervisor
232  */
233 extern FAUDES_API void mtcSupConParallel(const MtcSystem& rPlantGen, const MtcSystem& rSpecGen,
234  const EventSet& rUAlph, std::map< std::pair<Idx,Idx>, Idx>& rReverseCompositionMap,
235  MtcSystem& rResGen);
236 
237 /*
238 
239  obsolete
240 
241  * Helper function for supermal controllable sublanguage computation
242  * the colors of a state in the shared behavior are determined
243  *
244  * @param rPlantGen
245  * Plant MtcSystem
246  * @param rSpecGen
247  * Specification MtcSystem
248  * @param SharedColors
249  * colors shared between rPlantGen and rSpecGen
250  * @param currentstates
251  * std::pair<Idx,Idx> contains the current states of both generators
252  * @param ComposedSet
253  * Contains the Composed ColorSet
254  void ComposedColorSet(const ColorSet& SharedColors,const std::pair<Idx,Idx>& currentstates,
255  const MtcSystem& rPlantGen,const MtcSystem& rSpecGen,ColorSet& ComposedSet);
256 */
257 
258 /**
259  * Supremal Controllable Sublangauge (Real SupCon function; unchecked)
260  *
261  * Both, plant and spec MUST be deterministic and share the same alphabet!!!
262  *
263  * Most likely will result in blocking states.
264  *
265  * @param rPlantGen
266  * Plant generator
267  * @param rCAlph
268  * Controllable events
269  * @param rSupGen
270  * Specification generator
271  *
272  *
273  * @exception Exception
274  * - Alphabets of generators don't match (id 500)
275  * - Plant generator nondeterministic (id 501)
276  * - Specification generator nondeterministic (id 503)
277  * - Plant & Spec generator nondeterministic (id 504)
278  */
279 extern FAUDES_API void mtcSupConUnchecked(const MtcSystem& rPlantGen, const EventSet& rCAlph, MtcSystem& rSupGen);
280 
281 } // namespace faudes
282 
283 #endif
284 
#define FAUDES_API
Interface export/import symbols: windows.
Definition: cfl_platform.h:80
Includes all libFAUDES headers, no plugins.
NameSet EventSet
Convenience typedef for plain event sets.
Definition: cfl_nameset.h:533
void mtcSupConNB(const MtcSystem &rPlantGen, const MtcSystem &rSpecGen, MtcSystem &rResGen)
Nonblocking Supremal Controllable Sublanguage (wrapper function)
Definition: mtc_supcon.cpp:41
void mtcSupConClosed(const MtcSystem &rPlantGen, const MtcSystem &rSpecGen, MtcSystem &rResGen)
Supremal Controllable Sublanguage (wrapper function)
Definition: mtc_supcon.cpp:130
Methods for handling multitasking generators.
Methods for parallel composition of multitasking generators.
Methods for computing the natural projection of multitasking generators.
libFAUDES resides within the namespace faudes.
uint32_t Idx
Type definition for index type (allways 32bit)
void mtcSupConUnchecked(const MtcSystem &rPlantGen, const EventSet &rCAlph, MtcSystem &rSpecGen)
Supremal Controllable Sublangauge (Real SupCon function; unchecked)
Definition: mtc_supcon.cpp:464
void mtcSupConParallel(const MtcSystem &rPlantGen, const MtcSystem &rSpecGen, const EventSet &rUAlph, std::map< std::pair< Idx, Idx >, Idx > &rReverseCompositionMap, MtcSystem &rResGen)
Fast parallel composition for computation for the mtcSupConNB.
Definition: mtc_supcon.cpp:220
TmtcGenerator< AttributeVoid, AttributeColoredState, AttributeCFlags, AttributeVoid > MtcSystem

libFAUDES 2.32f --- 2024.12.22 --- c++ api documentaion by doxygen