syn_supnorm.h
Go to the documentation of this file.
1 /** @file syn_supnorm.h Supremal normal sublanguage */
2 
3 /* FAU Discrete Event Systems Library (libfaudes)
4 
5  Copyright (C) 2009 Sebastian Perk, Thomas Moor
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Lesser General Public
9  License as published by the Free Software Foundation; either
10  version 2.1 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public
18  License along with this library; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
20 
21 
22 #ifndef FAUDES_SUPNORM_H
23 #define FAUDES_SUPNORM_H
24 
25 #include "corefaudes.h"
26 #include <stack>
27 
28 namespace faudes {
29 
30 /**
31  * ConcatenateFullLanguage: concatenate Sigma* to language
32  * marked by rGen. Less expensive than using
33  * LanguageConcatenate() to concatenate Sigma*, as no
34  * additional nondeterminism is caused.
35  * Used in SupNorm().
36  * Method:
37  * Transitions starting from marked states are erased.
38  * Remaining accessible marked states are provided with
39  * Sigma-selfloops.
40  * Determinism:
41  * Result can only become nondeterministic when a parameter is
42  * nondeterministic.
43  *
44  * @param rGen
45  * generator marking the language to be concatenated with Sigma*
46  *
47  *
48  */
50 
51 /**
52  * NormalityConsistencyCheck: Consistency
53  * check for normality input data. Used e.g. in IsNormal(),
54  * and SupNorm(). See exceptions.
55  *
56  * @param rL
57  * generator of language L
58  * @param rOAlph
59  * observable alphabet
60  * @param rK
61  * generator of language K
62  *
63  * @exception Exception
64  * - nondeterministic parameter(s) (id: 101)
65  * - rOAlph not subset of rL.Alphabet() (id: 100)
66  * - Alphabets of generators don't match (id: 100)
67  * - K is not subset of L (id 0)
68  *
69  *
70  */
72  const Generator& rL,
73  const EventSet& rOAlph,
74  const Generator& rK);
75 
76 /**
77  * IsNormal: checks normality of a language K generated by
78  * rK wrt a language L generated by rL and the subset of
79  * observable events rOAlph. This is done by checking if the
80  * following equality holds:
81  *
82  * pinv(p(K)) intersect L \\subseteq K
83  *
84  * Thus, we assume K \\subseteq L for a sufficient and necessary test.
85  *
86  * Todos:
87  * check for efficient algorithm replacing above
88  * formula that returns false immediately after having
89  * found a non-normal string -> IsNormalFast();
90  * implement test routines, verify correctness;
91  * compare performance with IsNormalAlt
92  *
93  * @param rL
94  * generator of language L
95  * @param rOAlph
96  * observable alphabet
97  * @param rK
98  * generator of language K
99  *
100  * @return
101  * true if K is normal w.r.t. L and OAlph
102  *
103  * @exception Exception
104  * - thrown by NormalityConsistencyCheck()
105  *
106  * @ingroup SynthesisPlugIn
107  *
108  */
109 extern FAUDES_API bool IsNormal(
110  const Generator& rL,
111  const EventSet& rOAlph,
112  const Generator& rK);
113 
114 /**
115  * IsNormal wrapper.
116  * Wrapper for convenient access via the run-time interface.
117  */
118 extern FAUDES_API bool IsNormal(const System& rPlantGen, const Generator& rSupCandGen);
119 
120 
121 /**
122  * SupNorm: compute supremal normal sublanguage.
123  *
124  * SupNorm calculates the supremal sublanguage
125  * of the closed language K (generated by rK)
126  * that is normal w.r.t. the closed language L
127  * (generated by rL) and the set
128  * of observable events.
129  *
130  * Method: The supremal normal sublanguage is computed
131  * according to the Lin-Brandt-Formula:
132  * supnorm(K)wrt(L)=K-Pinv[P(L-K)]
133  *
134  * SupNorm returns false on empty result.
135  *
136  * Parameters have to be deterministic, result is deterministic.
137  *
138  *
139  * @param rL
140  * generates the closed language L=L(rL)
141  * @param rOAlph
142  * observable alphabet
143  * @param rK
144  * generates the closed language K=L(rK)
145  * @param rResult
146  * marks the supremal normal
147  * sublanguage (not necessaryly prefix closed)
148  *
149  * @return
150  * true for nonempty result
151  *
152  * @exception Exception
153  * - Alphabets of generators don't match (id 500)
154  * - rOAlph not subset of rL.Alphabet() (id 506)
155  * - K is not subset of L. (id 0)
156  *
157  * @ingroup SynthesisPlugIn
158  *
159  *
160  */
161 extern FAUDES_API bool SupNorm(
162  const Generator& rL,
163  const EventSet& rOAlph,
164  const Generator& rK,
165  Generator& rResult);
166 
167 
168 /**
169  * SupNormClosed - compute supremal normal and closed
170  * sublanguage.
171  *
172  * SupNormClosed calculates the supremal sublanguage
173  * of the closed language K (generated by rK)
174  * that is closed and normal w.r.t. the closed language
175  * L (generated by rL) and the set
176  * of observable events.
177  *
178  * Method: The supremal normal sublanguage is computed
179  * according to the Lin-Brandt-Formula:
180  * supnormclosed(K)wrt(L)=K-Pinv[P(L-K)]Sigma*
181  *
182  * Parameters have to be deterministic, result is deterministic.
183  *
184  *
185  * @param rL
186  * generates the closed language L=L(rL)
187  * @param rOAlph
188  * observable alphabet
189  * @param rK
190  * generates the closed language K=L(rK)
191  * @param rResult
192  * marks and generates the supremal normal and closed
193  * sublanguage
194  *
195  * @return
196  * true for nonempty result
197  *
198  * @exception Exception
199  * - Alphabets of generators don't match (id 500)
200  * - rOAlph not subset of rL.Alphabet() (id 506)
201  * - K is not subset of L. (id 0)
202  *
203  * @ingroup SynthesisPlugIn
204  *
205  *
206  */
207 extern FAUDES_API bool SupNormClosed(
208  const Generator& rL,
209  const EventSet& rOAlph,
210  const Generator& rK,
211  Generator& rResult);
212 
213 
214 /**
215  * SupConNormClosed: compute supremal controllable, normal and closed
216  * sublanguage.
217  *
218  * SupConNormClosed computes the supremal sublanguage
219  * of language K (generated by rK) that is
220  * - controllable w.r.t. the language L (generated by rL);
221  * - normal w.r.t. the language L; and
222  * - prefix closed.
223  *
224  * The implementation is based on results by Brandt et al
225  * "Formulas for calculation supremal and normal sublanguages",
226  * Thm 4, System and Control Letters, 1990.
227  *
228  * Parameters have to be deterministic, result is deterministic.
229  *
230  *
231  * @param rL
232  * generates the closed language L=L(rL)
233  * @param rCAlph
234  * controllable alphabet
235  * @param rOAlph
236  * observable alphabet
237  * @param rK
238  * generates the closed language K=L(rK)
239  * @param rResult
240  * marks and generates the supremal contr, normal and closed
241  * sublanguage
242  *
243  *
244  * @exception Exception
245  * - Alphabets of generators don't match (id 500)
246  * - rCAlph not subset of rL.Alphabet() (id 506)
247  * - rOAlph not subset of rL.Alphabet() (id 506)
248  * - K is not subset of L. (id 0)
249  *
250  * @ingroup SynthesisPlugIn
251  *
252  *
253  */
254 extern FAUDES_API void SupConNormClosed(
255  const Generator& rL,
256  const EventSet& rCAlph,
257  const EventSet& rOAlph,
258  const Generator& rK,
259  Generator& rResult);
260 
261 
262 /**
263  * Supremal Normal Controllable Sublangauge (internal function)
264  *
265  * Indentifies and deletes conflicting transitions to obtain a controllable and
266  * prefix-normal sublanguage. This function is a bit experimental it depends on various
267  * unverified preconditions and conjectures -- use only after careful code-review.
268  * The completely independent implementation SupNormConClosed should be fine
269  *
270  * Conditions
271  * - controllabel events as specified explicitly must be a subset of the observable events
272  * - L(H) <= L(G)
273  * - stateset of H must be sufficiently rich to discriminate states in G (e.g. initialise by H:=H' x G)
274  * - H_obs must be "a" observer automaton for H w.r.t. observable events (e.g. initialize with p_inv p H)
275  *
276  * @param rPlantGen
277  * Plant generator G
278  * @param rCAlph
279  * Controllable events
280  * @param rOAlph
281  * Observable events
282  * @param rObserverGen
283  * Observer H_obs
284  * @param rSupCandGen
285  * Closed-loop candidate H
286  *
287  *
288  */
290  const Generator& rPlantGen,
291  const EventSet& rCAlph,
292  const EventSet& rOAlph,
293  Generator& rObserverGen,
294  Generator& rSupCandGen);
295 
296 
297 /**
298  * SupConNormNB: compute supremal controllable and normal sublanguage
299  *
300  * SupConNormNB computes the supremal sublanguage
301  * of language K (marked by rK) that
302  * - is controllable w.r.t. the language L (marked by rL);
303  * - has a prefix closure that is normal w.r.t. the closure of L
304  *
305  * The implementation is based on results by Yoo, Lafortune and Lin
306  * "A uniform approach for computing supremal sublanguages arising
307  * in supervisory control theory", 2002.
308  *
309  * Parameters have to be deterministic, result is deterministic.
310  *
311  *
312  * @param rL
313  * generates the closed language L=L(rL)
314  * @param rCAlph
315  * controllable alphabet
316  * @param rOAlph
317  * observable alphabet
318  * @param rK
319  * generates the closed language K=L(rK)
320  * @param rResult
321  * marks the supremal normal and controllable
322  * sublanguage
323  *
324  *
325  * @exception Exception
326  * - Alphabets of generators don't match (id 500)
327  * - rCAlph not subset of rL.Alphabet() (id 506)
328  * - rOAlph not subset of rL.Alphabet() (id 506)
329  * - K is not subset of L. (id 0)
330  *
331  * @ingroup SynthesisPlugIn
332  *
333  *
334  */
335 extern FAUDES_API void SupConNormNB(
336  const Generator& rL,
337  const EventSet& rCAlph,
338  const EventSet& rOAlph,
339  const Generator& rK,
340  Generator& rResult);
341 
342 
343 /**
344  * SupPrefixClosed: supremal closed sublanguage of K by cancelling
345  * all tranistions leading to a non-marked state.
346  * Returns false on empty result.
347  * todo: implement test routines, verify correctness
348  *
349  * @param rK
350  * marks the (not necessarily closed) language K=Lm(rK)
351  * @param rResult
352  * generates and marks the supremal closed sublanguage,
353  * where L(rResult)=Lm(rResult)
354  *
355  * @return
356  * true for nonempty result
357  *
358  * @exception Exception
359  * - todo: check determinism of rK
360  *
361  *
362  */
363 extern FAUDES_API bool SupPrefixClosed(
364  const Generator& rK,
365  Generator& rResult);
366 
367 
368 /** rti wrapper */
369 extern FAUDES_API void SupNorm(
370  const System& rPlantGen,
371  const Generator& rSpecGen,
372  Generator& rResGen);
373 
374 
375 /** rti wrapper */
376 extern FAUDES_API void SupNormClosed(
377  const System& rPlantGen,
378  const Generator& rSpecGen,
379  Generator& rResGen);
380 
381 /** rti wrapper */
382 extern FAUDES_API void SupConNormClosed(
383  const System& rPlantGen,
384  const Generator& rSpecGen,
385  Generator& rResGen);
386 
387 /** rti wrapper */
388 extern FAUDES_API void SupConNormNB(
389  const System& rPlantGen,
390  const Generator& rSpecGen,
391  Generator& rResGen);
392 
393 
394 } // end namespace
395 #endif
#define FAUDES_API
Interface export/import symbols: windows.
Definition: cfl_platform.h:81
Includes all libFAUDES headers, no plugins.
NameSet EventSet
Convenience typedef for plain event sets.
Definition: cfl_nameset.h:531
vGenerator Generator
Plain generator, api typedef for generator with no attributes.
TcGenerator< AttributeVoid, AttributeVoid, AttributeCFlags, AttributeVoid > System
Convenience typedef for std System.
bool SupNorm(const Generator &rL, const EventSet &rOAlph, const Generator &rK, Generator &rResult)
SupNorm: compute supremal normal sublanguage.
bool IsNormal(const Generator &rL, const EventSet &rOAlph, const Generator &rK)
IsNormal: checks normality of a language K generated by rK wrt a language L generated by rL and the s...
void SupConNormClosed(const Generator &rL, const EventSet &rCAlph, const EventSet &rOAlph, const Generator &rK, Generator &rResult)
SupConNormClosed: compute supremal controllable, normal and closed sublanguage.
void SupConNormNB(const Generator &rL, const EventSet &rCAlph, const EventSet &rOAlph, const Generator &rK, Generator &rResult)
SupConNormNB: compute supremal controllable and normal sublanguage.
bool SupNormClosed(const Generator &rL, const EventSet &rOAlph, const Generator &rK, Generator &rResult)
SupNormClosed - compute supremal normal and closed sublanguage.
libFAUDES resides within the namespace faudes.
void NormalityConsistencyCheck(const Generator &rL, const EventSet &rOAlph, const Generator &rK)
NormalityConsistencyCheck: Consistency check for normality input data.
Definition: syn_supnorm.cpp:45
void SupConNormClosedUnchecked(const Generator &rPlantGen, const EventSet &rCAlph, const EventSet &rOAlph, Generator &rObserverGen, Generator &rSupCandGen)
Supremal Normal Controllable Sublangauge (internal function)
bool SupPrefixClosed(const Generator &rK, Generator &rResult)
SupPrefixClosed: supremal closed sublanguage of K by cancelling all tranistions leading to a non-mark...
void ConcatenateFullLanguage(Generator &rGen)
ConcatenateFullLanguage: concatenate Sigma* to language marked by rGen.

libFAUDES 2.32b --- 2024.03.01 --- c++ api documentaion by doxygen