cfl_determin.h
Go to the documentation of this file.
1 /** @file cfl_determin.h powersetset construction */
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_DETERMIN_H
24 
25 #include "cfl_definitions.h"
26 #include "cfl_agenerator.h"
27 
28 namespace faudes {
29 
30 
31 /**
32  * Make initial states unique.
33  * If the argument generator has precisely one initial state, this function does nothing.
34  * Else, this function introduces a new and unique initial state and relinks transitions
35  * accordinly. If the argument generator used to have more than one initial state, this operation
36  * may render the output nondeterministic. If the argument generator used to have no
37  * initial state, the output generator will generate the empty string language as opposed to
38  * the empty language. Otherwise, generated and marked languages are preserved.
39  *
40  * Note: call this function followed by determine to convert the generator to a
41  * deterministic generator with exactly one initial state.
42  *
43  *
44  * @param rGen
45  * Reference to generator
46  *
47  * @ingroup GeneratorFunctions
48  */
49 void UniqueInit(Generator& rGen);
50 
51 /**
52  * Make initial states unique.
53  *
54  * Convenience wrapper for UniqueInit(Generator&).
55  *
56  *
57  * @param rGen
58  * Reference to generator
59  * @param rResGen
60  * Reference to resulting generator
61  *
62  * @ingroup GeneratorFunctions
63  */
64 void UniqueInit(const Generator& rGen, Generator& rResGen);
65 
66 
67 /**
68  * Make generator deterministic.
69  * Constructs a deterministic generator while preserving the generated and marked languages.
70  * The implementation is based on the so called multiway merge variant of subset construction,
71  * in which the new state set becomes a subset of the power set og the given state set. It is of
72  * exponential complexity. For details on the multiway merge algorithm see
73  * "Ted Leslie, Efficient Approaches to Subset Construction,
74  * Computer Science, University of Waterloo, 1995".
75  *
76  * See also
77  * Deterministic(const Generator&,std::map<Idx,StateSet>&,Generator& rResGen) and
78  * Deterministic(const Generator&,std::vector<StateSet>&,std::vector<Idx>&,Generator& rResGen).
79  *
80  * Technical detail: if the input has no initial state, then so has the output.
81  *
82  * @param rGen
83  * Reference to generator
84  * @param rResGen
85  * Reference to resulting deterministic generator
86  *
87  * <h4>Example:</h4>
88  * <table>
89  * <tr> <td> Generator G </td> <td> Deterministic(G,Result) </td> </tr>
90  * <tr>
91  * <td> @image html tmp_deterministic_nondet.png </td>
92  * <td> @image html tmp_deterministic_det.png </td>
93  * </tr>
94  * </table>
95  *
96  * @ingroup GeneratorFunctions
97  */
98 void Deterministic(const Generator& rGen, Generator& rResGen);
99 
100 /**
101  * Make generator deterministic.
102  *
103  * See also Deterministic(const Generator&, Generator&).
104  * This version maintains event attributes provided they can be castes
105  * to the result type.
106  *
107  * @param rGen
108  * Reference to generator
109  * @param rResGen
110  * Reference to resulting deterministic generator
111  *
112  * @ingroup GeneratorFunctions
113  */
114 void aDeterministic(const Generator& rGen, Generator& rResGen);
115 
116 /**
117  * Make generator deterministic.
118  *
119  * Constructs a deterministic generator while preserving the generated and marked languages.
120  * See Deterministic(const Generator&,Generator& rResGen) for the intended
121  * api. This version provides as a second parameter the resulting map from new states to
122  * their respective original state set. It is used as a so called "entry state map"
123  * for deterministic projected generators.
124  *
125  * @param rGen
126  * Reference to generator
127  * @param rEntryStatesMap
128  * Entry state map
129  * @param rResGen
130  * Reference to resulting deterministic generator
131  */
132 void Deterministic(const Generator& rGen, std::map<Idx,StateSet>& rEntryStatesMap,
133  Generator& rResGen);
134 
135 /**
136  * Make generator deterministic.
137  *
138  * Constructs a deterministic generator while preserving the generated and marked languages.
139  * See Deterministic(const Generator&,Generator& rResGen) for the intended api.
140  * This version provides as second and third parameters the correspondence
141  * between new states and the original state sets.
142  * in vectors
143  *
144  * @param rGen
145  * Reference to generator
146  * @param rPowerStates
147  * Vector that holds the power states
148  * @param rDetStates
149  * Vector that holds the corresponding deterministic states
150  * @param rResGen
151  * Reference to resulting deterministic generator
152  */
153 void Deterministic(const Generator& rGen, std::vector<StateSet>& rPowerStates,
154  std::vector<Idx>& rDetStates, Generator& rResGen);
155 
156 
157 
158 } // namespace faudes
159 
160 #define FAUDES_DETERMIN_H
161 #endif
162 

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