syn_supnorm.h

Go to the documentation of this file.
00001 /** @file syn_supnorm.h Supremal normal sublanguage */
00002 
00003 /* FAU Discrete Event Systems Library (libfaudes)
00004 
00005    Copyright (C) 2009  Sebastian Perk, Thomas Moor
00006 
00007    This library is free software; you can redistribute it and/or
00008    modify it under the terms of the GNU Lesser General Public
00009    License as published by the Free Software Foundation; either
00010    version 2.1 of the License, or (at your option) any later version.
00011 
00012    This library is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015    Lesser General Public License for more details.
00016 
00017    You should have received a copy of the GNU Lesser General Public
00018    License along with this library; if not, write to the Free Software
00019    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
00020 
00021  
00022 #ifndef FAUDES_SUPNORM_H
00023 #define FAUDES_SUPNORM_H
00024 
00025 #include "corefaudes.h"
00026 #include <stack>
00027 
00028 namespace faudes {
00029 
00030 /**
00031  * ConcatenateFullLanguage: concatenate Sigma* to language
00032  * marked by rGen. Less expensive than using
00033  * LanguageConcatenate() to concatenate Sigma*, as no
00034  * additional nondeterminism is caused.
00035  * Used in SupNorm().
00036  * Method:
00037  * Transitions starting from marked states are erased.
00038  * Remaining accessible marked states are provided with
00039  * Sigma-selfloops.
00040  * Determinism:
00041  * Result can only become nondeterministic when a parameter is
00042  * nondeterministic.
00043  *
00044  * @param rGen
00045  *   generator marking the language to be concatenated with Sigma*
00046  * 
00047  *
00048  */
00049 void ConcatenateFullLanguage(Generator& rGen);
00050 
00051 /**
00052  * NormalityConsistencyCheck: Consistency
00053  * check for normality input data. Used e.g. in IsNormal(),
00054  * and SupNorm(). See exceptions.
00055  *
00056  * @param rL
00057  *   generator of language L
00058  * @param rOAlph
00059  *   observable alphabet
00060  * @param rK
00061  *   generator of language K
00062  *
00063  * @exception Exception
00064  *   - nondeterministic parameter(s) (id: 101)
00065  *   - rOAlph not subset of rL.Alphabet() (id: 100)
00066  *   - Alphabets of generators don't match (id: 100)
00067  *   - K is not subset of L (id 0)
00068  * 
00069  *
00070  */
00071 void NormalityConsistencyCheck(
00072   const Generator& rL,
00073   const EventSet& rOAlph,
00074   const Generator& rK);
00075 
00076 /**
00077  * IsNormal: checks normality of a language K generated by
00078  * rK wrt a language L generated by rL and the subset of
00079  * observable events rOAlph. This is done by checking if the
00080  * following equality holds:
00081  *
00082  * pinv(p(K)) intersect L \subseteq K
00083  * 
00084  * Thus, we assume K \subseteq L for a sufficient and necessary test.
00085  *
00086  * Todos: 
00087  * check for efficient algorithm replacing above
00088  * formula that returns false immediately after having
00089  * found a non-normal string -> IsNormalFast();
00090  * implement test routines, verify correctness;
00091  * compare performance with IsNormalAlt
00092  *
00093  * @param rL
00094  *   generator of language L
00095  * @param rOAlph
00096  *   observable alphabet
00097  * @param rK
00098  *   generator of language K
00099  * 
00100  * @return
00101  *   true if K is normal w.r.t. L and OAlph
00102  *
00103  * @exception Exception
00104  *   - thrown by NormalityConsistencyCheck()
00105  * 
00106  * @ingroup SynthesisPlugIn
00107  *
00108  */
00109 bool IsNormal(
00110   const Generator& rL,
00111   const EventSet& rOAlph,
00112   const Generator& rK);
00113 
00114 /** 
00115  * IsNormal wrapper.  
00116  * Wrapper for convenient access via the run-time interface.
00117  */
00118 bool IsNormal(const System& rPlantGen, const Generator& rSupCandGen);
00119 
00120 
00121 /**
00122  * SupNorm: compute supremal normal sublanguage.
00123  *
00124  * SupNorm calculates the supremal sublanguage
00125  * of the closed language K (generated by rK)
00126  * that is normal w.r.t. the closed language L
00127  * (generated by rL) and the set
00128  * of observable events.
00129  *
00130  * Method: The supremal normal sublanguage is computed
00131  * according to the Lin-Brandt-Formula:
00132  * supnorm(K)wrt(L)=K-Pinv[P(L-K)]
00133  *
00134  * SupNorm returns false on empty result.
00135  *
00136  * Parameters have to be deterministic, result is deterministic.
00137  *
00138  *
00139  * @param rL
00140  *   generates the closed language L=L(rL)
00141  * @param rOAlph
00142  *   observable alphabet
00143  * @param rK
00144  *   generates the closed language K=L(rK)
00145  * @param rResult
00146  *   marks the supremal normal
00147  *   sublanguage (not necessaryly prefix closed)
00148  * 
00149  * @return
00150  *   true for nonempty result
00151  *
00152  * @exception Exception
00153  *   - Alphabets of generators don't match (id 500)
00154  *   - rOAlph not subset of rL.Alphabet() (id 506)
00155  *   - K is not subset of L. (id 0)
00156  *
00157  * @ingroup SynthesisPlugIn
00158  * 
00159  *
00160  */
00161 bool SupNorm(
00162   const Generator& rL,
00163   const EventSet& rOAlph,
00164   const Generator& rK, 
00165   Generator& rResult);
00166 
00167 
00168 /**
00169  * SupNormClosed - compute supremal normal and closed
00170  * sublanguage. 
00171  *
00172  * SupNormClosed calculates the supremal sublanguage
00173  * of the closed language K (generated by rK)
00174  * that is closed  and normal w.r.t. the closed language
00175  * L (generated by rL) and the set
00176  * of observable events.
00177  *
00178  * Method: The supremal normal sublanguage is computed
00179  * according to the Lin-Brandt-Formula:
00180  * supnormclosed(K)wrt(L)=K-Pinv[P(L-K)]Sigma*
00181  *
00182  * Parameters have to be deterministic, result is deterministic.
00183  *
00184  *
00185  * @param rL
00186  *   generates the closed language L=L(rL)
00187  * @param rOAlph
00188  *   observable alphabet
00189  * @param rK
00190  *   generates the closed language K=L(rK)
00191  * @param rResult
00192  *   marks and generates the supremal normal and closed
00193  *   sublanguage
00194  * 
00195  * @return
00196  *   true for nonempty result
00197  *
00198  * @exception Exception
00199  *   - Alphabets of generators don't match (id 500)
00200  *   - rOAlph not subset of rL.Alphabet() (id 506)
00201  *   - K is not subset of L. (id 0)
00202  *
00203  * @ingroup SynthesisPlugIn
00204  * 
00205  *
00206  */
00207 bool SupNormClosed(
00208   const Generator& rL,
00209   const EventSet& rOAlph,
00210   const Generator& rK, 
00211   Generator& rResult);
00212 
00213 
00214 /**
00215  * SupConNormClosed: compute supremal controllable, normal and closed
00216  * sublanguage.
00217  *
00218  * SupConNormClosed computes the supremal sublanguage
00219  * of language K (generated by rK) that is
00220  * - controllable w.r.t. the language L (generated by rL);
00221  * - normal w.r.t. the language L; and 
00222  * - prefix closed.
00223  *
00224  * The implementation is based on results by Brandt et al 
00225  * "Formulas for calculation supremal and normal sublanguages", 
00226  * Thm 4, System and Control Letters, 1990.
00227  *
00228  * Parameters have to be deterministic, result is deterministic.
00229  *
00230  *
00231  * @param rL
00232  *   generates the closed language L=L(rL)
00233  * @param rCAlph
00234  *   controllable alphabet
00235  * @param rOAlph
00236  *   observable alphabet
00237  * @param rK
00238  *   generates the closed language K=L(rK)
00239  * @param rResult
00240  *   marks and generates the supremal contr, normal and closed
00241  *   sublanguage 
00242  * 
00243  *
00244  * @exception Exception
00245  *   - Alphabets of generators don't match (id 500)
00246  *   - rCAlph not subset of rL.Alphabet() (id 506)
00247  *   - rOAlph not subset of rL.Alphabet() (id 506)
00248  *   - K is not subset of L. (id 0)
00249  *
00250  * @ingroup SynthesisPlugIn
00251  * 
00252  *
00253  */
00254 void SupConNormClosed(
00255   const Generator& rL,
00256   const EventSet& rCAlph,
00257   const EventSet& rOAlph,
00258   const Generator& rK, 
00259   Generator& rResult);
00260 
00261 
00262 /**
00263  * Supremal Normal Controllable Sublangauge (internal function)
00264  *
00265  * Indentifies and deletes conflicting transitions to obtain a controllable and
00266  * prefix-normal sublanguage. This function is a bit experimental it depends on various 
00267  * unverified preconditions and conjectures -- use only after careful code-review. 
00268  * The completely independent implementation SupNormConClosed should be fine
00269  * 
00270  * Conditions
00271  * - controllabel events as specified explicitly must be a subset of the observable events
00272  * - L(H) <= L(G) 
00273  * - stateset of H must be sufficiently rich to discriminate states in G (e.g. initialise by H:=H' x G) 
00274  * - H_obs must be "a" observer automaton for H w.r.t. observable events (e.g. initialize with p_inv p H)
00275  *
00276  * @param rPlantGen
00277  *   Plant generator G
00278  * @param rCAlph
00279  *   Controllable events
00280  * @param rOAlph
00281  *   Observable events
00282  * @param rObserverGen
00283  *   Observer H_obs
00284  * @param rSupCandGen
00285  *   Closed-loop candidate H
00286  *
00287  *
00288  */
00289 void SupConNormClosedUnchecked(
00290    const Generator& rPlantGen, 
00291    const EventSet&  rCAlph,
00292    const EventSet&  rOAlph,
00293    Generator& rObserverGen,     
00294    Generator& rSupCandGen);
00295 
00296 
00297 /**
00298  * SupConNormNB: compute supremal controllable and normal sublanguage
00299  *
00300  * SupConNormNB computes the supremal sublanguage
00301  * of language K (marked by rK) that 
00302  * - is controllable w.r.t. the language L (marked by rL);
00303  * - has a prefix closure that is normal w.r.t. the closure of L
00304  *
00305  * The implementation is based on results by Yoo, Lafortune and Lin 
00306  * "A uniform approach for computing supremal sublanguages arising 
00307  * in supervisory control theory", 2002.
00308  *
00309  * Parameters have to be deterministic, result is deterministic.
00310  *
00311  *
00312  * @param rL
00313  *   generates the closed language L=L(rL)
00314  * @param rCAlph
00315  *   controllable alphabet
00316  * @param rOAlph
00317  *   observable alphabet
00318  * @param rK
00319  *   generates the closed language K=L(rK)
00320  * @param rResult
00321  *   marks the supremal normal and controllable
00322  *   sublanguage
00323  * 
00324  *
00325  * @exception Exception
00326  *   - Alphabets of generators don't match (id 500)
00327  *   - rCAlph not subset of rL.Alphabet() (id 506)
00328  *   - rOAlph not subset of rL.Alphabet() (id 506)
00329  *   - K is not subset of L. (id 0)
00330  *
00331  * @ingroup SynthesisPlugIn
00332  * 
00333  *
00334  */
00335 void SupConNormNB(
00336   const Generator& rL,
00337   const EventSet& rCAlph,
00338   const EventSet& rOAlph,
00339   const Generator& rK, 
00340   Generator& rResult);
00341 
00342 
00343 /**
00344  * SupPrefixClosed: supremal closed sublanguage of K by cancelling
00345  * all tranistions leading to a non-marked state.
00346  * Returns false on empty result.
00347  * todo: implement test routines, verify correctness
00348  *
00349  * @param rK
00350  *   marks the (not necessarily closed) language K=Lm(rK)
00351  * @param rResult
00352  *   generates and marks the supremal closed sublanguage,
00353  *   where L(rResult)=Lm(rResult)
00354  * 
00355  * @return
00356  *   true for nonempty result
00357  *
00358  * @exception Exception
00359  *   - todo: check determinism of rK
00360  * 
00361  *
00362  */
00363 bool SupPrefixClosed(
00364   const Generator& rK,
00365   Generator& rResult);
00366 
00367 
00368 /** rti wrapper */
00369 void SupNorm(
00370   const System& rPlantGen, 
00371   const Generator& rSpecGen, 
00372   Generator& rResGen);
00373 
00374 
00375 /** rti wrapper */
00376 void SupNormClosed(
00377   const System& rPlantGen, 
00378   const Generator& rSpecGen, 
00379   Generator& rResGen);
00380 
00381 /** rti wrapper */
00382 void SupConNormClosed(
00383   const System& rPlantGen, 
00384   const Generator& rSpecGen, 
00385   Generator& rResGen);
00386 
00387 /** rti wrapper */
00388 void SupConNormNB(
00389   const System& rPlantGen, 
00390   const Generator& rSpecGen, 
00391   Generator& rResGen);
00392 
00393 
00394 } // end namespace
00395 #endif

libFAUDES 2.23h --- 2014.04.03 --- c++ api documentaion by doxygen