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