cfl_project.h
Go to the documentation of this file.
1 /** @file cfl_project.h language projection */
2 
3 /* FAU Discrete Event Systems Library (libfaudes)
4 
5  Copyright (C) 2006 Bernd Opitz
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_PROJECT_H
24 
25 #include "cfl_definitions.h"
26 #include "cfl_agenerator.h"
27 
28 namespace faudes {
29 
30 
31 /**
32  * Language projection.
33  *
34  * Projects the generated and marked languages to another alphabet.
35  * Transitions with events not in the projection alphabet are considered
36  * invisible and therefor acordingly relinked with a visible lable to the appropriate
37  * successor state. The projection alphabet is intended (but not required) to be
38  * a subset of the original alphabet.
39  *
40  * The default implementation is based on a local forward reachability analysis per state.
41  * It known to suffer from performance issues for certain large automata. This was
42  * in particular the case for the variation used in libFAUDES 2.14 up to 2.23. A number of
43  * alternatives are now available in "cfl_project.cpp" and can bet set as the default by adjusting
44  * the respective wrapper function (grep for "wrapper" in "cfl_project.cpp"). If you experience
45  * trouble with the current revision, you can set the default to revert to pre libFAUDES 2.24 behaviour --
46  * and please report back to us. The candidate for future releases is available for testing,
47  * see ProjectNonDetScc(Generator&, const EventSet&).
48  *
49  * The results in general is nondeterministic. The input generator does not need to
50  * be deterministic. See Project(const Generator&,const EventSet&, Generator&) for
51  * a version with deterministic result.
52  *
53  *
54  * @param rGen
55  * Reference to generator
56  * @param rProjectAlphabet
57  * Projection alphabet
58  *
59  * @ingroup GeneratorFunctions
60  */
61 void ProjectNonDet(Generator& rGen, const EventSet& rProjectAlphabet);
62 
63 
64 
65 /**
66  * Language projection.
67  *
68  * Projects the generated and marked languages to another alphabet, see
69  * also ProjectNonDetScc(Generator&, const EventSet&). This implementation
70  * first eliminates silent strongly connected components and then applies a
71  * local backward reachability analysis. Performance benefits are significant for
72  * certain large generators.
73  *
74  * The input generator does not need to be deterministic. The results in general
75  * is nondeterministic. You may manually invoke Deterministic() to convert the result.
76  *
77  *
78  * @param rGen
79  * Reference to generator
80  * @param rProjectAlphabet
81  * Projection alphabet
82  *
83  * @ingroup GeneratorFunctions
84  */
85 void ProjectNonDetScc(Generator& rGen, const EventSet& rProjectAlphabet);
86 
87 /**
88  * Deterministic projection.
89  *
90  * Projects the generated and marked languages to a subalphabet of the original alphabet,
91  * and subsequently calls Deterministic to construct a deterministic
92  * realisation of the result. The input generator does not need to be deterministic.
93  *
94  * @param rGen
95  * Reference to generator
96  * @param rProjectAlphabet
97  * Projection alphabet
98  * @param rResGen
99  * Reference to resulting deterministic generator
100  *
101  * <h4>Example:</h4>
102  * <table>
103  * <tr> <td> Generator G </td> <td> Project(G,(a,c,g,e),Result) </td> </tr>
104  * <tr>
105  * <td> @image html tmp_project_g.png </td>
106  * <td> @image html tmp_project_prog.png </td>
107  * </tr>
108  * </table>
109  *
110  * @ingroup GeneratorFunctions
111  */
112 void Project(const Generator& rGen, const EventSet& rProjectAlphabet, Generator& rResGen);
113 
114 /**
115  * Deterministic projection.
116  *
117  * See also Project(const Generator&, const EventSet&, Generator&).
118  * This version tries to be transparent on event attributes: if
119  * argument attributes match and if the result can take the respective
120  * attributes, then they are copied; it is considered an error if
121  * argument attributes do not match.
122  *
123  * @param rGen
124  * Reference to generator
125  * @param rProjectAlphabet
126  * Projection alphabet
127  * @param rResGen
128  * Reference to resulting deterministic generator
129  *
130  *
131  * @ingroup GeneratorFunctions
132  */
133 void aProject(const Generator& rGen, const EventSet& rProjectAlphabet, Generator& rResGen);
134 
135 /**
136  * Language projection.
137  *
138  * See also ProjectNonDet(const Generator&, const EventSet&).
139  * This version tries to be transparent on event attributes: result maintains
140  * its attributes.
141  *
142  * @param rGen
143  * Reference to generator
144  * @param rProjectAlphabet
145  * Projection alphabet
146  *
147  * @ingroup GeneratorFunctions
148  */
149 void aProjectNonDet(Generator& rGen, const EventSet& rProjectAlphabet);
150 
151 
152 /**
153  * Deterministic projection.
154  *
155  * Projects the generated and marked languages to a subalphabet of the original alphabet,
156  * and subsequently calls Deterministic to construct a deterministic minimal
157  * realisation of the result. The input generator does not need to be deterministic.
158  *
159  * @param rGen
160  * Reference to generator
161  * @param rProjectAlphabet
162  * Projection alphabet
163  * @param rEntryStatesMap
164  * Reference to entry states map, see Deterministic(..) (result)
165  * @param rResGen
166  * Reference to resulting deterministic generator (result)
167  */
168 void Project(const Generator& rGen, const EventSet& rProjectAlphabet,
169  std::map<Idx,StateSet>& rEntryStatesMap, Generator& rResGen);
170 
171 /**
172  * Inverse projection. This adds selfloop transition at every state for
173  * all missing events.
174  *
175  * @param rGen
176  * Reference to generator
177  * @param rProjectAlphabet
178  * Alphabet for inverse projection
179  *
180  * @ingroup GeneratorFunctions
181  */
182 void InvProject(Generator& rGen, const EventSet& rProjectAlphabet);
183 
184 /**
185  * Inverse projection. This adds selfloop transition at every state for
186  * all missing events. This version tries to be transparent to attributes.
187  *
188  * @param rGen
189  * Reference to generator
190  * @param rProjectAlphabet
191  * Alphabet for inverse projection
192  *
193  * @ingroup GeneratorFunctions
194  */
195 void aInvProject(Generator& rGen, const EventSet& rProjectAlphabet);
196 
197 
198 /**
199  * Inverse projection. This adds selfloop transition at every state for
200  * all missing events. This version tries to be transparent to attributes.
201  *
202  * @param rGen
203  * Reference to argumant generator
204  * @param rProjectAlphabet
205  * Alphabet for inverse projection
206  * @param rResGen
207  * Alphabet to result.
208  *
209  * @ingroup GeneratorFunctions
210  */
211 void aInvProject(const Generator& rGen, const EventSet& rProjectAlphabet, Generator& rResGen);
212 
213 
214 } // namespace faudes
215 
216 #define FAUDES_PROJECT_H
217 #endif
218 

libFAUDES 2.24g --- 2014.09.15 --- c++ api documentaion by doxygen