|
Go to the documentation of this file.
43 std::map< std::pair<Idx,Idx>, Idx> rcmap;
51 std::map< std::pair<Idx,Idx>, Idx>& rCompositionMap, MtcSystem& rResGen) {
52 FD_DF( "mtcSupConNB(" << &rPlantGen << "," << &rSpecGen << ")");
57 rResGen. Name( "mtcSupConNB(("+rPlantGen. Name()+ "),("+rSpecGen. Name()+ "))");
69 FD_DF( "mtcSupConNB: uncontrollable events: " << ualph. ToString());
77 std::stringstream errstr;
78 errstr << "Alphabets of generators do not match. Only in plant: " << only_in_plant. ToString()
79 << ". Only in spec: " << only_in_spec. ToString() << ".";
80 throw Exception( "mtcSupConNB", errstr.str(), 500);
87 if ((plant_det == false) && (spec_det == true)) {
88 std::stringstream errstr;
89 errstr << "Plant generator must be deterministic, "
90 << "but is nondeterministic";
91 throw Exception( "mtcSupConNB", errstr.str(), 501);
93 else if ((plant_det == true) && (spec_det == false)) {
94 std::stringstream errstr;
95 errstr << "Spec generator must be deterministic, "
96 << "but is nondeterministic";
97 throw Exception( "mtcSupConNB", errstr.str(), 503);
99 else if ((plant_det == false) && (spec_det == false)) {
100 std::stringstream errstr;
101 errstr << "Plant and spec generator must be deterministic, "
102 << "but both are nondeterministic";
103 throw Exception( "mtcSupConNB", errstr.str(), 504);
109 FD_DF( "mtcSupConNB: mtcSupConParallel passed...");
113 if(rResGen. Empty()) break;
114 Idx state_num = rResGen. Size();
117 if(rResGen. Size() == state_num) break;
122 std::map< std::pair<Idx,Idx>, Idx>::iterator rcmapit = rCompositionMap.begin();
123 for(; rcmapit != rCompositionMap.end(); rcmapit++)
124 if(!rResGen. ExistsState(rcmapit->second)) rCompositionMap.erase(rcmapit++);
132 std::map< std::pair<Idx,Idx>, Idx> rcmap;
141 std::map< std::pair<Idx,Idx>, Idx>& rCompositionMap, MtcSystem& rResGen) {
142 FD_DF( "mtcSupConClosed(" << &rPlantGen << "," << &rSpecGen << ")");
146 rResGen. Name( "mtcSupConClosed(("+rPlantGen. Name()+ "),("+rSpecGen. Name()+ "))");
159 FD_DF( "mtcSupConClosed: uncontrollable events: " << ualph. ToString());
167 std::stringstream errstr;
168 errstr << "Alphabets of generators do not match. Only in plant: "
169 << only_in_plant. ToString() << ". Only in spec: "
171 throw Exception( "mtcSupConClosed", errstr.str(), 500);
178 if ((plant_det == false) && (spec_det == true)) {
179 std::stringstream errstr;
180 errstr << "Plant generator must be deterministic, " << "but is nondeterministic";
181 throw Exception( "mtcSupConClosed", errstr.str(), 501);
183 else if ((plant_det == true) && (spec_det == false)) {
184 std::stringstream errstr;
185 errstr << "Spec generator must be deterministic, " << "but is nondeterministic";
186 throw Exception( "mtcSupConClosed", errstr.str(), 503);
188 else if ((plant_det == false) && (spec_det == false)) {
189 std::stringstream errstr;
190 errstr << "Plant and spec generator must be deterministic, "
191 << "but both are nondeterministic";
192 throw Exception( "mtcSupCon", errstr.str(), 504);
203 std::map< std::pair<Idx,Idx>, Idx>::iterator rcmapit = rCompositionMap.begin();
204 for(; rcmapit != rCompositionMap.end(); rcmapit++)
205 if(!rResGen. ExistsState(rcmapit->second)) rCompositionMap.erase(rcmapit++);
221 std::map< std::pair<Idx,Idx>, Idx>& rReverseCompositionMap, MtcSystem& rResGen) {
222 FD_DF( "mtcSupConParallel(" << &rPlantGen << "," << &rSpecGen << ")");
227 std::stack< std::pair<Idx,Idx> > todo;
231 std::pair<Idx,Idx> currentstates, newstates;
234 std::map< std::pair<Idx,Idx>, Idx>::iterator rcmapit;
235 StateSet::Iterator lit1, lit2;
243 FD_DF( "SupconParallel: plant got no initial states. "
244 << "parallel composition contains empty language.");
249 FD_DF( "mtcSupConParallel: spec got no initial states. "
250 << "parallel composition contains empty language.");
257 todo.push(currentstates);
259 ComposedColorSet(rPlantGen, currentstates.first, plantColors, rSpecGen, currentstates.second,
260 specColors, ComposedSet);
261 if (! ComposedSet. Empty() ) {
263 rReverseCompositionMap[currentstates] = StateIndex;
264 rResGen. InsColors(StateIndex, ComposedSet);
265 FD_DF( "mtcSupConParallel: NEW IMSTATE: (" << rPlantGen. SStr(currentstates.first)
266 << "|" << rSpecGen. SStr(currentstates.second) << ") -> " << rReverseCompositionMap[currentstates]);
269 rReverseCompositionMap[currentstates] = rResGen. InsInitState();
270 FD_DF( "mtcSupConParallel: NEW ISTATE: (" << rPlantGen. SStr(currentstates.first)
271 << "|" << rSpecGen. SStr(currentstates.second) << ") -> " << rReverseCompositionMap[currentstates]);
277 FD_DF( "mtcSupConParallel: *** processing reachable states ***");
278 while (! todo.empty()) {
280 currentstates = todo.top();
282 FD_DF( "mtcSupConParallel: todo pop: (" << rPlantGen. SStr(currentstates.first)
283 << "|" << rSpecGen. SStr(currentstates.second) << ") -> " << rReverseCompositionMap[currentstates]);
286 titg_end = rPlantGen. TransRelEnd(currentstates.first);
288 tith_end = rSpecGen. TransRelEnd(currentstates.second);
290 #ifdef FAUDES_DEBUG_FUNCTION
292 FD_DF( "mtcSupConParallel: transitions from current states:");
293 for (;titg != titg_end; ++titg) {
294 FD_DF( "mtcSupConParallel: g: " << rPlantGen. SStr(titg->X1) << "-" << rPlantGen. EStr(titg->Ev)
295 << "-" << rPlantGen. SStr(titg->X2));
297 for (;tith != tith_end; ++tith) {
298 FD_DF( "mtcSupConParallel: h: " << rSpecGen. SStr(tith->X1) << "-" << rSpecGen. EStr(tith->Ev)
299 << "-" << rSpecGen. SStr(tith->X2));
305 while ((tith != tith_end) && (titg != titg_end)) {
306 FD_DF( "mtcSupConParallel: actual g-transition: " << rPlantGen. SStr(titg->X1)
307 << "-" << rPlantGen. EStr(titg->Ev) << "-" << rPlantGen. SStr(titg->X2));
308 FD_DF( "mtcSupConParallel: actual h-transition: " << rSpecGen. SStr(tith->X1)
309 << "-" << rSpecGen. EStr(tith->Ev) << "-" << rSpecGen. SStr(tith->X2));
311 if (titg->Ev == tith->Ev) {
312 FD_DF( "mtcSupConParallel: executing common event "
313 << rPlantGen. EStr(titg->Ev));
314 newstates = std::make_pair(titg->X2, tith->X2);
315 rcmapit = rReverseCompositionMap.find(newstates);
317 if (rcmapit == rReverseCompositionMap.end()) {
318 todo.push(newstates);
320 ComposedColorSet(rPlantGen, newstates.first, plantColors, rSpecGen, newstates.second,
321 specColors, ComposedSet);
322 if(!ComposedSet. Empty() ) {
324 rResGen. InsColors(tmpstate, ComposedSet);
325 FD_DF( "mtcSupConParallel: NEW MSTATE: ("
326 << rPlantGen. SStr(newstates.first) << "|"
327 << rSpecGen. SStr(newstates.second) << ") -> " << tmpstate);
332 FD_DF( "mtcSupConParallel: NEW STATE: ("
333 << rPlantGen. SStr(newstates.first) << "|"
334 << rSpecGen. SStr(newstates.second) << ") -> " << tmpstate);
336 rReverseCompositionMap[newstates] = tmpstate;
337 FD_DF( "mtcSupConParallel: todo push: (" << rPlantGen. SStr(newstates.first)
338 << "|" << rSpecGen. SStr(newstates.second) << ") -> " << tmpstate);
342 tmpstate = rcmapit->second;
345 if (! forbidden. Exists(tmpstate)) {
346 FD_DF( "mtcSupConParallel: ADDING TRANSITION "
347 << rPlantGen. SStr(rReverseCompositionMap[currentstates]) << "-" << rPlantGen. EStr(titg->Ev)
348 << "-" << rPlantGen. SStr(tmpstate));
349 rResGen. SetTransition(rReverseCompositionMap[currentstates], titg->Ev, tmpstate);
350 FD_DF( "mtcSupConParallel: incrementing g transrel");
352 FD_DF( "mtcSupConParallel: incrementing h transrel");
357 else if (rUAlph. Exists(titg->Ev)) {
358 FD_DF( "mtcSupConParallel: successor " << rSpecGen. SStr(tmpstate)
359 << "in forbidden and common event " << rSpecGen. EStr(titg->Ev)
360 << " uncontrollable:");
361 FD_DF( "mtcSupConParallel: forbidden insert" << rPlantGen. SStr(tmpstate));
362 forbidden. Insert(tmpstate);
363 #ifdef FAUDES_CHECKED
366 FD_DF( "mtcSupConParallel: incrementing g transrel (FAUDES_CHECKED)");
368 FD_DF( "mtcSupConParallel: incrementing h transrel (FAUDES_CHECKED)");
378 FD_DF( "mtcSupConParallel: incrementing g transrel");
380 FD_DF( "mtcSupConParallel: incrementing h transrel");
385 else if (titg->Ev < tith->Ev) {
386 FD_DF( "mtcSupConParallel: asynchronous execution of event "
387 << rPlantGen. EStr(titg->Ev) << " in g while " << rSpecGen. EStr(tith->Ev)
391 if (rUAlph. Exists(titg->Ev)) {
392 FD_DF( "mtcSupConParallel: asynchronous event " << rPlantGen. EStr(titg->Ev)
393 << " in g is uncontrollable");
394 tmpstate = rReverseCompositionMap[currentstates];
395 FD_DF( "mtcSupConParallel: forbidden insert" << rPlantGen. SStr(tmpstate));
396 forbidden. Insert(tmpstate);
402 FD_DF( "mtcSupConParallel: incrementing g transrel");
406 #ifdef FAUDES_CHECKED
411 FD_DF( "mtcSupConParallel: incrementing h transrel");
415 if (rResGen. InitStates(). Empty()) FD_DF( "mtcSupConParallel: rResGen has no initial states... (2)");
418 while (titg != titg_end) {
419 FD_DF( "mtcSupConParallel: asynchronous execution of event "
420 << rPlantGen. EStr(titg->Ev) << " in g at end of h");
421 FD_DF( "mtcSupConParallel: actual g-transition: " << rPlantGen. SStr(titg->X1)
422 << "-" << rPlantGen. EStr(titg->Ev) << "-" << rPlantGen. SStr(titg->X2));
423 FD_DF( "mtcSupConParallel: actual h-transition: end");
425 if (rUAlph. Exists(titg->Ev)) {
426 tmpstate = rReverseCompositionMap[currentstates];
427 FD_DF( "mtcSupConParallel: asynchron executed uncontrollable end "
428 << "event " << rPlantGen. EStr(titg->Ev) << " leaves specification:");
429 FD_DF( "mtcSupConParallel: forbidden insert" << rPlantGen. SStr(tmpstate));
430 forbidden. Insert(tmpstate);
435 FD_DF( "mtcSupConParallel: incrementing g transrel");
438 #ifdef FAUDES_CHECKED
449 FD_DF( "mtcSupConParallel: deleting forbidden states...");
464 FD_DF( "mtcSupConUnchecked(" << &rSpecGen << "," << &rPlantGen << ")");
471 std::stack<Idx> todog, todoh;
490 while (! todog.empty()) {
492 Idx currentg = todog.top();
493 Idx currenth = todoh.top();
496 FD_DF( "mtcSupCon: todo pop: (" << rPlantGen. SStr(currentg) << "|"
497 << rSpecGen. SStr(currenth) << ")");
499 #ifdef FAUDES_DEBUG_FUNCTION
502 FD_DF( "mtcSupCon: transitions from current states:");
504 FD_DF( "mtcSupCon: g: " << rPlantGen. SStr(_titg->X1) << "-"
505 << rPlantGen. EStr(_titg->Ev) << "-" << rPlantGen. SStr(_titg->X2));
507 FD_DF( "mtcSupCon: h: " << rSpecGen. SStr(_tith->X1) << "-"
508 << rSpecGen. EStr(_tith->Ev) << "-" << rSpecGen. SStr(_tith->X2));
516 while ((tith != tith_end) && (titg != titg_end)) {
517 FD_DF( "mtcSupCon: actual g-transition: " << rPlantGen. SStr(titg->X1)
518 << "-" << rPlantGen. EStr(titg->Ev) << "-" << rPlantGen. SStr(titg->X2));
519 FD_DF( "mtcSupCon: actual h-transition: " << rSpecGen. SStr(tith->X1)
520 << "-" << rSpecGen. EStr(tith->Ev) << "-" << rSpecGen. SStr(tith->X2));
522 if (titg->Ev == tith->Ev) {
523 FD_DF( "mtcSupCon: executing common event " << rPlantGen. EStr(titg->Ev));
525 if (! discovered. Exists(currenth)) {
526 todog.push(titg->X2);
527 todoh.push(tith->X2);
528 FD_DF( "mtcSupCon: todo push: (" << rPlantGen. SStr(titg->X2) << "|"
529 << rSpecGen. SStr(tith->X2) << ")");
532 if (! forbidden. Exists(tith->X2)) {
534 FD_DF( "mtcSupCon: incrementing g transrel");
536 FD_DF( "mtcSupCon: incrementing h transrel");
540 else if (!rCAlph. Exists(titg->Ev)) {
541 FD_DF( "mtcSupCon: successor state " << rSpecGen. SStr(tith->X2) <<
542 " forbidden and event " << rPlantGen. EStr(titg->Ev) << " uncontrollable:");
543 FD_DF( "mtcSupCon: TraverseUncontrollableBackwards(" << rSpecGen. SStr(currenth) << ")");
545 #ifdef FAUDES_CHECKED
547 FD_DF( "mtcSupCon: incrementing g transrel (FAUDES_CHECKED)");
549 FD_DF( "mtcSupCon: incrementing h transrel (FAUDES_CHECKED)");
560 FD_DF( "mtcSupCon: incrementing g transrel");
562 FD_DF( "mtcSupCon: incrementing h transrel");
567 else if (titg->Ev < tith->Ev) {
568 FD_DF( "mtcSupCon: asynchronous execution of event "
569 << rPlantGen. EStr(titg->Ev) << " in g while " << rSpecGen. EStr(tith->Ev)
573 if (!rCAlph. Exists(titg->Ev)) {
574 FD_DF( "mtcSupCon: asynchronous event " << rPlantGen. EStr(titg->Ev)
575 << " in g is uncontrollable");
576 FD_DF( "mtcSupCon: TraverseUncontrollableBackwards(" << rSpecGen. SStr(currenth) << ")");
582 FD_DF( "mtcSupCon: incrementing g transrel");
587 #ifdef FAUDES_CHECKED
588 FD_WARN( "mtcSupCon: transition " << rSpecGen. SStr(tith->X1) << "-"
589 << rSpecGen. EStr(tith->Ev) << "-" << rSpecGen. SStr(tith->X2)
590 << "in specification h not found in g");
592 FD_DF( "mtcSupCon: incrementing h transrel");
597 while (titg != titg_end) {
598 FD_DF( "mtcSupCon: asynchronous execution of event "
599 << rPlantGen. EStr(titg->Ev) << " in g at end of h");
600 FD_DF( "mtcSupCon: actual g-transition: " << rPlantGen. SStr(titg->X1)
601 << "-" << rPlantGen. EStr(titg->Ev) << "-" << rPlantGen. SStr(titg->X2));
602 FD_DF( "mtcSupCon: actual h-transition: end");
604 if (!rCAlph. Exists(titg->Ev)) {
605 FD_DF( "mtcSupCon: asynchronous execution of uncontrollable event "
606 << rPlantGen. EStr(titg->Ev) << " in g");
607 FD_DF( "mtcSupCon: TraverseUncontrollableBackwards(" << rPlantGen. SStr(currenth) << ")");
612 FD_DF( "mtcSupCon: incrementing g transrel");
615 #ifdef FAUDES_CHECKED
617 while (tith != tith_end) {
618 FD_WARN( "mtcSupCon: transition " << rSpecGen. SStr(tith->X1) << "-"
619 << rSpecGen. EStr(tith->Ev) << "-" << rSpecGen. SStr(tith->X2)
620 << "in specification h not found in g");
621 FD_DF( "mtcSupCon: incrementing h transrel");
625 discovered. Insert(currenth);
629 forbidden = rSpecGen. States() - ( discovered - forbidden );
libFAUDES 2.26g
--- 2015.08.17
--- c++ api documentaion by doxygen
|