mtc_project.h
Go to the documentation of this file.
1 /** @file mtc_project.h
2 
3 Methods for computing the natural projection of multitasking generators
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 FAUDES_MTCPROJECT_H
29 #define FAUDES_MTCPROJECT_H
30 
31 #include "corefaudes.h"
32 #include "mtc_generator.h"
33 #include "mtc_statemin.h"
34 
35 namespace faudes {
36 
37 
38 /**
39  * Make generator deterministic. (function wrapper)
40  *
41  * @param rGen
42  * Reference to generator
43  * @param rResGen
44  * Reference to resulting deterministic generator
45  *
46  * <h4>Example: Converting a nondeterministic MtcSystem to a deterministic one </h4>
47  * <table border=0> <tr> <td>
48  * <table width=100%>
49  * <tr> <td> <center> Original MtcSystem gen</center> </td> </tr>
50  * <tr> <td> @image html tmp_mtc_functions_2a_nondet.png </td> </tr>
51  * <tr> <td> <center> The MtcSystem contains two initial states and, leaving from state 2, it has two transitions containing the same event b which are leading to two separate states. </center> </td> </tr>
52  * </table>
53  * </td> </tr>
54  * <tr> <td>
55  * <table width=100%>
56  * <tr> <td> <center> Result of the deterministic operation </center> </td> </tr>
57  * <tr> <td> @image html tmp_mtc_functions_2b_det.png </td> </tr>
58  * <tr> <td> <center> Both initial states are combined to a single one. All color labels appearing in all original states are adapted to the new initial state. Furthermore, states are merged in that way that the generator's language stays the same, but the generator gets deterministic. </center> </td> </tr>
59  * </table>
60  * </td> </tr>
61  * </table>
62  *
63  * @ingroup MultitaskingPlugin
64  */
65 extern FAUDES_API void mtcDeterministic(const MtcSystem& rGen, MtcSystem& rResGen);
66 
67 /**
68  * Make generator deterministic. (function wrapper)
69  *
70  * The second parameter is an empty std::map<Idx,StateSet> which holds all
71  * the pairs of new states and their respective power states set. This
72  * is used as a so called "entry state map" for deterministic projected
73  * generators.
74  *
75  * @param rGen
76  * Reference to generator
77  * @param rEntryStatesMap
78  * Entry state map
79  * @param rResGen
80  * Reference to resulting deterministic generator
81  */
82 extern FAUDES_API void mtcDeterministic(const MtcSystem& rGen, std::map<Idx,StateSet>& rEntryStatesMap,
83  MtcSystem& rResGen);
84 
85 /**
86  * Make generator deterministic. (real function)
87  *
88  * Second and third parameter hold the subsets + deterministic states
89  * in vectors
90  *
91  * The multiway merge algorithm is based on a propsal in
92  * "Ted Leslie, Efficient Approaches to Subset Construction,
93  * Computer Science, University of Waterloo, 1995"
94  *
95  * @param rGen
96  * Reference to generator
97  * @param rPowerStates
98  * Vector that holds the power states
99  * @param rDetStates
100  * Vector that holds the corresponding deterministic states
101  * @param rResGen
102  * Reference to resulting deterministic generator
103  */
104 extern FAUDES_API void mtcDeterministic(const MtcSystem& rGen, std::vector<StateSet>& rPowerStates,
105  std::vector<Idx>& rDetStates, MtcSystem& rResGen);
106 
107 /**
108  * Project generator to alphabet rProjectAlphabet
109  *
110  * @param rGen
111  * Reference to generator
112  * @param rProjectAlphabet
113  * Projection alphabet
114  *
115  * @ingroup MultitaskingPlugin
116  */
117 extern FAUDES_API void mtcProjectNonDet(MtcSystem& rGen, const EventSet& rProjectAlphabet);
118 
119 /**
120  * Project generator to alphabet rProjectAlphabet
121  *
122  * @param rGen
123  * Reference to generator
124  * @param rProjectAlphabet
125  * Projection alphabet
126  * @param rResGen
127  * Reference to result
128  *
129  * @ingroup MultitaskingPlugin
130  */
131 extern FAUDES_API void mtcProjectNonDet(const MtcSystem& rGen, const EventSet& rProjectAlphabet, MtcSystem& rResGen);
132 
133 /**
134  * Minimized Deterministic projection. This function does not modify the MtcSystem. It calls project, determine and statemin.
135  *
136  * @param rGen
137  * Reference to generator
138  * @param rProjectAlphabet
139  * Projection alphabet
140  * @param rResGen
141  * Reference to resulting deterministic generator
142  *
143  * <h4>Example: Projection of an MtcSystem to a specified alphabet </h4>
144  * <table border=0> <tr> <td>
145  * <table width=100%>
146  * <tr> <td> <center> Original MtcSystem gen</center> </td> </tr>
147  * <tr> <td> @image html tmp_mtc_functions_3a_system.png </td> </tr>
148  * <tr> <td> <center> The projection alphabet contains the events {a, b, d}. </center> </td> </tr>
149  * </table>
150  * </td> </tr>
151  * <tr> <td>
152  * <table width=100%>
153  * <tr> <td> <center> Result of the projection </center> </td> </tr>
154  * <tr> <td> @image html tmp_mtc_functions_3b_projected.png </td> </tr>
155  * <tr> <td> <center> The resulting MtcSystem contains all events that appear in the oringinal MtcSystem and in the specified alphabet. Moreover, the resulting MtcSystem is deterministic. </center> </td> </tr>
156  * </table>
157  * </td> </tr>
158  * </table>
159  *
160  * @ingroup MultitaskingPlugin
161  */
162 extern FAUDES_API void mtcProject(const MtcSystem& rGen, const EventSet& rProjectAlphabet, MtcSystem& rResGen);
163 
164 /**
165  * Minimized Deterministic projection. Does not modify generator.
166  * Calls project, determine and statemin. See functions for details.
167  *
168  * @param rGen
169  * Reference to generator
170  * @param rProjectAlphabet
171  * Projection alphabet
172  * @param rEntryStatesMap
173  * Reference to entry states map, see Deterministic(..) (result)
174  * @param rResGen
175  * Reference to resulting deterministic generator (result)
176  */
177 extern FAUDES_API void mtcProject(const MtcSystem& rGen, const EventSet& rProjectAlphabet,
178  std::map<Idx,StateSet>& rEntryStatesMap, MtcSystem& rResGen);
179 
180 /**
181  * Inverse projection. This adds selfloop transition at every state for
182  * all missing events.
183  *
184  * @param rGen
185  * Reference to generator
186  * @param rProjectAlphabet
187  * Alphabet for inverse projection
188  *
189  * <h4>Example: Inverse projection of an MtcSystem for a specified alphabet which is larger than the MtcSystem's one. </h4>
190  * <table border=0> <tr> <td>
191  * <table width=100%>
192  * <tr> <td> <center> Original MtcSystem </center> </td> </tr>
193  * <tr> <td> @image html tmp_mtc_functions_5_spec.png </td> </tr>
194  * <tr> <td> <center> The projection alphabet contains the events {a, b, c}. </center> </td> </tr>
195  * </table>
196  * </td> </tr>
197  * <tr> <td>
198  * <table width=100%>
199  * <tr> <td> <center> Result of the projection </center> </td> </tr>
200  * <tr> <td> @image html tmp_mtc_functions_5_spec_invpro.png </td> </tr>
201  * <tr> <td> <center> Events, that are not part of the MtcSystem's alphabet are inserted as self-loops into every state. </center> </td> </tr>
202  * </table>
203  * </td> </tr>
204  * </table>
205  *
206  * @ingroup MultitaskingPlugin
207  */
208 extern FAUDES_API void mtcInvProject(MtcSystem& rGen, const EventSet& rProjectAlphabet);
209 
210 /**
211  * RTI wrapper. See mtcInvProject(MtcSystem&, const EventSet&).
212  */
213 extern FAUDES_API void mtcInvProject(const MtcSystem& rGen, const EventSet& rProjectAlphabet, MtcSystem& rResGen);
214 
215 } // namespace faudes
216 
217 #endif
#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 mtcProject(const MtcSystem &rGen, const EventSet &rProjectAlphabet, MtcSystem &rResGen)
Minimized Deterministic projection.
void mtcInvProject(MtcSystem &rGen, const EventSet &rProjectAlphabet)
Inverse projection.
void mtcProjectNonDet(MtcSystem &rGen, const EventSet &rProjectAlphabet)
Project generator to alphabet rProjectAlphabet.
void mtcDeterministic(const MtcSystem &rGen, MtcSystem &rResGen)
Make generator deterministic.
Definition: mtc_project.cpp:73
Methods for handling multitasking generators.
State space minimization.
libFAUDES resides within the namespace faudes.
TmtcGenerator< AttributeVoid, AttributeColoredState, AttributeCFlags, AttributeVoid > MtcSystem

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