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 
30 #include "corefaudes.h"
31 #include "mtc_generator.h"
32 #include "mtc_project.h"
33 #include "mtc_parallel.h"
34 #include <stack>
35 
36 
37 namespace faudes {
38 
39 /**
40  * Nonblocking Supremal Controllable Sublanguage (wrapper function)
41  *
42  * Computes symbolic state names in resulting supervisor automaton
43  * if symbolic state names are enabled in rPlantGen and rSpecGen
44  *
45  * @param rPlantGen
46  * Plant MtcSystem
47  * @param rSpecGen
48  * Specification MtcSystem
49  * @param rResGen
50  * Reference to resulting MtcSystem, the
51  * minimal restrictive nonblocking supervisor
52  *
53  * @exception Exception
54  * - Alphabets of generators don't match (id 500)
55  * - plant nondeterministic (id 501)
56  * - spec nondeterministic (id 503)
57  * - plant and spec nondeterministic (id 504)
58  *
59  * <h4>Example: Synthesis of a strongly nonblocking supervisor for a model and a corresponding specification </h4>
60  * <table border=0> <tr> <td>
61  * <table width=100%>
62  * <tr> <td> <center> Model MtcSystem </center> </td> </tr>
63  * <tr> <td> @image html tmp_mtc_functions_5_plant.png </td> </tr>
64  * <tr> <td> <center> The model contains one state that results in a blocking behavior. </center> </td> </tr>
65  * </table>
66  * </td> </tr>
67  * <table width=100%>
68  * <tr> <td> <center> Specification MtcSystem </center> </td> </tr>
69  * <tr> <td> @image html tmp_mtc_functions_5_spec.png </td> </tr>
70  * <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.
71  *
72  * 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>
73  * </table>
74  * </td> </tr>
75  * <tr> <td>
76  * <table width=100%>
77  * <tr> <td> <center> Strongly nonblocking supervisor </center> </td> </tr>
78  * <tr> <td> @image html tmp_mtc_functions_5_supernb.png </td> </tr>
79  * <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>
80  * </table>
81  * </td> </tr>
82  * </table>
83  *
84  * @ingroup MultitaskingPlugin
85  */
86 void mtcSupConNB(const MtcSystem& rPlantGen, const MtcSystem& rSpecGen,
87  MtcSystem& rResGen);
88 
89 
90 /**
91  * Nonblocking Supremal Controllable Sublanguage.
92  *
93  * Only for deterministic plant + spec. Throws exception if plant or
94  * spec is nondeterministic.
95  *
96  * Real mtcSupConNB function
97  *
98  * Finds the "largest" sublanguage of h for that language of g is
99  * controllable with respect to h. Differing from theory the marked
100  * language of h may not be a sublanguage of g but both must share the
101  * same alphabet.
102  *
103  * See "C.G CASSANDRAS AND S. LAFORTUNE. Introduction to Discrete Event
104  * Systems. Kluwer, 1999." for base algorithm.
105  *
106  * This version creates a "reverse composition map" given as reference
107  * parameter.
108  *
109  * @param rPlantGen
110  * Plant MtcSystem
111  * @param rSpecGen
112  * Specification MtcSystem
113  * @param rReverseCompositionMap
114  * std::map< std::pair<Idx,Idx>, Idx> as in the parallel composition function
115  * @param rResGen
116  * Reference to resulting MtcSystem, the
117  * minimal restrictive nonblocking supervisor
118  *
119  * @exception Exception
120  * - Alphabets of generators don't match (id 500)
121  * - plant nondeterministic (id 501)
122  * - spec nondeterministic (id 503)
123  * - plant and spec nondeterministic (id 504)
124  */
125 void mtcSupConNB(const MtcSystem& rPlantGen, const MtcSystem& rSpecGen,
126  std::map< std::pair<Idx,Idx>,Idx >& rReverseCompositionMap, MtcSystem& rResGen);
127 
128 
129 /**
130  * Supremal Controllable Sublanguage (wrapper function)
131  *
132  * @param rPlantGen
133  * Plant MtcSystem
134  * @param rSpecGen
135  * Specification MtcSystem
136  * @param rResGen
137  * Reference to resulting MtcSystem, the
138  * minimal restrictive supervisor
139  *
140  * @exception Exception
141  * - Alphabets of generators don't match (id 500)
142  * - plant nondeterministic (id 501)
143  * - spec nondeterministic (id 503)
144  * - plant and spec nondeterministic (id 504)
145  *
146  * <h4>Example: Synthesis of a multitasking supervisor for a model and a corresponding specification. Supervisor does not take care of nonblocking behavior. </h4>
147  * <table border=0> <tr> <td>
148  * <table width=100%>
149  * <tr> <td> <center> Model MtcSystem </center> </td> </tr>
150  * <tr> <td> @image html tmp_mtc_functions_5_plant.png </td> </tr>
151  * <tr> <td> <center> The model contains one state that results in a blocking behavior. </center> </td> </tr>
152  * </table>
153  * </td> </tr>
154  * <table width=100%>
155  * <tr> <td> <center> Specification MtcSystem </center> </td> </tr>
156  * <tr> <td> @image html tmp_mtc_functions_5_spec.png </td> </tr>
157  * <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.
158  *
159  * 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>
160  * </table>
161  * </td> </tr>
162  * <tr> <td>
163  * <table width=100%>
164  * <tr> <td> <center> Strongly nonblocking supervisor </center> </td> </tr>
165  * <tr> <td> @image html tmp_mtc_functions_5_super.png </td> </tr>
166  * <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>
167  * </table>
168  * </td> </tr>
169  * </table>
170  *
171  * @ingroup MultitaskingPlugin
172  */
173 void mtcSupConClosed(const MtcSystem& rPlantGen, const MtcSystem& rSpecGen,
174  MtcSystem& rResGen);
175 
176 
177 /**
178  * Supremal Controllable Sublanguage.
179  *
180  * Only for deterministic plant + spec. Throws exception if plant or
181  * spec is nondeterministic.
182  *
183  * Real mtcSupCon function
184  *
185  * Finds the "largest" sublanguage of h for that language of g is
186  * controllable with respect to h. Differing from theory the marked
187  * language of h may not be a sublanguage of g but both must share the
188  * same alphabet.
189  *
190  * See "C.G CASSANDRAS AND S. LAFORTUNE. Introduction to Discrete Event
191  * Systems. Kluwer, 1999." for base algorithm.
192  *
193  * This version creates a "reverse composition map" given as reference
194  * parameter.
195  *
196  * @param rPlantGen
197  * Plant MtcSystem
198  * @param rSpecGen
199  * Specification MtcSystem
200  * @param rReverseCompositionMap
201  * std::map< std::pair<Idx,Idx>, Idx> as in the parallel composition function
202  * @param rResGen
203  * Reference to resulting MtcSystem, the
204  * minimal restrictive supervisor
205  *
206  * @exception Exception
207  * - Alphabets of generators don't match (id 500)
208  * - plant nondeterministic (id 501)
209  * - spec nondeterministic (id 503)
210  * - plant and spec nondeterministic (id 504)
211  */
212 void mtcSupConClosed(const MtcSystem& rPlantGen, const MtcSystem& rSpecGen,
213  std::map< std::pair<Idx,Idx>,Idx >& rReverseCompositionMap, MtcSystem& rResGen);
214 
215 /**
216  * Fast parallel composition for computation for the mtcSupConNB.
217  * Composition stops at transition paths that leave the specification
218  * by uncontrollable events in plant.
219  *
220  * @param rPlantGen
221  * Plant MtcSystem
222  * @param rSpecGen
223  * Specification MtcSystem
224  * @param rUAlph
225  * Uncontrollable Events
226  * @param rReverseCompositionMap
227  * std::map< std::pair<Idx,Idx>, Idx> as in the parallel composition function
228  * @param rResGen
229  * Reference to resulting MtcSystem, the
230  * less restrictive supervisor
231  */
232 void mtcSupConParallel(const MtcSystem& rPlantGen, const MtcSystem& rSpecGen,
233  const EventSet& rUAlph, std::map< std::pair<Idx,Idx>, Idx>& rReverseCompositionMap,
234  MtcSystem& rResGen);
235 
236 /*
237 
238  obsolete
239 
240  * Helper function for supermal controllable sublanguage computation
241  * the colors of a state in the shared behavior are determined
242  *
243  * @param rPlantGen
244  * Plant MtcSystem
245  * @param rSpecGen
246  * Specification MtcSystem
247  * @param SharedColors
248  * colors shared between rPlantGen and rSpecGen
249  * @param currentstates
250  * std::pair<Idx,Idx> contains the current states of both generators
251  * @param ComposedSet
252  * Contains the Composed ColorSet
253  void ComposedColorSet(const ColorSet& SharedColors,const std::pair<Idx,Idx>& currentstates,
254  const MtcSystem& rPlantGen,const MtcSystem& rSpecGen,ColorSet& ComposedSet);
255 */
256 
257 /**
258  * Supremal Controllable Sublangauge (Real SupCon function; unchecked)
259  *
260  * Both, plant and spec MUST be deterministic and share the same alphabet!!!
261  *
262  * Most likely will result in blocking states.
263  *
264  * @param rPlantGen
265  * Plant generator
266  * @param rCAlph
267  * Controllable events
268  * @param rSupGen
269  * Specification generator
270  *
271  *
272  * @exception Exception
273  * - Alphabets of generators don't match (id 500)
274  * - Plant generator nondeterministic (id 501)
275  * - Specification generator nondeterministic (id 503)
276  * - Plant & Spec generator nondeterministic (id 504)
277  */
278 void mtcSupConUnchecked(const MtcSystem& rPlantGen, const EventSet& rCAlph, MtcSystem& rSupGen);
279 
280 } // namespace faudes
281 
282 #define MTC_SUPCON_H
283 #endif
284 

libFAUDES 2.26g --- 2015.08.17 --- c++ api documentaion by doxygen