syn_supcon.h

Go to the documentation of this file.
00001 /** @file syn_supcon.h Supremal controllable sublanguage */
00002 
00003 /* FAU Discrete Event Systems Library (libfaudes)
00004 
00005    Copyright (C) 2006  Bernd Opitz
00006    Copyright (C) 2007  Thomas Moor
00007    Exclusive copyright is granted to Klaus Schmidt
00008 
00009    This library is free software; you can redistribute it and/or
00010    modify it under the terms of the GNU Lesser General Public
00011    License as published by the Free Software Foundation; either
00012    version 2.1 of the License, or (at your option) any later version.
00013 
00014    This library is distributed in the hope that it will be useful,
00015    but WITHOUT ANY WARRANTY; without even the implied warranty of
00016    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017    Lesser General Public License for more details.
00018 
00019    You should have received a copy of the GNU Lesser General Public
00020    License along with this library; if not, write to the Free Software
00021    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
00022 
00023  
00024 #ifndef FAUDES_SUPCON_H
00025 #define FAUDES_SUPCON_H
00026 
00027 #include "corefaudes.h"
00028 #include <stack>
00029 
00030 namespace faudes {
00031     
00032 
00033 
00034 /**
00035  * Test controllability
00036  *
00037  * Tests whether the candidate supervisor H is controllable w.r.t.
00038  * the plant G. This implementation does not require the supervisor H to 
00039  * represent a sublanguage of the plant G. 
00040  * 
00041  * Parameter restrictions: both generators must be deterministic and 
00042  * share the same alphabet.
00043  *
00044  *
00045  * @param rPlantGen
00046  *   Plant G
00047  * @param rCAlph
00048  *   Controllable events
00049  * @param rSupCandGen
00050  *   Supervisor candidate H
00051  *
00052  * @exception Exception
00053  *   - alphabets of generators don't match (id 100)
00054  *   - plant generator nondeterministic (id 201)
00055  *   - specification generator nondeterministic (id 203)
00056  *   - plant and Spec generator nondeterministic (id 204)
00057  *
00058  * @return 
00059  *   true / false
00060  *
00061  * @ingroup SynthesisPlugIn
00062  */
00063 bool IsControllable(const Generator& rPlantGen, const EventSet&  rCAlph, const Generator& rSupCandGen);
00064 
00065 
00066 /**
00067  * Test controllability.
00068  *
00069  * Tests whether the candidate supervisor H is controllable w.r.t.
00070  * the plant G. This implementation does not require the supervisor H to 
00071  * represent a sublanguage of the plant G. 
00072  * 
00073  *
00074  * If the candidate fails to be controllable, this version will return a set of 
00075  * "critical" states of the candidate supervisor. These states are characterised by 
00076  *  (a) being reachable in the parallel composition of plant and supervisor 
00077  *  (b) disabeling an uncontrollable transition of the plant
00078  * Note: this was reimplemented in libFAUDES 2.20b.
00079  *
00080  * Parameter restrictions: both generators must be deterministic and 
00081  * have the same alphabet.
00082  *
00083  * @param rPlantGen
00084  *   Plant G 
00085  * @param rCAlph
00086  *   Controllable events
00087  * @param rSupCandGen
00088  *   Supervisor candicate H 
00089  * @param rCriticalStates
00090  *   Set of critical states
00091  *
00092  * @exception Exception
00093  *   - alphabets of generators don't match (id 200)
00094  *   - plant generator nondeterministic (id 201)
00095  *   - specification generator nondeterministic (id 203)
00096  *   - plant and Spec generator nondeterministic (id 204)
00097  *
00098  * @return 
00099  *   true / false
00100  *
00101  * @ingroup SynthesisPlugIn
00102  */
00103 bool IsControllable(
00104   const Generator& rPlantGen, 
00105   const EventSet&  rCAlph,
00106   const Generator& rSupCandGen, 
00107   StateSet& rCriticalStates);
00108 
00109 
00110 /**
00111  * Test controllability. 
00112  *
00113  * Tests whether the candidate supervisor h is controllable w.r.t.
00114  * the plant g; this is a System wrapper for IsControllable
00115  *
00116  * @param rPlantGen
00117  *   Plant g generator
00118  * @param rSupCandGen
00119  *   Supervisor candidate h generator 
00120  *
00121  * @exception Exception
00122  *   Alphabets of generators don't match (id 500)
00123  *   Plant generator nondeterministic (id 501)
00124  *   Specification generator nondeterministic (id 503)
00125  *   Plant & Spec generator nondeterministic (id 504)
00126  *
00127  * @return 
00128  *   true / false
00129  *
00130  * @ingroup SynthesisPlugIn
00131  */
00132 bool IsControllable(
00133   const System& rPlantGen, 
00134   const Generator& rSupCandGen);
00135 
00136 
00137 /**
00138  * Nonblocking Supremal Controllable Sublanguage
00139  *
00140  * Given a generator G (argument rPlantGen) and a specification language E (marked by argument rSpecGen), 
00141  * this procedures computes an automaton S such that
00142  *  Lm(S) is the supremal controllable sublanguage of Lm(G) ^ Lm(E) w.r.t. L(G).
00143  * The result is given as a trim deterministic generator that 
00144  * may be used to supervise G in order to enforce E. 
00145  *
00146  * See "C.G CASSANDRAS AND S. LAFORTUNE. Introduction to Discrete Event 
00147  * Systems. Kluwer, 1999." for base algorithm.
00148  *
00149  * Parameter restrictions: both generators must be deterministic and 
00150  * have the same alphabet.
00151  *
00152  *
00153  * @param rPlantGen
00154  *   Plant G
00155  * @param rCAlph
00156  *   Controllable events
00157  * @param rSpecGen
00158  *   Specification Generator to mark E
00159  * @param rResGen
00160  *   Reference to resulting Generator, the
00161  *   minimal restrictive nonblocking supervisor
00162  *
00163  * @exception Exception
00164  *   - alphabets of generators don't match (id 100)
00165  *   - plant nondeterministic (id 201)
00166  *   - spec nondeterministic (id 203)
00167  *   - plant and spec nondeterministic (id 204)
00168  *
00169  * @ingroup SynthesisPlugIn
00170  *
00171  */
00172 void SupConNB(
00173   const Generator& rPlantGen, 
00174   const EventSet&  rCAlph,
00175   const Generator& rSpecGen, 
00176   Generator& rResGen);
00177 
00178 
00179 
00180 /**
00181  * Nonblocking Supremal Controllable Sublanguage 
00182  *
00183  * This is the RTI wrapper for   
00184  * SupConNB(const Generator&, const EventSet&, const Generator&, Generator&).
00185  * Controllability attributes are taken from the plant argument.
00186  * If the result is specified as a System, attributes will be copied
00187  * from the plant argument.
00188  *
00189  *
00190  * @param rPlantGen
00191  *   Plant System
00192  * @param rSpecGen
00193  *   Specification Generator
00194  * @param rResGen
00195  *   Reference to resulting Generator, the
00196  *   minimal restrictive nonblocking supervisor
00197  *
00198  * @exception Exception
00199  *   Alphabets of generators don't match (id 100)
00200  *   plant nondeterministic (id 201)
00201  *   spec nondeterministic (id 203)
00202  *   plant and spec nondeterministic (id 204)
00203  *
00204  * @ingroup SynthesisPlugIn
00205  */
00206 void SupConNB(
00207   const System& rPlantGen, 
00208   const Generator& rSpecGen, 
00209   Generator& rResGen);
00210 
00211 
00212 
00213 /**
00214  * Supremal Controllable and Closed Sublanguage
00215  *
00216  * Given a closed plant language L and a closed specification E, this function
00217  * computes a realisation of the supremal controllable and closed sublanguage
00218  * of L^E. Arguments and result generate the respective language (i.e. marked
00219  * languages are not considered.)
00220  *
00221  * Parameter restrictions: both generators must be deterministic and 
00222  * have the same alphabet.
00223  *
00224  * @param rPlantGen
00225  *   Plant L generated by rPlantGen 
00226  * @param rCAlph
00227  *   Controllable events
00228  * @param rSpecGen
00229  *   Specification E generated rSpecGen
00230  * @param rResGen
00231  *   Reference to resulting Generator, the
00232  *   minimal restrictive supervisor
00233  *
00234  * @exception Exception
00235  *   - alphabets of generators don't match (id 100)
00236  *   - plant nondeterministic (id 201)
00237  *   - spec nondeterministic (id 203)
00238  *   - plant and spec nondeterministic (id 204)
00239  *
00240  * @ingroup SynthesisPlugIn
00241  */
00242 void SupConClosed(
00243   const Generator& rPlantGen, 
00244   const EventSet&  rCAlph,
00245   const Generator& rSpecGen, 
00246   Generator& rResGen);
00247 
00248 
00249 /** 
00250  * Supremal Controllable and Closed Sublanguage.
00251  * 
00252  * This is the RTI wrapper for   
00253  * SupCon(const Generator&, const EventSet&, const Generator&, Generator&).
00254  *
00255  * Controllability attributes are taken from the plant argument.
00256  * If the result is specified as a System, attributes will be copied
00257  * from the plant argument.
00258  *
00259  * @param rPlantGen
00260  *   Plant System 
00261  * @param rSpecGen
00262  *   Specification Generator 
00263  * @param rResGen
00264  *   Reference to resulting Generator, the
00265  *   minimal restrictive supervisor
00266  *
00267  * @exception Exception
00268  *   Alphabets of generators don't match (id 100)
00269  *   plant nondeterministic (id 201)
00270  *   spec nondeterministic (id 203)
00271  *   plant and spec nondeterministic (id 204)
00272  *
00273  * @ingroup SynthesisPlugIn
00274  */
00275 void SupConClosed(
00276   const System& rPlantGen, 
00277   const Generator& rSpecGen, 
00278   Generator& rResGen);
00279 
00280 /** 
00281  * Supremal Controllable and Closed Sublanguage.
00282  * 
00283  * Implementation of  SupConClosed.
00284  *
00285  * See "C.G CASSANDRAS AND S. LAFORTUNE. Introduction to Discrete Event 
00286  * Systems. Kluwer, 1999." for base algorithm.
00287  *
00288  * This version sets up a "composition map" provided as a reference parameter.
00289  * The map is restricted such that its range matches the resulting supervisor.
00290  * 
00291  * @param rPlantGen
00292  *   Plant Generator 
00293  * @param rCAlph
00294  *   Controllable events
00295  * @param rSpecGen
00296  *   Specification Generator 
00297  * @param rReverseCompositionMap
00298  *   std::map< std::pair<Idx,Idx>, Idx> as in the parallel composition function
00299  * @param rResGen
00300  *   Reference to resulting Generator, the
00301  *   minimal restrictive supervisor
00302  *
00303  * @exception Exception
00304  *   - alphabets of generators don't match (id 100)
00305  *   - plant nondeterministic (id 201)
00306  *   - spec nondeterministic (id 203)
00307  *   - plant and spec nondeterministic (id 204)
00308  */
00309 void SupConClosed(
00310   const Generator& rPlantGen, 
00311   const EventSet&  rCAlph,
00312   const Generator& rSpecGen, 
00313   std::map< std::pair<Idx,Idx>,Idx >& rReverseCompositionMap, 
00314   Generator& rResGen);
00315 
00316 
00317 
00318 /** 
00319  * Nonblocking Supremal Controllable Sublanguage (internal function)
00320  * 
00321  * This version of SupConNB performs no consistency test of the given parameter.
00322  * It set's up a "composition map" as in the parallel composition, however,
00323  * the map may still contain states that have been removed from the result
00324  * to obtain controllability.
00325  * 
00326  * @param rPlantGen
00327  *   Plant Generator 
00328  * @param rCAlph
00329  *   Controllable events
00330  * @param rSpecGen
00331  *   Specification Generator 
00332  * @param rReverseCompositionMap
00333  *   std::map< std::pair<Idx,Idx>, Idx> as in the parallel composition function
00334  * @param rResGen
00335  *   Reference to resulting System, the
00336  *   minimal restrictive nonblocking supervisor
00337  *
00338  * @exception Exception
00339  *   - alphabets of generators don't match (id 100)
00340  *   - plant nondeterministic (id 201)
00341  *   - spec nondeterministic (id 203)
00342  *   - plant and spec nondeterministic (id 204)
00343  */
00344 void SupConNBUnchecked(
00345   const Generator& rPlantGen, 
00346   const EventSet&  rCAlph,
00347   const Generator& rSpecGen, 
00348   std::map< std::pair<Idx,Idx>,Idx >& rReverseCompositionMap, 
00349   Generator& rResGen);
00350 
00351 
00352 
00353 /**
00354  * Supremal Controllable Sublangauge (internal function)
00355  *
00356  * Indentifies and deletes "critical" states in the supervisor candidate,
00357  * in order to achieve controllability. 
00358  * This version of SupConClosed performs no consistency test of the given parameter.
00359  * In order to obtain indeed the supremal sublanguage, the state space of the candidate
00360  * must be rich enough to discriminate plant states. This can be done by e.g. setting
00361  * up the candidate SupConParallel. 
00362  *
00363  * In general, the result is blocking.
00364  *
00365  * @param rPlantGen
00366  *   Plant generator
00367  * @param rCAlph
00368  *   Controllable events
00369  * @param rSupCandGen
00370  *   Supervisor candidate generator
00371  *
00372  *
00373  */
00374 void SupConClosedUnchecked(
00375    const Generator& rPlantGen, 
00376    const EventSet&  rCAlph,
00377    Generator& rSupCandGen);
00378 
00379 
00380 /** 
00381  * Parallel composition optimized for the purpose of SupCon (internal function)
00382  * 
00383  * Composition stops at transition paths that violate the specification
00384  * by uncontrollable plant transitions. 
00385  *
00386  * This internal function performs no consistency test of the given parameter.
00387  * It set's up a "composition map" as in the product composition, however,
00388  * the map may still contain states that have been removed from the result
00389  * to obtain controllability.
00390  * 
00391  * @param rPlantGen
00392  *   Plant Generator 
00393  * @param rCAlph
00394  *   Uncontrollable Events
00395  * @param rSpecGen
00396  *   Specification Generator 
00397  * @param rReverseCompositionMap
00398  *   std::map< std::pair<Idx,Idx>, Idx> as in the parallel composition function
00399  * @param rResGen
00400  *   Reference to resulting Generator, the
00401  *   less restrictive supervisor
00402  */
00403 void SupConProduct(
00404   const Generator& rPlantGen, 
00405   const EventSet& rCAlph, 
00406   const Generator& rSpecGen,
00407   std::map< std::pair<Idx,Idx>, Idx>& rReverseCompositionMap, 
00408   Generator& rResGen);
00409 
00410 /**
00411  * Controllability (internal function)
00412  *
00413  * Checks if language of specification h is controllable with respect to
00414  * language of generator g.  Only for deterministic plant + spec. 
00415  * Controllable event set has to be given as parameter.
00416  *
00417  * This internal function performs no consistency test of the given parameter.
00418  *
00419  * @param rPlantGen
00420  *   Plant generator
00421  * @param rCAlph
00422  *   Controllable events
00423  * @param rSpecGen
00424  *   Specification generator
00425  * @param rCriticalStates
00426  *   Set of critical states
00427  *
00428  * @exception Exception
00429  *   - alphabets of generators don't match (id 100)
00430  *   - plant generator nondeterministic (id 201)
00431  *   - specification generator nondeterministic (id 203)
00432  *   - plant & spec generator nondeterministic (id 204)
00433  *
00434  * @return 
00435  *   true / false
00436  */
00437 bool IsControllableUnchecked(
00438   const Generator& rPlantGen, 
00439   const EventSet& rCAlph, 
00440   const Generator& rSpecGen, 
00441   StateSet& rCriticalStates);
00442 
00443 
00444 /**
00445  * Helper function for IsControllable. The state given as "current" is
00446  * considered critical. Itself and all uncontrollable predecessor states 
00447  * are added to the set "rCriticalStates". 
00448  *
00449  * @param rCAlph
00450  *   Set of controllable events
00451  * @param rtransrel
00452  *   Reverse sorted transition relation
00453  * @param rCriticalStates
00454  *   Set of critical states in composition generator
00455  * @param current
00456  *   Current state
00457  */
00458 void TraverseUncontrollableBackwards(
00459   const EventSet& rCAlph, 
00460   TransSetX2EvX1& rtransrel, 
00461   StateSet& rCriticalStates, 
00462   Idx current);
00463 
00464 
00465 
00466 /**
00467  * Consistency check for controlproblem input data.
00468  * Tests whether alphabets match and generators are deterministic.
00469  *
00470  * @param rPlantGen
00471  *   Plant generator
00472  * @param rCAlph
00473  *   Controllable events
00474  * @param rSpecGen
00475  *   Specification generator
00476  *
00477  * @exception Exception
00478  *   - lphabets of generators don't match (id 100)
00479  *   - plant generator nondeterministic (id 201)
00480  *   - specification generator nondeterministic (id 203)
00481  *   - plant and spec generator nondeterministic (id 204)
00482  */
00483 void ControlProblemConsistencyCheck(
00484   const Generator& rPlantGen, 
00485   const EventSet&  rCAlph,
00486   const Generator& rSpecGen);
00487 
00488 /**
00489  * Consistency check for controlproblem input data.
00490  * Tests whether alphabets match and generators are deterministic.
00491  *
00492  * @param rPlantGen
00493  *   Plant generator
00494  * @param rCAlph
00495  *   Controllable events
00496  * @param rOAlph
00497  *   Observable events
00498  * @param rSpecGen
00499  *   Specification generator
00500  *
00501  * @exception Exception
00502  *   - lphabets of generators don't match (id 100)
00503  *   - plant generator nondeterministic (id 201)
00504  *   - specification generator nondeterministic (id 203)
00505  *   - plant and spec generator nondeterministic (id 204)
00506  */
00507 void ControlProblemConsistencyCheck(
00508   const Generator& rPlantGen, 
00509   const EventSet&  rCAlph,
00510   const EventSet&  rOAlph,
00511   const Generator& rSpecGen);
00512 
00513 
00514 
00515 
00516 
00517 
00518 
00519 } // namespace faudes
00520 
00521 #endif 
00522 
00523 

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