47 FD_DF(
"IsOmegaControllable(\"" << rGenPlant.
Name() <<
"\", \"" << rGenCand.
Name() <<
"\")");
51 std::stringstream errstr;
52 errstr <<
"Alphabets of generators do not match.";
53 throw Exception(
"IsOmegaControllable(..)", errstr.str(), 100);
59 std::stringstream errstr;
60 errstr <<
"Argument \"" << rGenCand.
Name() <<
"\" is not omega-trim.";
61 throw Exception(
"IsOmegaControllable(..)", errstr.str(), 201);
64 std::stringstream errstr;
65 errstr <<
"Argument \"" << rGenPlant.
Name() <<
"\" is not omega-trim.";
66 throw Exception(
"IsOmegaControllable(..)", errstr.str(), 201);
72 if(rGenCand.
Empty()) {
73 FD_DF(
"IsOmegaControllable(..): empty candidate, pass");
79 if(rGenPlant.
Empty()) {
80 FD_DF(
"IsOmegaControllable(..): empty plant, fail");
87 std::stringstream errstr;
88 errstr <<
"Arguments are expected to be deterministic.";
89 throw Exception(
"IsOmegaControllable", errstr.str(), 202);
101 FD_DF(
"IsOmegaControllable(...): passed");
130 FD_DF(
"SupConCmplClosed(" << rPlantGen.
Name() <<
"," << rSpecGen.
Name()<<
")");
137 if(&rResGen== &rPlantGen || &rResGen== &rSpecGen) {
138 pResGen= rResGen.
New();
141 pResGen->
Name(
"SupConCmplClosed("+rPlantGen.
Name()+
", "+rSpecGen.
Name()+
")");
146 FD_DF(
"SupConCmplClosed: empty language specification - empty result.");
151 std::map< std::pair<Idx,Idx>,
Idx> revmap;
154 SupConProduct(rPlantGen, rCAlph, rSpecGen, revmap, *pResGen);
158 Idx state_num = pResGen->
Size();
163 if(pResGen->
Size() == state_num)
break;
173 if(pResGen != &rResGen) {
174 pResGen->
Move(rResGen);
215 FD_DF(
"SupConCmplNB(" << rPlantGen.
Name() <<
"," << rSpecGen.
Name()<<
")");
222 if(&rResGen== &rPlantGen || &rResGen== &rSpecGen) {
223 pResGen= rResGen.
New();
226 pResGen->
Name(
"SupConCmplNB("+rPlantGen.
Name()+
", "+rSpecGen.
Name()+
")");
231 FD_DF(
"SupConCmplNB: empty language specification - empty result.");
236 std::map< std::pair<Idx,Idx>,
Idx> revmap;
239 SupConProduct(rPlantGen, rCAlph, rSpecGen, revmap, *pResGen);
243 Idx state_num = pResGen->
Size();
250 if(pResGen->
Size() == state_num)
break;
260 if(pResGen != &rResGen) {
261 pResGen->
Move(rResGen);
302 FD_DF(
"SupConNormCmplNB(" << rL.
Name() <<
"," << rK.
Name() <<
")");
331 FD_DF(
"SupConNormCmplNB(" << rL.
Name() <<
"," << rK.
Name() <<
"): done");
341 FD_DF(
"SupConNormCmplNB(" << rPlantGen.
Name() <<
"," << rSpecGen.
Name() <<
"): rti wrapper");
344 if(&rResGen== &rPlantGen || &rResGen== &rSpecGen) {
345 pResGen= rResGen.
New();
352 if(pResGen != &rResGen) {
353 pResGen->
Move(rResGen);
550 FD_DF(
"OmegaControlledLiveness()");
553 StateSet resolved, initialK, targetLstar;
573 targetLstar = (initialK * rSupCandGen.
MarkedStates()) + resolved;
574 FD_DF(
"OmegaControlledLiveness(): [STD] iterate resolved/targetLstar #" << rsz <<
"/" << targetLstar.
Size());
585 targetL=targetLstar+initialL;
586 FD_DF(
"OmegaControlledLiveness(): [STD] ---- iterate targetL #" << targetL.
Size());
592 targetL = targetLstar + initialL;
595 FD_DF(
"OmegaControlledLiveness(): [STD] --- iterate domainL #" << domainL.
Size());
598 FD_WPC(1,2,
"OmegaControlledLiveness(): [STD] iterating reverse dynamics");
601 domain=domainL-rPlantMarking;
610 target = targetL + (target1-rPlantMarking);
613 FD_DF(
"OmegaControlledLiveness(): [STD] -- evaluate theta for target/domain # "
614 << target.
Size() <<
"/" << domain.
Size());
616 StateSet::Iterator sit = full.
Begin();
617 StateSet::Iterator sit_end = full.
End();
618 for(;sit!=sit_end;++sit) {
623 for(;tit!=tit_end; ++tit) {
624 if(target.
Exists(tit->X2)) {pass =
true;
continue;}
625 if(domain.
Exists(tit->X2)) {
continue;}
626 if(!rCAlph.
Exists(tit->Ev)){ fail =
true;
break;}
630 FD_DF(
"OmegaControlledLiveness(): [STD] theta found state " << rSupCandGen.
SStr(*sit));
636 if(target1.
Size()==t1sz)
break;
637 if(target1.
Size()==fsz)
break;
640 FD_DF(
"OmegaControlledLiveness(): [STD] -- mu-target1 # " << target1.
Size());
644 if(domainL.
Size()==dLsz)
break;
645 if(domainL.
Size()==0)
break;
648 FD_DF(
"OmegaControlledLiveness(): [STD] --- nu-domainL-mu-target1 # " << domainL.
Size());
651 initialL.InsertSet(domainL);
652 if(initialL.Size()==iLsz)
break;
653 if(initialL.Size()==fsz)
break;
658 if(initialK.
Size()==iKsz)
break;
659 if(initialK.
Size()==0)
break;
664 if(resolved.
Size()==rsz)
break;
665 if(resolved.
Size()==fsz)
break;
686 std::map< Idx , EventSet>& rFeedbackMap)
689 FD_WARN(
"OmegaControlledLiveness()");
692 StateSet resolved, initialK, targetLstar;
699 std::map< Idx , EventSet> controls1;
700 std::map< Idx , EventSet> controls1L;
701 std::map< Idx , EventSet> controls1X;
714 targetLstar = (initialK * rSupCandGen.
MarkedStates()) + resolved;
715 FD_WARN(
"OmegaControlledLiveness(): [FBM] iterate resolved/targetLstar #" << xsz <<
"/" << targetLstar.
Size());
724 targetL = targetLstar + initialL;
725 FD_WARN(
"OmegaControlledLiveness(): [FBM] ---- iterate targetL #" << targetL.
Size());
731 domain=domainL-rPlantMarking;
732 FD_WARN(
"OmegaControlledLiveness(): [FBM] --- iterate domain #" << domain.
Size());
738 FD_WPC(1,2,
"OmegaControlledLiveness(): [FBM] iterating reverse dynamics");
744 target = targetL + (target1-rPlantMarking);
747 FD_WARN(
"OmegaControlledLiveness(): [FBM] -- evaluate theta for target/domain # "
748 << target.
Size() <<
"/" << domain.
Size());
750 StateSet::Iterator sit = full.
Begin();
751 StateSet::Iterator sit_end = full.
End();
752 for(;sit!=sit_end;++sit) {
758 for(;tit!=tit_end; ++tit) {
759 if(target.
Exists(tit->X2)) { pass =
true;
continue; }
760 if(domain.
Exists(tit->X2)) {
continue; }
761 if(!rCAlph.
Exists(tit->Ev)){ fail =
true;
break; }
766 if(controls1.find(*sit)==controls1.end()) controls1[*sit]=disable;
767 FD_WARN(
"OmegaControlledLiveness(): [FBM] theta found state " << rSupCandGen.
SStr(*sit));
774 if(target1.
Size()==t1sz)
break;
775 if(target1.
Size()==fsz)
break;
778 FD_WARN(
"OmegaControlledLiveness(): [FBM] -- mu-target1 # " << target1.
Size());
782 if(domainL.
Size()==dsz)
break;
783 if(domainL.
Size()==0)
break;
786 FD_WARN(
"OmegaControlledLiveness(): [FBM] --- nu-domainL-mu-target1 # " << domainL.
Size());
789 std::map< Idx , EventSet>::iterator cit=controls1.begin();
790 std::map< Idx , EventSet>::iterator cit_end=controls1.end();
791 for(;cit!=cit_end;++cit) {
792 if(controls1L.find(cit->first)!=controls1L.end())
continue;
793 controls1L[cit->first]=cit->second;
797 initialL.InsertSet(domainL);
798 if(initialL.Size()==t1Lsz)
break;
799 if(initialL.Size()==fsz)
break;
804 if(initialK.
Size()==rsz)
break;
805 if(initialK.
Size()==0)
break;
809 std::map< Idx , EventSet>::iterator cit=controls1L.begin();
810 std::map< Idx , EventSet>::iterator cit_end=controls1L.end();
811 for(;cit!=cit_end;++cit) {
812 if(controls1X.find(cit->first)!=controls1X.end())
continue;
813 controls1X[cit->first]=cit->second;
818 if(resolved.
Size()==xsz)
break;
819 if(resolved.
Size()==fsz)
break;
827 StateSet::Iterator sit = resolved.
Begin();
828 StateSet::Iterator sit_end = resolved.
End();
829 for(;sit!=sit_end;++sit) {
830 FD_WARN(
"OmegaControlledLiveness(): [FBM] controls " << rSupCandGen.
SStr(*sit) <<
" " << controls1X[*sit].ToString());
831 rFeedbackMap[*sit]= (rSupCandGen.
ActiveEventSet(*sit) + ucalph) - controls1X[*sit];
851 std::set< EventSet >::iterator eit =
enable_one.begin();
852 std::set< EventSet >::iterator eit_end =
enable_one.end();
853 for(; eit!=eit_end ; ++eit)
877 std::map< Idx , Idx>& rControllerStatesMap,
878 std::map< Idx , EventSet>& rFeedbackMap)
881 FD_WARN(
"OmegaControlledLiveness(): [POBS]: cand #" << rSupCandGen.
Size());
884 StateSet::Iterator xit = rSupCandGen.
StatesBegin();
885 StateSet::Iterator xit_end = rSupCandGen.
StatesEnd();
886 for(;xit!=xit_end;++xit) {
887 std::map< Idx , Idx >::const_iterator cxit=rControllerStatesMap.find(*xit);
888 if(cxit==rControllerStatesMap.end()) rControllerStatesMap[*xit]=*xit;
892 std::map< Idx , Idx>::const_iterator oit = rControllerStatesMap.begin();
893 std::set< Idx > ostates;
894 for(; oit != rControllerStatesMap.end(); ++oit)
895 ostates.insert(oit->second);
896 FD_WARN(
"OmegaControlledLiveness(): [POBS]: " <<
"obs #" << ostates.size());
899 StateSet resolved, initialK, targetLstar;
907 std::map< Idx , MCtrlPattern> controlsT;
908 std::map< Idx , MCtrlPattern> controls1;
909 std::map< Idx , MCtrlPattern> controls1L;
910 std::map< Idx , MCtrlPattern> controls1X;
923 targetLstar = (initialK * rSupCandGen.
MarkedStates()) + resolved;
924 FD_WARN(
"OmegaControlledLiveness(): [POBS] iterate resolved/targetLstar #" << xsz <<
"/" << targetLstar.
Size());
933 targetL = targetLstar + initialL;
934 FD_WARN(
"OmegaControlledLiveness(): [POBS] ---- iterate targetL #" << targetL.
Size());
940 domain=domainL-rPlantMarking;
941 FD_WARN(
"OmegaControlledLiveness(): [POBS] --- iterate domain #" << domain.
Size());
947 FD_WPC(1,2,
"OmegaControlledLiveness(): [POBS] iterating reverse dynamics");
953 target = targetL + (target1-rPlantMarking);
956 FD_WARN(
"OmegaControlledLiveness(): [POBS] -- evaluate theta for target/domain # "
957 << target.
Size() <<
"/" << domain.
Size());
962 StateSet::Iterator sit = full.
Begin();
963 StateSet::Iterator sit_end = full.
End();
964 for(;sit!=sit_end;++sit) {
965 Idx cx=rControllerStatesMap[*sit];
972 for(;tit!=tit_end; ++tit) {
973 if(disable.
Exists(tit->Ev))
continue;
974 if(target.
Exists(tit->X2)) {enable.
Insert(tit->Ev); pass =
true;
continue;}
975 if(domain.
Exists(tit->X2)) {
continue;}
976 if(!rCAlph.
Exists(tit->Ev)){ fail =
true;
break;}
981 if(controlsT.find(cx)==controlsT.end()) {
982 if(controls1.find(cx)!=controls1.end())
983 controlsT[cx].merge(controls1[cx]);
984 if(controls1L.find(cx)!=controls1L.end())
985 controlsT[cx].merge(controls1L[cx]);
986 if(controls1X.find(cx)!=controls1X.end())
987 controlsT[cx].merge(controls1X[cx]);
990 controlsT[cx].disable_all.InsertSet(disable);
991 controlsT[cx].enable_one.insert(enable);
996 std::map< Idx , MCtrlPattern >::iterator cpit=controlsT.begin();
997 std::map< Idx , MCtrlPattern >::iterator cpit_end=controlsT.end();
998 while(cpit!=cpit_end) {
999 if(cpit->second.conflict()) {controlsT.erase(cpit++);
continue;}
1000 controls1[cpit->first].merge(cpit->second);
1007 for(;sit!=sit_end;++sit) {
1010 Idx cx=rControllerStatesMap[*sit];
1011 if(controls1.find(cx)==controls1.end())
continue;
1012 disable=controls1[cx].disable_all;
1015 for(;tit!=tit_end; ++tit) {
1016 if(disable.
Exists(tit->Ev))
continue;
1017 if(target.
Exists(tit->X2)) {pass =
true;
continue;}
1018 if(domain.
Exists(tit->X2)) {
continue;}
1029 if(target1.
Size()==t1sz)
break;
1030 if(target1.
Size()==fsz)
break;
1033 FD_WARN(
"OmegaControlledLiveness(): [POBS] -- mu-target1 # " << target1.
Size());
1037 if(domainL.
Size()==dsz)
break;
1038 if(domainL.
Size()==0)
break;
1041 FD_WARN(
"OmegaControlledLiveness(): [POBS] --- nu-domainL-mu-target1 # " << domainL.
Size());
1044 std::map< Idx , MCtrlPattern>::iterator cit = controls1.begin();
1045 std::map< Idx , MCtrlPattern>::iterator cit_end = controls1.end();
1046 for(;cit!=cit_end;++cit)
1047 controls1L[cit->first].merge(cit->second);
1050 initialL.InsertSet(domainL);
1051 if(initialL.Size()==t1Lsz)
break;
1052 if(initialL.Size()==fsz)
break;
1057 if(initialK.
Size()==rsz)
break;
1058 if(initialK.
Size()==0)
break;
1062 std::map< Idx , MCtrlPattern>::iterator cit = controls1L.begin();
1063 std::map< Idx , MCtrlPattern>::iterator cit_end = controls1L.end();
1064 for(;cit!=cit_end;++cit)
1065 controls1X[cit->first].merge(cit->second);
1069 if(resolved.
Size()==xsz)
break;
1070 if(resolved.
Size()==fsz)
break;
1078 FD_WARN(
"OmegaControlledLiveness(): [POBS] ---- coaccessible ok");
1080 FD_WARN(
"OmegaControlledLiveness(): [POBS] ---- complete ok");
1082 FD_WARN(
"OmegaControlledLiveness(): [POBS] ---- init state ok");
1085 StateSet::Iterator sit = resolved.
Begin();
1086 StateSet::Iterator sit_end = resolved.
End();
1087 for(;sit!=sit_end;++sit) {
1088 Idx cx=rControllerStatesMap[*sit];
1090 rFeedbackMap[*sit]= rSupCandGen.
Alphabet() - controls1X[cx].disable_all;
1117 if (
q1 < other.
q1)
return(
true);
1118 if (
q1 > other.
q1)
return(
false);
1119 if (
q2 < other.
q2)
return(
true);
1120 if (
q2 > other.
q2)
return(
false);
1136 std::map< OPSState , Idx>& rProductCompositionMap,
1139 FD_DF(
"OmegaSupConProduct(" << &rPlantGen <<
"," << &rSpecGen <<
")");
1147 FD_DF(
"OmegaSupConProduct: plant got no initial states. "
1148 <<
"parallel composition contains empty language.");
1152 FD_DF(
"OmegaSupConProduct: spec got no initial states. "
1153 <<
"parallel composition contains empty language.");
1158 std::stack< OPSState > todo;
1162 Idx currentt, nextt;
1164 std::map< OPSState, Idx>::iterator rcit;
1173 todo.push(currentp);
1175 rProductCompositionMap[currentp] = currentt;
1178 FD_DF(
"OmegaSupConProduct: processing reachable states:");
1179 while(!todo.empty()) {
1183 FD_WPC(rProductCompositionMap.size(),rProductCompositionMap.size()+todo.size(),
"OmegaSupConProduct(): processing");
1184 FD_DF(
"OmegaSupConProduct(): processing" << rProductCompositionMap.size() <<
" " << todo.size());
1186 currentp = todo.top();
1187 currentt = rProductCompositionMap[currentp];
1190 if(critical.
Exists(currentt))
continue;
1192 FD_DF(
"OmegaSupConProduct: processing (" << currentp.
Str() <<
" -> " << currentt <<
")");
1201 while((ptit != ptit_end) && (stit != stit_end)) {
1202 FD_DF(
"OmegaSupConProduct: current plant-transition: " << rPlantGen.
TStr(*ptit) );
1203 FD_DF(
"OmegaSupConProduct: current spec-transition: " << rSpecGen.
TStr(*stit));
1205 if(ptit->Ev == stit->Ev) {
1213 rcit = rProductCompositionMap.find(nextp);
1214 if(rcit != rProductCompositionMap.end()) {
1215 if(critical.
Exists(rcit->second)) {
1216 FD_DF(
"OmegaSupconOmegaParallel: common event " << rSpecGen.
EStr(stit->Ev) <<
" to a critical states");
1218 if(!rCAlph.
Exists(ptit->Ev)) {
1219 FD_DF(
"OmegaSupConProduct: critical insert" << currentt);
1220 critical.
Insert(currentt);
1227 disable.
Insert(stit->Ev);
1235 else if (ptit->Ev < stit->Ev) {
1236 FD_DF(
"SupConProduct: " << rPlantGen.
EStr(ptit->Ev) <<
" is enabled in the plant but disabled in the specification");
1238 if (!rCAlph.
Exists(ptit->Ev)) {
1239 FD_DF(
"OmegaSupConProduct: disabled event " << rPlantGen.
EStr(ptit->Ev) <<
" is uncontrollable");
1240 FD_DF(
"OmegaSupConProduct: critical insert" << currentt);
1241 critical.
Insert(currentt);
1247 FD_DF(
"OmegaSupConProduct: incrementing plant transrel");
1252 FD_DF(
"OmegaSupConProduct: incrementing spec transrel");
1257 while (ptit != ptit_end) {
1258 FD_DF(
"OmegaSupConProduct: current g-transition: " << rPlantGen.
TStr(*ptit));
1259 FD_DF(
"OmegaSupConProduct: current h-transition: end");
1261 if (!rCAlph.
Exists(ptit->Ev)) {
1262 FD_DF(
"OmegaSupConProduct: asynchron executed uncontrollable "
1263 <<
"event " << rPlantGen.
EStr(ptit->Ev) <<
" leaves specification:");
1264 FD_DF(
"SupConProduct: critical insert" << rPlantGen.
SStr(currentt));
1265 critical.
Insert(currentt);
1269 FD_DF(
"OmegaSupConProduct: incrementing g transrel");
1274 if(critical.
Exists(currentt))
continue;
1277 FD_DF(
"OmegaSupConProduct(): processing pass2");
1283 while((ptit != ptit_end) && (stit != stit_end)) {
1284 FD_DF(
"OmegaSupConProduct: current plant-transition: " << rPlantGen.
TStr(*ptit) );
1285 FD_DF(
"OmegaSupConProduct: current spec-transition: " << rSpecGen.
TStr(*stit));
1287 if(ptit->Ev == stit->Ev) {
1288 if(!disable.
Exists(stit->Ev)) {
1289 FD_DF(
"OmegaSupConProduct: executing common event " << rPlantGen.
EStr(ptit->Ev));
1297 rcit = rProductCompositionMap.find(nextp);
1299 if(rcit == rProductCompositionMap.end()) {
1302 rProductCompositionMap[nextp] = nextt;
1306 FD_DF(
"OmegaSupConProduct: todo push: (" << nextp.
Str() <<
") -> " << nextt);
1308 nextt = rcit->second;
1311 FD_DF(
"OmegaSuperParallel: add transition to new generator: " << rResGen.
TStr(
Transition(currentt, ptit->Ev, nextt)));
1319 else if (ptit->Ev < stit->Ev) {
1330 FD_DF(
"OmegaSupConProduct: deleting critical states: " << critical.
ToString());
1334 std::map< OPSState , Idx>::iterator cit = rProductCompositionMap.begin();
1335 while(cit != rProductCompositionMap.end())
1336 if(!rResGen.
ExistsState(cit->second)) rProductCompositionMap.erase(cit++);
1352 FD_DF(
"OmegaSupConNBUnchecked(\"" << rPlantGen.
Name() <<
"\", \"" << rSpecGen.
Name() <<
"\")");
1356 if(&rResGen== &rPlantGen || &rResGen== &rSpecGen) {
1357 pResGen= rResGen.
New();
1363 FD_DF(
"OmegaSupConNB: controllable events: " << rCAlph.
ToString());
1366 std::map< OPSState , Idx> cmap;
1370 rPlantMarking.
Clear();
1371 std::map< OPSState, Idx>::iterator pcit;
1372 for(pcit=cmap.begin(); pcit!=cmap.end(); ++pcit)
1374 rPlantMarking.
Insert(pcit->second);
1377 #ifdef FAUDES_DEBUG_FUNCTION
1378 std::map< OPSState, Idx>::iterator dcit;
1379 for(dcit=cmap.begin(); dcit!=cmap.end(); ++dcit) {
1380 Idx x1=dcit->first.q1;
1381 Idx x2=dcit->first.q2;
1382 bool m1requ=dcit->first.m1required;
1383 Idx x12=dcit->second;
1385 std::string name1= rPlantGen.
StateName(x1);
1387 std::string name2= rSpecGen.
StateName(x2);
1390 if(m1requ) name12= name1 +
"|" + name2 +
"|r1m";
1391 else name12= name1 +
"|" + name2 +
"|r2m";
1397 #ifdef FAUDES_DEBUG_FUNCTION
1399 pResGen->
Write(
"tmp_syn_xxx_"+pResGen->
Name()+
".gen");
1406 if(pResGen->
Empty())
break;
1410 FD_WARN(
"OmegaSupConNB: iterate: do prefix con on #" << pResGen->
Size());
1412 FD_WARN(
"OmegaSupConNB: iterate: do coaccessible on #" << pResGen->
Size());
1414 FD_WARN(
"OmegaSupConNB: iterate: do accessible on #" << pResGen->
Size());
1416 FD_WARN(
"OmegaSupConNB: iterate: do complete on #" << pResGen->
Size());
1418 if(pResGen->
Size() == count1)
break;
1419 if(pResGen->
Size() == 0)
break;
1423 FD_WARN(
"OmegaSupConNB: iterate: do controlled liveness on #" << pResGen->
Size());
1425 if(pResGen->
Size() == count2)
break;
1429 std::map< OPSState, Idx>::iterator rcit;
1431 for(rcit=cmap.begin(); rcit!=cmap.end(); rcit++) {
1432 Idx x1=rcit->first.q1;
1433 Idx x2=rcit->first.q2;
1434 bool m1requ=rcit->first.m1required;
1435 Idx x12=rcit->second;
1437 std::string name1= rPlantGen.
StateName(x1);
1439 std::string name2= rSpecGen.
StateName(x2);
1442 if(m1requ) name12= name1 +
"|" + name2 +
"|r1m";
1443 else name12= name1 +
"|" + name2 +
"|r2m";
1453 if(pResGen != &rResGen) {
1454 pResGen->
Move(rResGen);
1458 FD_WARN(
"OmegaSupConNB: return #" << rResGen.
Size());
1469 std::map< Idx , Idx >& rObserverStateMap,
1470 std::map< Idx , EventSet>& rFeedbackMap,
1473 FD_WARN(
"OmegaSupConNormNB(\"" << rPlantGen.
Name() <<
"\", \"" << rSpecGen.
Name() <<
"\")");
1477 if(&rResGen== &rPlantGen || &rResGen== &rSpecGen) {
1478 pResGen= rResGen.
New();
1484 FD_WARN(
"OmegaSupConNormNB: controllable events: " << rCAlph.
ToString());
1485 FD_WARN(
"OmegaSupConNormNB: un-observabel events: " << (rPlantGen.
Alphabet()-rOAlph).ToString());
1488 std::map< OPSState , Idx> cmap;
1496 rPlantMarking.
Clear();
1497 std::map< OPSState, Idx>::iterator pcit;
1498 for(pcit=cmap.begin(); pcit!=cmap.end(); ++pcit)
1500 rPlantMarking.
Insert(pcit->second);
1507 std::map< std::pair<Idx,Idx>,
Idx> rObserverCompositionMap;
1508 Product(*pResGen, obsG, rObserverCompositionMap, *pResGen);
1511 std::map< std::pair<Idx,Idx>,
Idx>::iterator cit;
1512 for(cit=rObserverCompositionMap.begin(); cit!=rObserverCompositionMap.end();++cit)
1513 if(rPlantMarking.
Exists(cit->first.first)) fixmarking.
Insert(cit->second);
1514 rPlantMarking=fixmarking;
1516 std::map< std::pair<Idx,Idx>,
Idx>::iterator sit;
1517 for(sit=rObserverCompositionMap.begin(); sit!=rObserverCompositionMap.end();++sit)
1518 rObserverStateMap[sit->second]=sit->first.second;
1520 #ifdef FAUDES_DEBUG_FUNCTION
1522 pResGen->
Write(
"tmp_syn_xxx_"+pResGen->
Name()+
".gen");
1526 FD_WARN(
"OmegaSupConNormNB(): cand #" << pResGen->
Size() <<
" obs #" << obsG.
Size());
1530 if(pResGen->
Empty())
break;
1534 FD_WARN(
"OmegaSupConNormNB: iterate: do prefix-contr on #" << pResGen->
Size());
1536 FD_WARN(
"OmegaSupConNormNB: iterate: do accessible on #" << pResGen->
Size());
1538 FD_WARN(
"OmegaSupConNormNB: iterate: do coaccessible on #" << pResGen->
Size());
1540 FD_WARN(
"OmegaSupConNormNB: iterate: do prefix-norm on #" << pResGen->
Size());
1542 FD_WARN(
"OmegaSupConNormNB: iterate: do coaccessible on #" << pResGen->
Size());
1544 FD_WARN(
"OmegaSupConNormNB: iterate: do accessible on #" << pResGen->
Size());
1546 FD_WARN(
"OmegaSupConNormNB: iterate: do complete on #" << pResGen->
Size());
1548 if(pResGen->
Size() == count1)
break;
1549 if(pResGen->
Size() == 0)
break;
1553 FD_WARN(
"OmegaSupConNormNB: iterate: do controlled liveness on #" << pResGen->
Size());
1556 std::map< Idx , Idx>::iterator oit = rObserverStateMap.begin();
1557 while(oit != rObserverStateMap.end())
1558 if(!pResGen->
ExistsState(oit->first)) rObserverStateMap.erase(oit++);
1560 std::set< Idx > ostates;
1561 for(oit = rObserverStateMap.begin(); oit != rObserverStateMap.end(); ++oit)
1562 ostates.insert(oit->second);
1565 FD_WARN(
"OmegaSupConNormNB(): cand #" << pResGen->
Size() <<
" obs #" << ostates.size());
1566 std::map< Idx , EventSet> feedback;
1569 if(pResGen->
Size() == count2)
break;
1573 if(pResGen != &rResGen) {
1574 pResGen->
Move(rResGen);
1612 if(&rResGen== &rPlantGen || &rResGen== &rSpecGen) {
1613 pResGen= rResGen.
New();
1620 if(pResGen != &rResGen) {
1621 pResGen->
Move(rResGen);
1640 std::map< Idx , EventSet> feedback;
1644 StateSet::Iterator sit_end = rResGen.
StatesEnd();
1645 for(;sit!=sit_end;++sit) {
1646 const EventSet& pattern = feedback[*sit];
1649 while(tit!=tit_end) {
1650 if(pattern.
Exists(tit->Ev)) { tit++;
continue;};
1660 throw Exception(
"OmegaConNB(..)",
"ERROR: controllability test failed", 500);
1663 throw Exception(
"OmegaConNB(..)",
"ERROR: rel. top. closedness test failed", 500);
1679 if(&rResGen== &rPlantGen || &rResGen== &rSpecGen) {
1680 pResGen= rResGen.
New();
1687 if(pResGen != &rResGen) {
1688 pResGen->
Move(rResGen);
1705 std::map< Idx , Idx> constates;
1706 std::map< Idx , EventSet> feedback;
1722 if(&rResGen== &rPlantGen || &rResGen== &rSpecGen) {
1723 pResGen= rResGen.
New();
1730 if(pResGen != &rResGen) {
1731 pResGen->
Move(rResGen);
1749 std::map< Idx , Idx> cxmap;
1750 std::map< Idx , EventSet> feedback;
1756 StateSet::Iterator sit_end = rResGen.
StatesEnd();
1757 for(;sit!=sit_end;++sit) {
1759 const EventSet& pattern = feedback[*sit];
1762 while(tit!=tit_end) {
1763 if(pattern.
Exists(tit->Ev)) { tit++;
continue;};
1772 throw Exception(
"OmegaConNormNB(..)",
"ERROR: controllability test failed", 500);
1775 throw Exception(
"OmegaConNormNB(..)",
"ERROR: rel. top. closedness test failed", 500);
1783 throw Exception(
"OmegaConNormNB(..)",
"ERROR: prefix normality test failed", 500);
1799 if(&rResGen== &rPlantGen || &rResGen== &rSpecGen) {
1800 pResGen= rResGen.
New();
1807 if(pResGen != &rResGen) {
1808 pResGen->
Move(rResGen);
#define FD_WPC(cntnow, contdone, message)
std::set< EventSet > enable_one
void merge(const MCtrlPattern &other)
bool Exists(const Idx &rIndex) const
virtual void InsertSet(const NameSet &rOtherSet)
bool Insert(const Idx &rIndex)
bool operator<(const OPSState &other) const
OPSState(const Idx &rq1, const Idx &rq2, const bool &rf)
TBaseSet< Transition, TransSort::X1EvX2 >::Iterator Iterator
const TaEventSet< EventAttr > & Alphabet(void) const
EventSet ControllableEvents(void) const
EventSet ObservableEvents(void) const
void DWrite(const Type *pContext=0) const
std::string ToString(const std::string &rLabel="", const Type *pContext=0) const
void Write(const Type *pContext=0) const
StateSet::Iterator StatesBegin(void) const
StateSet::Iterator InitStatesBegin(void) const
bool SetTransition(Idx x1, Idx ev, Idx x2)
const StateSet & MarkedStates(void) const
const EventSet & Alphabet(void) const
virtual void Move(vGenerator &rGen)
bool InitStatesEmpty(void) const
EventSet ActiveEventSet(Idx x1) const
const StateSet & InitStates(void) const
TransSet::Iterator TransRelBegin(void) const
void ClrTransition(Idx x1, Idx ev, Idx x2)
void WriteStateSet(const StateSet &rStateSet) const
bool IsComplete(void) const
virtual vGenerator * New(void) const
void InjectMarkedStates(const StateSet &rNewMarkedStates)
Idx MarkedStatesSize(void) const
bool ExistsState(Idx index) const
bool IsCoaccessible(void) const
std::string TStr(const Transition &rTrans) const
std::string StateName(Idx index) const
void Name(const std::string &rName)
StateSet::Iterator StatesEnd(void) const
void DelStates(const StateSet &rDelStates)
TransSet::Iterator TransRelEnd(void) const
std::string EStr(Idx index) const
void SetMarkedState(Idx index)
virtual void EventAttributes(const EventSet &rEventSet)
bool StateNamesEnabled(void) const
std::string SStr(Idx index) const
bool ExistsMarkedState(Idx index) const
std::string UniqueStateName(const std::string &rName) const
const StateSet & States(void) const
void InjectAlphabet(const EventSet &rNewalphabet)
bool Exists(const T &rElem) const
virtual void RestrictSet(const TBaseSet &rOtherSet)
virtual void InsertSet(const TBaseSet &rOtherSet)
Iterator Begin(void) const
void Complete(vGenerator &rGen)
bool LanguageInclusion(const Generator &rGen1, const Generator &rGen2)
bool IsOmegaTrim(const vGenerator &rGen)
void Product(const Generator &rGen1, const Generator &rGen2, Generator &rResGen)
void MarkAllStates(vGenerator &rGen)
void Project(const Generator &rGen, const EventSet &rProjectAlphabet, Generator &rResGen)
void InvProject(Generator &rGen, const EventSet &rProjectAlphabet)
bool IsDeterministic(const vGenerator &rGen)
bool IsControllable(const Generator &rPlantGen, const EventSet &rCAlph, const Generator &rSupCandGen)
bool IsNormal(const Generator &rL, const EventSet &rOAlph, const Generator &rK)
void SupConNormClosed(const Generator &rL, const EventSet &rCAlph, const EventSet &rOAlph, const Generator &rK, Generator &rResult)
void OmegaSupConNormNB(const Generator &rPlantGen, const EventSet &rCAlph, const EventSet &rOAlph, const Generator &rSpecGen, Generator &rResGen)
bool IsRelativelyOmegaClosed(const Generator &rGenPlant, const Generator &rGenCand)
void SupConCmplClosed(const Generator &rPlantGen, const EventSet &rCAlph, const Generator &rSpecGen, Generator &rResGen)
void SupConNormCmplNB(const Generator &rL, const EventSet &rCAlph, const EventSet &rOAlph, const Generator &rK, Generator &rResult)
void OmegaSupConNB(const Generator &rPlantGen, const EventSet &rCAlph, const Generator &rSpecGen, Generator &rResGen)
bool IsOmegaControllable(const Generator &rGenPlant, const EventSet &rCAlph, const Generator &rGenCand)
void SupConCmplNB(const Generator &rPlantGen, const EventSet &rCAlph, const Generator &rSpecGen, Generator &rResGen)
void OmegaConNormNB(const Generator &rPlantGen, const EventSet &rCAlph, const EventSet &rOAlph, const Generator &rSpecGen, Generator &rResGen)
void OmegaConNB(const Generator &rPlantGen, const EventSet &rCAlph, const Generator &rSpecGen, Generator &rResGen)
void SetComposedStateNames(const Generator &rGen1, const Generator &rGen2, const std::map< std::pair< Idx, Idx >, Idx > &rCompositionMap, Generator &rGen12)
bool IsControllableUnchecked(const Generator &rPlantGen, const EventSet &rCAlph, const Generator &rSupCandGen, StateSet &rCriticalStates)
void SupConNormClosedUnchecked(const Generator &rPlantGen, const EventSet &rCAlph, const EventSet &rOAlph, Generator &rObserverGen, Generator &rSupCandGen)
void OmegaSupConNBUnchecked(const Generator &rPlantGen, const EventSet &rCAlph, const Generator &rSpecGen, StateSet &rPlantMarking, Generator &rResGen)
void OmegaSupConNormNBUnchecked(const Generator &rPlantGen, const EventSet &rCAlph, const EventSet &rOAlph, const Generator &rSpecGen, StateSet &rPlantMarking, std::map< Idx, Idx > &rObserverStateMap, std::map< Idx, EventSet > &rFeedbackMap, Generator &rResGen)
void ControlProblemConsistencyCheck(const GeneratorVector &rPlantGenVec, const EventSet &rConAlph, const GeneratorVector &rSpecGenVec)
bool IsRelativelyOmegaClosedUnchecked(const Generator &rGenPlant, const Generator &rGenCand)
void SupConClosedUnchecked(const Generator &rPlantGen, const EventSet &rCAlph, Generator &rSupCandGen)
bool OmegaControlledLiveness(Generator &rSupCandGen, const EventSet &rCAlph, const StateSet &rPlantMarking)
std::string ToStringInteger(Int number)
void SupConProduct(const Generator &rPlantGen, const EventSet &rCAlph, const Generator &rSpecGen, std::map< std::pair< Idx, Idx >, Idx > &rCompositionMap, Generator &rResGen)
void OmegaSupConProduct(const Generator &rPlantGen, const EventSet &rCAlph, const Generator &rSpecGen, std::map< OPSState, Idx > &rProductCompositionMap, Generator &rResGen)
std::string CollapsString(const std::string &rString, unsigned int len)