libFAUDES
Sections
Index
|
syn_supcon.hGo 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 * have 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 * RTI wrapper. 00111 */ 00112 bool IsControllable( 00113 const Generator& rPlantGen, 00114 const EventSet& rCAlph, 00115 const Generator& rSupCandGen); 00116 00117 /** 00118 * Test controllability. 00119 * 00120 * Tests whether the candidate supervisor h is controllable w.r.t. 00121 * the plant g; this is a System wrapper for IsControllable 00122 * 00123 * @param rPlantGen 00124 * Plant g generator 00125 * @param rSupCandGen 00126 * Supervisor candidate h generator 00127 * 00128 * @exception Exception 00129 * Alphabets of generators don't match (id 500) 00130 * Plant generator nondeterministic (id 501) 00131 * Specification generator nondeterministic (id 503) 00132 * Plant & Spec generator nondeterministic (id 504) 00133 * 00134 * @return 00135 * true / false 00136 * 00137 * @ingroup SynthesisPlugIn 00138 */ 00139 bool IsControllable( 00140 const System& rPlantGen, 00141 const Generator& rSupCandGen); 00142 00143 00144 /** 00145 * Nonblocking Supremal Controllable Sublanguage 00146 * 00147 * Computes the supremal nonblocking sublanguage of the specification E that is controllable 00148 * w.r.t. the plant G. The result is given as a trim deterministic generator that 00149 * may be used to supervise G in order to enforce H. This implementation does not require E 00150 * to represent a sublanguage of G 00151 * 00152 * See "C.G CASSANDRAS AND S. LAFORTUNE. Introduction to Discrete Event 00153 * Systems. Kluwer, 1999." for base algorithm. 00154 * 00155 * Parameter restrictions: both generators must be deterministic and 00156 * have the same alphabet. 00157 * 00158 * 00159 * @param rPlantGen 00160 * Plant G 00161 * @param rCAlph 00162 * Controllable events 00163 * @param rSpecGen 00164 * Specification Generator E 00165 * @param rResGen 00166 * Reference to resulting Generator, the 00167 * minimal restrictive nonblocking supervisor 00168 * 00169 * @exception Exception 00170 * - alphabets of generators don't match (id 100) 00171 * - plant nondeterministic (id 201) 00172 * - spec nondeterministic (id 203) 00173 * - plant and spec nondeterministic (id 204) 00174 * 00175 * @ingroup SynthesisPlugIn 00176 * 00177 */ 00178 void SupConNB( 00179 const Generator& rPlantGen, 00180 const EventSet& rCAlph, 00181 const Generator& rSpecGen, 00182 Generator& rResGen); 00183 00184 00185 00186 /** 00187 * Nonblocking Supremal Controllable Sublanguage 00188 * 00189 * This is the RTI wrapper for 00190 * SupConNB(const Generator&, const EventSet&, const Generator&, Generator&). 00191 * Controllability attributes are taken from the plant argument. 00192 * If the result is specified as a System, attributes will be copied 00193 * from the plant argument. 00194 * 00195 * 00196 * @param rPlantGen 00197 * Plant System 00198 * @param rSpecGen 00199 * Specification Generator 00200 * @param rResGen 00201 * Reference to resulting Generator, the 00202 * minimal restrictive nonblocking supervisor 00203 * 00204 * @exception Exception 00205 * Alphabets of generators don't match (id 100) 00206 * plant nondeterministic (id 201) 00207 * spec nondeterministic (id 203) 00208 * plant and spec nondeterministic (id 204) 00209 * 00210 * @ingroup SynthesisPlugIn 00211 */ 00212 void SupConNB( 00213 const System& rPlantGen, 00214 const Generator& rSpecGen, 00215 Generator& rResGen); 00216 00217 00218 00219 /** 00220 * Supremal Controllable Sublanguage 00221 * 00222 * Parameter restrictions: both generators must be deterministic and 00223 * have the same alphabet. 00224 * 00225 * @param rPlantGen 00226 * Plant G 00227 * @param rCAlph 00228 * Controllable events 00229 * @param rSpecGen 00230 * Specification E 00231 * @param rResGen 00232 * Reference to resulting Generator, the 00233 * minimal restrictive supervisor 00234 * 00235 * @exception Exception 00236 * - alphabets of generators don't match (id 100) 00237 * - plant nondeterministic (id 201) 00238 * - spec nondeterministic (id 203) 00239 * - plant and spec nondeterministic (id 204) 00240 * 00241 * @ingroup SynthesisPlugIn 00242 */ 00243 void SupCon( 00244 const Generator& rPlantGen, 00245 const EventSet& rCAlph, 00246 const Generator& rSpecGen, 00247 Generator& rResGen); 00248 00249 00250 /** 00251 * Supremal Controllable Sublanguage. 00252 * 00253 * This is the RTI wrapper for 00254 * SupCon(const Generator&, const EventSet&, const Generator&, Generator&). 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 SupCon( 00276 const System& rPlantGen, 00277 const Generator& rSpecGen, 00278 Generator& rResGen); 00279 00280 /** 00281 * Supremal Controllable Sublanguage. 00282 * 00283 * Only for deterministic plant + spec. Throws exception if plant or 00284 * spec is nondeterministic. 00285 * 00286 * Real SupCon function 00287 * 00288 * Finds the "largest" sublanguage of h for that language of g is 00289 * controllable with respect to h. Note that the language of h is not 00290 * rtequired to be a a sublanguage of g, but both languages must share 00291 * the same alphabet. 00292 * 00293 * See "C.G CASSANDRAS AND S. LAFORTUNE. Introduction to Discrete Event 00294 * Systems. Kluwer, 1999." for base algorithm. 00295 * 00296 * This version creates a "reverse composition map" given as reference 00297 * parameter. 00298 * 00299 * @param rPlantGen 00300 * Plant Generator 00301 * @param rCAlph 00302 * Controllable events 00303 * @param rSpecGen 00304 * Specification Generator 00305 * @param rReverseCompositionMap 00306 * std::map< std::pair<Idx,Idx>, Idx> as in the parallel composition function 00307 * @param rResGen 00308 * Reference to resulting Generator, the 00309 * minimal restrictive supervisor 00310 * 00311 * @exception Exception 00312 * - alphabets of generators don't match (id 100) 00313 * - plant nondeterministic (id 201) 00314 * - spec nondeterministic (id 203) 00315 * - plant and spec nondeterministic (id 204) 00316 */ 00317 void SupCon( 00318 const Generator& rPlantGen, 00319 const EventSet& rCAlph, 00320 const Generator& rSpecGen, 00321 std::map< std::pair<Idx,Idx>,Idx >& rReverseCompositionMap, 00322 Generator& rResGen); 00323 00324 00325 /** 00326 * Nonblocking Supremal Controllable Sublanguage. 00327 * 00328 * For deterministic and nondeterministic plant or spec. 00329 * 00330 * - If rPlantGen is deterministic, rDetPlantGen will be unchanged. 00331 * rDetPlantBool will be set to false. 00332 * 00333 * - If rSpecGen is deterministic, rDetSpecGen will be unchanged 00334 * rDetSpecBool will be set to false 00335 * 00336 * - If rPlantGen is nondeterministic, rDetPlantGen will contain deterministic 00337 * plant generator. rDetPlantBool will be set to true. rPowerStatesPlant will 00338 * contain the mapping of deterministic states to subsets of nondeterministic 00339 * states 00340 * 00341 * - If rSpecGen is nondeterministic, rDetPlantGen will contain deterministic 00342 * spec generator. rDetSpecBool will be set to true. rPowerStatesSpec will 00343 * contain the mapping of deterministic states to subsets of nondeterministic 00344 * states 00345 * 00346 * Finds the "largest" sublanguage of h for that language of g is 00347 * controllable with respect to h. Differing from theory the marked 00348 * language of h may not be a sublanguage of g but both must share the 00349 * same alphabet. 00350 * 00351 * See "C.G CASSANDRAS AND S. LAFORTUNE. Introduction to Discrete Event 00352 * Systems. Kluwer, 1999." for base algorithm. 00353 * 00354 * This version creates a "reverse composition map" given as reference 00355 * parameter. 00356 * 00357 * @param rPlantGen 00358 * Plant Generator 00359 * @param rCAlph 00360 * Controllable events 00361 * @param rSpecGen 00362 * Specification Generator 00363 * @param rReverseCompositionMap 00364 * std::map< std::pair<Idx,Idx>, Idx> as in the parallel composition function 00365 * @param rDetPlantGen 00366 * Deterministic plant generator (if rPlantGen is nondeterministic) 00367 * @param rDetSpecGen 00368 * Deterministic spec generator (if rSpecGen is nondeterministic) 00369 * @param rPowerStatesPlant 00370 * Mapping of deterministic states to set of nondeterministic states 00371 * @param rPowerStatesSpec 00372 * Mapping of deterministic states to set of nondeterministic states 00373 * @param rDetPlantBool 00374 * true if rPlantGen is deterministic, false if not 00375 * @param rDetSpecBool 00376 * true if rSpecGen is deterministic, false if not 00377 * @param rResGen 00378 * Reference to resulting Generator, the 00379 * minimal restrictive nonblocking supervisor 00380 * 00381 * @exception Exception 00382 * Alphabets of generators don't match (id 500) 00383 */ 00384 void SupConNBNonDet( 00385 const Generator& rPlantGen, 00386 const EventSet& rCAlph, 00387 const Generator& rSpecGen, 00388 std::map< std::pair<Idx,Idx>, Idx>& rReverseCompositionMap, 00389 Generator rDetPlantGen, 00390 Generator rDetSpecGen, 00391 std::map<Idx,StateSet>& rPowerStatesPlant, 00392 std::map<Idx,StateSet>& rPowerStatesSpec, 00393 bool& rDetPlantBool, 00394 bool& rDetSpecBool, 00395 Generator& rResGen); 00396 00397 /** 00398 * Nonblocking Supremal Controllable Sublanguage (internal function) 00399 * 00400 * This version of SupConNB creates a "reverse composition map" given 00401 * as reference parameter. It is used by the user function to set up 00402 * descriptive state names of the supervisor. 00403 * 00404 * @param rPlantGen 00405 * Plant Generator 00406 * @param rCAlph 00407 * Controllable events 00408 * @param rSpecGen 00409 * Specification Generator 00410 * @param rReverseCompositionMap 00411 * std::map< std::pair<Idx,Idx>, Idx> as in the parallel composition function 00412 * @param rResGen 00413 * Reference to resulting System, the 00414 * minimal restrictive nonblocking supervisor 00415 * 00416 * @exception Exception 00417 * - alphabets of generators don't match (id 100) 00418 * - plant nondeterministic (id 201) 00419 * - spec nondeterministic (id 203) 00420 * - plant and spec nondeterministic (id 204) 00421 */ 00422 void SupConNBUnchecked( 00423 const Generator& rPlantGen, 00424 const EventSet& rCAlph, 00425 const Generator& rSpecGen, 00426 std::map< std::pair<Idx,Idx>,Idx >& rReverseCompositionMap, 00427 Generator& rResGen); 00428 00429 00430 00431 /** 00432 * Supremal Controllable Sublangauge (internal function) 00433 * 00434 * Indetifies and deletes "critical" states in the supervisor candidate, 00435 * in order to achieve controllability. 00436 * 00437 * In general, the result is blocking. 00438 * 00439 * @param rPlantGen 00440 * Plant generator 00441 * @param rCAlph 00442 * Controllable events 00443 * @param rSupCandGen 00444 * Supervisor candidate generator 00445 * 00446 * 00447 */ 00448 void SupConUnchecked( 00449 const Generator& rPlantGen, 00450 const EventSet& rCAlph, 00451 Generator& rSupCandGen); 00452 00453 00454 /** 00455 * Parallel composition optimized for the purpose of SupCon (internal function) 00456 * 00457 * Composition stops at transition paths that violate the specification 00458 * by uncontrollable plant transitions. 00459 * 00460 * @param rPlantGen 00461 * Plant Generator 00462 * @param rCAlph 00463 * Uncontrollable Events 00464 * @param rSpecGen 00465 * Specification Generator 00466 * @param rReverseCompositionMap 00467 * std::map< std::pair<Idx,Idx>, Idx> as in the parallel composition function 00468 * @param rResGen 00469 * Reference to resulting Generator, the 00470 * less restrictive supervisor 00471 */ 00472 void SupconParallel( 00473 const Generator& rPlantGen, 00474 const EventSet& rCAlph, 00475 const Generator& rSpecGen, 00476 std::map< std::pair<Idx,Idx>, Idx>& rReverseCompositionMap, 00477 Generator& rResGen); 00478 00479 /** 00480 * Controllability (internal function) 00481 * 00482 * Checks if language of specification h is controllable with respect to 00483 * language of generator g. Only for deterministic plant + spec. 00484 * 00485 * 00486 * Controllable event set has to be given as parameter. 00487 * Returns the set of critical states as last parameter. 00488 * 00489 * @param rPlantGen 00490 * Plant generator 00491 * @param rCAlph 00492 * Controllable events 00493 * @param rSpecGen 00494 * Specification generator 00495 * @param rCriticalStates 00496 * Set of critical states 00497 * 00498 * @exception Exception 00499 * - alphabets of generators don't match (id 100) 00500 * - plant generator nondeterministic (id 201) 00501 * - specification generator nondeterministic (id 203) 00502 * - plant & spec generator nondeterministic (id 204) 00503 * 00504 * @return 00505 * true / false 00506 */ 00507 bool IsControllableUnchecked( 00508 const Generator& rPlantGen, 00509 const EventSet& rCAlph, 00510 const Generator& rSpecGen, 00511 StateSet& rCriticalStates); 00512 00513 00514 /** 00515 * Helper function for IsControllable. The state given as "current" is 00516 * considered critical. Itself and all uncontrollable predecessor states 00517 * are added to the set "rCriticalStates". 00518 * 00519 * @param rCAlph 00520 * Set of controllable events 00521 * @param rtransrel 00522 * Reverse sorted transition relation 00523 * @param rCriticalStates 00524 * Set of critical states in composition generator 00525 * @param current 00526 * Current state 00527 */ 00528 void TraverseUncontrollableBackwards( 00529 const EventSet& rCAlph, 00530 TransSetX2EvX1& rtransrel, 00531 StateSet& rCriticalStates, 00532 Idx current); 00533 00534 00535 00536 /** 00537 * Consistency check for controlproblem input data. 00538 * Tests whether alphabets match and generators are deterministic. 00539 * 00540 * @param rPlantGen 00541 * Plant generator 00542 * @param rCAlph 00543 * Controllable events 00544 * @param rSpecGen 00545 * Specification generator 00546 * 00547 * @exception Exception 00548 * - lphabets of generators don't match (id 100) 00549 * - plant generator nondeterministic (id 201) 00550 * - specification generator nondeterministic (id 203) 00551 * - plant and spec generator nondeterministic (id 204) 00552 */ 00553 void ControlProblemConsistencyCheck( 00554 const Generator& rPlantGen, 00555 const EventSet& rCAlph, 00556 const Generator& rSpecGen); 00557 00558 00559 00560 00561 00562 00563 00564 } // namespace faudes 00565 00566 #endif 00567 00568 |
libFAUDES 2.20s --- 2011.10.12 --- c++ source docu by doxygen