|
Go to the documentation of this file.
38 FD_DF( "SupNorm(" << rK. Name() << "," << rL. Name() << "," << rOAlph. Name() << ")");
53 std::string rLname=rL. Name();
69 FD_DF( "SupNorm: sizeof L U complement(K)=L-K: "<<tempgen. Size());
72 Project(tempgen,rOAlph,rResult);
74 FD_DF( "SupNorm: sizeof p(L-K): "<< rResult. Size());
76 FD_DF( "SupNorm: sizeof pinv(p(L-K)): "<<rResult. Size());
85 FD_DF( "SupNorm: sizeof K - pinv(p(L-K)) (result): "<<rResult. Size());
109 FD_DF( "CompleteSynth(" << rPlant. Name() << "," << rSpec. Name()<< ")");
116 FD_DF( "CompleteSynth::empty language specification: empty closed loop.");
117 rClosedLoop. Name( "CompeleteSynth("+rPlant. Name()+ ", "+rSpec. Name()+ ")");
127 FD_DF( "CompleteSynth:: spec size " << ClosedLoopCand. Size());
130 SupConClosed(rPlant, rCAlph, ClosedLoopCand, rClosedLoop);
132 FD_DF( "CompleteSynth: size of current result after SupCon: "<<rClosedLoop. Size());
137 FD_DF( "CompleteSynth:: failed: empty language result.");
139 rClosedLoop. Name( "CompeleteSynth("+rPlant. Name()+ ", "+rSpec. Name()+ ")");
143 FD_DF( "CompleteSynth:: candidate size " << rClosedLoop. Size());
147 if(dead_ends. Empty()) {
149 FD_DF( "CompleteSynth:: done");
150 rClosedLoop. Name( "CompeleteSynth("+rPlant. Name()+ ", "+rSpec. Name()+ ")");
155 FD_DF( "CompleteSynth:: eliminating following " << dead_ends. Size() << " dead ends");
161 ClosedLoopCand=rClosedLoop;
164 FD_DF( "CompleteSynth:: size of result after removing dead ends: "<<rClosedLoop. Size());
169 FD_DF( "CompleteSynth:: failed: empty language result.");
170 rClosedLoop. Name( "CompeleteSynth("+rPlant. Name()+ ", "+rSpec. Name()+ ")");
185 FD_DF( "NormalCompleteSynth(" << rPlant. Name() << "," << rSpec. Name()<< ")");
197 FD_DF( "NormalCompleteSynth:: failed: empty result after CompleteSynth().");
198 std::cout<<std::endl<< "NormalCompleteSynth:: failed: empty result after CompleteSynth().";
199 rClosedLoop. Name( "NormalCompleteSynth(" + rPlant. Name() + "," + rSpec. Name()+ ")");
204 if( IsNormal(rPlant,rOAlph,rClosedLoop)) {
205 FD_DF( "NormalCompleteSynth:: candidate supervisor is normal. success.");
206 rClosedLoop. Name( "NormalCompleteSynth(" + rPlant. Name() + "," + rSpec. Name()+ ")");
212 FD_DF( "NormalCompleteSynth:: candidate supervisor not normal. running SupNorm");
213 if(! SupNormSP(rPlant, rOAlph, rClosedLoop, Spec)) {
214 FD_DF( "NormalCompleteSynth:: failed: empty result after SupNorm().");
215 std::cout<<std::endl<< "NormalCompleteSynth:: failed: empty result after SupNorm().";
217 rClosedLoop. Name( "NormalCompleteSynth(" + rPlant. Name() + "," + rSpec. Name()+ ")");
224 FD_DF( "NormalCompleteSynth:: size of result after SupNorm(): "<<Spec. Size());
237 FD_DF( "NormalCompleteSynth(" << rPlant. Name() << "," << rSpec. Name()<< ")");
248 FD_DF( "NormalCompleteSynthNB:: failed: empty result after NormalCompleteSynth().");
249 std::cout<<std::endl<< "NormalCompleteSynthNB:: failed: empty result after NormalCompleteSynth().";
250 rClosedLoop. Name( "NormalCompleteSynthNB(" + rPlant. Name() + "," + rSpec. Name()+ ")");
255 if(rClosedLoop. IsTrim()) {
256 FD_DF( "NormalCompleteSynthNB:: candidate supervisor is trim. success.");
257 rClosedLoop. Name( "NormalCompleteSynthNB(" + rPlant. Name() + "," + rSpec. Name()+ ")");
263 FD_DF( "NormalCompleteSynthNB:: candidate supervisor not Trim. running Trim()");
266 FD_DF( "NormalCompleteSynthNB:: failed: empty result after Trim().");
267 std::cout<<std::endl<< "NormalCompleteSynthNB:: failed: empty result after Trim().";
269 rClosedLoop. Name( "NormalCompleteSynthNB(" + rPlant. Name() + "," + rSpec. Name()+ ")");
274 FD_DF( "NormalCompleteSynthNB:: size of result after Trim():"<<Spec. Size());
288 FD_DF( "HioSortCL(...)");
290 #ifdef FAUDES_CHECKED
293 std::stringstream errstr;
294 errstr << "At least one empty parameter.";
295 throw Exception( "HioSortCL", errstr.str(), 0);
304 EventSet::Iterator evit;
306 for (evit = rUc. Begin(); evit != rUc. End(); ++evit) {
310 for (evit = rYp. Begin(); evit != rYp. End(); ++evit) {
314 for (evit = rUp. Begin(); evit != rUp. End(); ++evit) {
318 for (evit = rYe. Begin(); evit != rYe. End(); ++evit) {
322 for (evit = rUe. Begin(); evit != rUe. End(); ++evit) {
326 #ifdef FAUDES_CHECKED
328 if (!errevents. Empty()){
329 std::stringstream errstr;
330 errstr << "Non-disjoint parameters; ambiguous events:\n" <<errevents. ToString();
331 throw Exception( "HioSortCL", errstr.str(), 0);
353 for (evit = rYp. Begin(); evit != rYp. End(); ++evit) {
357 for (evit = rYc. Begin(); evit != rYc. End(); ++evit) {
361 for (evit = rUc. Begin(); evit != rUc. End(); ++evit) {
365 for (evit = rUp. Begin(); evit != rUp. End(); ++evit) {
370 for (evit = rYe. Begin(); evit != rYe. End(); ++evit) {
374 for (evit = rUe. Begin(); evit != rUe. End(); ++evit) {
386 const std::string& rErrState1,
387 const std::string& rErrState2,
389 Idx& rErrState2Idx) {
390 FD_DF( "HioFreeInput( [generator] " << rGen. Name() << ")");
393 if(&rResGen== &rGen) {
394 pResGen= rResGen. New();
397 #ifdef FAUDES_CHECKED
399 if(rInput. Empty() || !((rInput*rOutput).Empty())) {
400 std::stringstream errstr;
401 errstr << "Empty Input-alphabet or non-disjoint Input and Output.\n";
402 errstr << "Input: "<< rInput. ToString()<< "\n";
403 errstr << "Output: "<< rOutput. ToString()<< "\n";
404 errstr << "Input*Output: "<< (rInput*rOutput).ToString()<< "\n";
405 throw Exception( "HioFreeInput", errstr.str(), 0);
412 if(!StateNamesEnabled && (!rErrState1.empty()||!rErrState2.empty())) {
413 FD_WARN( "HioFreeInput: state names disabled in rResGen: error state names ignored.");
419 pResGen-> Name( "HioFreeInput("+rGen. Name()+ ")");
422 std::string errstate1;
423 if(StateNamesEnabled) {
433 EventSet::Iterator evit;
434 bool InputInserted = false;
440 if( (disabledInput!=rInput) && !disabledInput. Empty()) {
441 FD_DF( "HioFreeInput: " << *sit << " disabledInput: " << disabledInput. ToString());
442 InputInserted = true;
443 for (evit = disabledInput. Begin(); evit != disabledInput. End(); ++evit) {
451 if(StateNamesEnabled) {
452 FD_DF( "HioFreeInput(...): inserted error state 1: " << errstate1 << " with Idx: " << rErrState1Idx);
455 FD_DF( "HioFreeInput(...): inserted error state 1 with Idx: " << rErrState1Idx);
457 if(!rOutput. Empty()) {
459 std::string errstate2;
460 if(StateNamesEnabled) {
463 FD_DF( "HioFreeInput(...): inserted error state 2: " << errstate2);
467 FD_DF( "HioFreeInput(...): inserted error state 2 with Idx: " << rErrState2Idx);
471 for (evit = rInput. Begin(); evit != rInput. End(); ++evit) {
475 for (evit = rOutput. Begin(); evit != rOutput. End(); ++evit) {
485 if(pResGen != &rResGen) {
486 pResGen-> Move(rResGen);
497 const std::string& rErrState1,
498 const std::string& rErrState2) {
499 Idx errstate1,errstate2;
500 HioFreeInput(rGen,rInput,rOutput,rResGen,rErrState1,rErrState2,errstate1,errstate2);
511 std::string ErrState1,ErrState2;
512 HioFreeInput(rGen,rInput,rOutput,rResGen,ErrState1,ErrState2);
521 FD_DF( "HioFreeInput( [plant] " << rPlant. Name() << ")");
525 Idx errstateUp,errstateUe,errstate2;
526 std::string ErrState1,ErrState2;
535 HioFreeInput(rPlant,uP,NoOutput,rResPlant,ErrState1,ErrState2,errstateUp,errstate2);
538 HioFreeInput(rResPlant,uE,NoOutput,rResPlant,ErrState1,ErrState2,errstateUe,errstate2);
557 FD_DF( "HioFreeInput( [controller] " << rController. Name() << ")");
560 if(&rResController== &rController) {
561 pResController=rResController. New();
568 std::string errStr1, errStr2;
571 Idx errIdx1, errIdx2;
574 pResController-> Assign(rController);
578 pResController-> Name( "HioFreeInput("+rController. Name()+ ")");
587 if(StateNamesEnabled) {
595 pResController-> SetErr(errIdx1);
598 pResController-> SetQUp(errIdx1);
601 StateSet::Iterator sit=pResController-> StatesBegin();
602 EventSet::Iterator evit;
603 bool InputInserted = false;
604 for(;sit!=pResController-> StatesEnd();sit++){
608 disabledInput = UcEvents - active;
611 if( (disabledInput!=UcEvents) && !disabledInput. Empty()) {
613 InputInserted = true;
614 for (evit = disabledInput. Begin(); evit != disabledInput. End(); ++evit) {
619 disabledInput = YpEvents - active;
622 if( (disabledInput!=YpEvents) && !disabledInput. Empty()) {
624 InputInserted = true;
625 for (evit = disabledInput. Begin(); evit != disabledInput. End(); ++evit) {
634 std::string errstate2;
635 if(StateNamesEnabled) {
636 FD_DF( "HioFreeInput(...): inserted error state 1: " << errStr1);
639 FD_DF( "HioFreeInput(...): inserted error state 2: " << errStr2);
642 FD_DF( "HioFreeInput(...): inserted error state 1 with Idx: " << errIdx1);
644 FD_DF( "HioFreeInput(...): inserted error state 2 with Idx: " << errIdx2);
648 pResController-> SetErr(errIdx2);
650 pResController-> SetQYp(errIdx2);
653 for (evit = UpEvents. Begin(); evit != UpEvents. End(); ++evit) {
657 for (evit = YpEvents. Begin(); evit != YpEvents. End(); ++evit) {
668 if(pResController != &rResController) {
669 pResController-> Move(rResController);
670 delete pResController;
673 rResController. SetYc(YcEvents);
674 rResController. SetUc(UcEvents);
675 rResController. SetYp(YpEvents);
676 rResController. SetUp(UpEvents);
684 FD_DF( "HioFreeInput( [environment] " << rEnvironment. Name() << ")");
687 if(&rResEnvironment== &rEnvironment) {
688 pResEnvironment=rResEnvironment. New();
695 std::string errStr1, errStr2;
698 Idx errIdx1, errIdx2;
701 pResEnvironment-> Assign(rEnvironment);
705 pResEnvironment-> Name( "HioFreeInput("+rEnvironment. Name()+ ")");
714 if(StateNamesEnabled) {
723 pResEnvironment-> SetErr(errIdx1);
725 pResEnvironment-> SetQUe(errIdx1);
728 StateSet::Iterator sit=pResEnvironment-> StatesBegin();
729 EventSet::Iterator evit;
730 bool InputInserted = false;
731 for(;sit!=pResEnvironment-> StatesEnd();sit++){
735 disabledInput = UlEvents - active;
738 if( (disabledInput!=UlEvents) && !disabledInput. Empty()) {
740 InputInserted = true;
741 for (evit = disabledInput. Begin(); evit != disabledInput. End(); ++evit) {
746 disabledInput = YeEvents - active;
749 if( (disabledInput!=YeEvents) && !disabledInput. Empty()) {
751 InputInserted = true;
752 for (evit = disabledInput. Begin(); evit != disabledInput. End(); ++evit) {
761 std::string errstate2;
762 if(StateNamesEnabled) {
763 FD_DF( "HioFreeInput(...): inserted error state 1: " << errStr1);
766 FD_DF( "HioFreeInput(...): inserted error state 2: " << errStr2);
769 FD_DF( "HioFreeInput(...): inserted error state 1 with Idx: " << errIdx1);
771 FD_DF( "HioFreeInput(...): inserted error state 2 with Idx: " << errIdx2);
775 pResEnvironment-> SetErr(errIdx2);
777 pResEnvironment-> SetQYe(errIdx2);
780 for (evit = UeEvents. Begin(); evit != UeEvents. End(); ++evit) {
784 for (evit = YeEvents. Begin(); evit != YeEvents. End(); ++evit) {
794 if(pResEnvironment != &rResEnvironment) {
795 pResEnvironment-> Move(rResEnvironment);
796 delete pResEnvironment;
799 rResEnvironment. SetYl(YlEvents);
800 rResEnvironment. SetUl(UlEvents);
801 rResEnvironment. SetYe(YeEvents);
802 rResEnvironment. SetUe(UeEvents);
812 Idx errstate1,errstate2;
813 std::string ErrState1= "Y-Error";
814 std::string ErrState2= "ErrorQY";
818 HioFreeInput(rConstraint,y,u,rResConstraint,ErrState1,ErrState2,errstate1,errstate2);
820 rResConstraint. SetErr(errstate1);
821 rResConstraint. SetErr(errstate2);
823 rResConstraint. SetY(y);
824 rResConstraint. SetU(u);
829 FD_DF( "HioFreeInput( [single arg plant] " << rPlant. Name() << ")");
864 const std::map< std::pair<Idx,Idx>, Idx >& rMapOrigToResult,
868 std::map< Idx, std::pair<Idx,Idx> > mapResultToOrig;
869 std::map< std::pair<Idx,Idx>, Idx >::const_iterator iter;
870 for( iter = rMapOrigToResult.begin(); iter != rMapOrigToResult.end(); ++iter ) {
871 mapResultToOrig.insert(std::make_pair( iter->second, iter->first ));
876 StateSet::Iterator sit;
877 std::map< Idx, Idx > rGen1Clones,rGen2Clones;
878 for(sit = nonmarked. Begin(); sit != nonmarked. End(); sit ++) {
894 std::map<Idx,Idx>::iterator cloneit;
895 bool x1hasGen1Clone,x1hasGen2Clone, x2hasClone;
896 for(;tit!=tit_end;tit++) {
898 x1hasGen1Clone= false;
899 x1hasGen2Clone= false;
907 cloneit=rGen1Clones.find(tit->X1);
908 if(cloneit!=rGen1Clones.end()) x1hasGen1Clone= true;
909 cloneit=rGen2Clones.find(tit->X1);
910 if(cloneit!=rGen2Clones.end()) x1hasGen2Clone= true;
916 cloneit=rGen1Clones.find(tit->X2);
917 if(cloneit!=rGen1Clones.end()) {
920 TransToClear. Insert(*tit);
921 TransToSet. Insert(tit->X1,tit->Ev,rGen1Clones[tit->X2]);
924 TransToSet. Insert(rGen1Clones[tit->X1],tit->Ev,rGen1Clones[tit->X2]);
927 TransToSet. Insert(rGen2Clones[tit->X1],tit->Ev,rGen1Clones[tit->X2]);
935 cloneit=rGen2Clones.find(tit->X2);
936 if(cloneit!=rGen2Clones.end()) {
939 TransToClear. Insert(*tit);
940 TransToSet. Insert(tit->X1,tit->Ev,cloneit->second);
943 TransToSet. Insert(rGen1Clones[tit->X1],tit->Ev,rGen2Clones[tit->X2]);
946 TransToSet. Insert(rGen2Clones[tit->X1],tit->Ev,rGen2Clones[tit->X2]);
955 if( (x1hasGen1Clone||x1hasGen2Clone) && !x2hasClone ) {
956 if(x1hasGen1Clone) TransToSet. Insert(rGen1Clones[tit->X1],tit->Ev,tit->X2);
957 if(x1hasGen2Clone) TransToSet. Insert(rGen2Clones[tit->X1],tit->Ev,tit->X2);
962 tit=TransToClear. Begin();
963 tit_end=TransToClear. End();
967 tit=TransToSet. Begin();
968 tit_end=TransToSet. End();
982 FD_DF( "MarkAlternationAB()");
984 #ifdef FAUDES_CHECKED
987 std::stringstream errstr;
988 errstr << "Empty parameter rAset.";
989 throw Exception( "CheapAltAnB", errstr.str(), 0);
992 std::stringstream errstr;
993 errstr << "Empty parameter rBset.";
994 throw Exception( "CheapAltAnB", errstr.str(), 0);
1009 EventSet::Iterator evit=rAset. Begin();
1010 EventSet::Iterator evit_end=rAset. End();
1011 for(;evit!=evit_end;++evit) {
1019 evit_end=rBset. End();
1020 for(;evit!=evit_end;++evit) {
1039 FD_DF( "HioShuffle()");
1048 std::map< std::pair<Idx,Idx>, Idx > MapOrigToResult;
1049 Parallel(rPlantA,rPlantB,MapOrigToResult,parallel1);
1056 Idx state1,state2,state3;
1061 EventSet::Iterator evit;
1062 for (evit = A. Begin(); evit != A. End(); ++evit) {
1066 for (evit = B. Begin(); evit != B. End(); ++evit) {
1070 Parallel(parallel1,EventPairs,parallel2);
1071 parallel1 = parallel2;
1112 FD_DF( "------ HioShuffle with Environment-First-Policy! -----");
1116 StateSet::Iterator sit_end = parallel1. StatesEnd();
1118 for(; sit != sit_end; sit++)
1127 if (!(ActiveYe. Empty())&& !(ActiveYp. Empty()))
1132 for(;tit!=tit_end;tit++)
1135 if(ActiveYp. Exists(tit->Ev))
1137 TransToClear. Insert(*tit);
1140 tit=TransToClear. Begin();
1141 tit_end=TransToClear. End();
1142 for(;tit!=tit_end;tit++)
1162 HioFreeInput(parallel1, rUp, rYp, parallel2, "errYp_Ye", "errUp");
1165 HioFreeInput(parallel2, rUe, rYe, parallel1, "errYp_Ye", "errUe");
1172 Parallel(parallel2,parallel1,parallel1);
1174 rIOShuffAB = parallel1;
1175 rIOShuffAB. Name( "HioShuffle("+rPlantA. Name()+rPlantB. Name()+ ")");
1191 #ifdef FAUDES_CHECKED
1194 std::stringstream errstr;
1195 errstr << "Empty Yp alphabet\n";
1196 throw Exception( "HioShuffle", errstr.str(), 0);
1199 std::stringstream errstr;
1200 errstr << "Empty Up alphabet\n";
1201 throw Exception( "HioShuffle", errstr.str(), 0);
1204 std::stringstream errstr;
1205 errstr << "Empty Ye alphabet\n";
1206 throw Exception( "HioShuffle", errstr.str(), 0);
1209 std::stringstream errstr;
1210 errstr << "Empty Ue alphabet\n";
1211 throw Exception( "HioShuffle", errstr.str(), 0);
1215 EventSet alphabet,alphabetA,alphabetB,errevents;
1221 EventSet::Iterator evit;
1223 for (evit = rUp. Begin(); evit != rUp. End(); ++evit) {
1227 for (evit = rYe. Begin(); evit != rYe. End(); ++evit) {
1231 for (evit = rUe. Begin(); evit != rUe. End(); ++evit) {
1235 if (!errevents. Empty()){
1236 std::stringstream errstr;
1237 errstr << "Non-disjoint parameters; ambiguous events:\n" <<errevents. ToString();
1238 throw Exception( "HioShuffle", errstr.str(), 0);
1244 errevents=alphabetA+alphabetB-alphabet;
1245 if (!errevents. Empty()){
1246 std::stringstream errstr;
1247 errstr << "Plant A- or plant B-events missing in Yp,Up,Ye or Ue:\n" <<errevents. ToString();
1248 throw Exception( "HioShuffle", errstr.str(), 0);
1252 HioPlant hioPlantA= HioPlant(rPlantA,rYp*alphabetA,rUp*alphabetA,rYe*alphabetA,rUe*alphabetA);
1255 std::stringstream errstr;
1256 errstr << "plant A not in HioPlantForm:\n" << report;
1257 throw Exception( "HioShuffle", errstr.str(), 0);
1260 HioPlant hioPlantB= HioPlant(rPlantB,rYp*alphabetB,rUp*alphabetB,rYe*alphabetB,rUe*alphabetB);
1263 std::stringstream errstr;
1264 errstr << "plant B not in HioPlantForm:\n" << report;
1265 throw Exception( "HioShuffle", errstr.str(), 0);
1288 HioShuffle(rPlantA, rPlantB, yp, up, ye, ue, rIOShuffAB);
1291 rIOShuffAB. SetYp(yp);
1292 rIOShuffAB. SetUp(up);
1293 rIOShuffAB. SetYe(ye);
1294 rIOShuffAB. SetUe(ue);
1307 FD_DF( "CheapAltAnB()");
1311 std::stringstream errstr;
1312 errstr << "Parameter Depth must be 1 or greater.";
1313 throw Exception( "CheapAltAnB", errstr.str(), 0);
1315 #ifdef FAUDES_CHECKED
1317 std::stringstream errstr;
1318 errstr << "Empty parameter rAset.";
1319 throw Exception( "CheapAltAnB", errstr.str(), 0);
1322 std::stringstream errstr;
1323 errstr << "Empty parameter rBset.";
1324 throw Exception( "CheapAltAnB", errstr.str(), 0);
1340 EventSet::Iterator evit;
1341 for (evit = rBset. Begin(); evit != rBset. End(); ++evit) {
1346 for ( int i=0; i!=Depth; ++i) {
1350 for (evit = rAset. Begin(); evit != rAset. End(); ++evit) {
1355 for (evit = rBset. Begin(); evit != rBset. End(); ++evit) {
1369 FD_DF( "CheapAltAB()");
1391 FD_DF( "HioShuffle()");
1400 Parallel(rPlantA,rPlantB,parallel1);
1406 Idx state1,state2,state3;
1411 EventSet::Iterator evit;
1412 for (evit = A. Begin(); evit != A. End(); ++evit) {
1416 for (evit = B. Begin(); evit != B. End(); ++evit) {
1420 Parallel(parallel1,EventPairs,parallel2);
1475 Parallel(parallel2, AltAB, parallel1);
1528 HioFreeInput(parallel1, rUp, rYp, parallel2, "errYp_Ye", "errUp");
1531 HioFreeInput(parallel2, rUe, rYe, parallel1, "errYp_Ye", "errUe");
1534 rIOShuffAB = parallel1;
1576 const bool UnMarkedOnly,
1578 std::stack<Idx>& rSTACK,
1580 std::map<const Idx, int>& rDFN,
1581 std::map<const Idx, int>& rLOWLINK,
1582 std::set<StateSet>& rSccSet,
1585 FD_DF( "SerchYclessScc: -- search from state "<< state << "--");
1588 rNewStates. Erase(state);
1597 rLOWLINK[state]=rDFN[state];
1602 rStackStates. Insert(state);
1608 for (; it != it_end; ++it) {
1611 SuccStates. Insert(it->X2);
1616 StateSet::Iterator sit = SuccStates. Begin();
1617 StateSet::Iterator sit_end = SuccStates. End();
1618 for (; sit != sit_end; ++sit)
1621 if(rNewStates. Exists(*sit))
1625 SearchYclessScc(*sit, rcount, rGen, rYc, UnMarkedOnly, rNewStates, rSTACK, rStackStates, rDFN, rLOWLINK, rSccSet, rRoots);
1627 if(rLOWLINK[*sit]<rLOWLINK[state])
1629 rLOWLINK[state]=rLOWLINK[*sit];
1636 if((rDFN[*sit]<rDFN[state])&&(rStackStates. Exists(*sit)))
1639 if(rDFN[*sit]<rLOWLINK[state])
1641 rLOWLINK[state]=rDFN[*sit];
1647 if(rLOWLINK[state]==rDFN[state])
1652 bool realscc=rSTACK.top()!=state;
1657 for (; it != it_end; ++it)
1659 if((it->X2==state)&&(!rYc. Exists(it->Ev)))
1675 bool purelyUnMarked= true;
1681 Idx top=rSTACK.top();
1688 rStackStates. Erase(top);
1698 if(!purelyUnMarked || UnMarkedOnly)
1700 rSccSet.insert(Scc);
1717 std::set<StateSet>& rSccSet,
1720 FD_DF( "YclessScc(" << rGen. Name() << ")");
1729 std::stack<Idx> STACK;
1737 std::map<const Idx, int> DFN;
1739 std::map<const Idx, int> LOWLINK;
1744 while(!NewStates. Empty()) {
1746 if(NewStates. Exists(InitState)) {
1747 SearchYclessScc(InitState, count, rGen, rYc, false, NewStates, STACK, StackStates, DFN, LOWLINK, rSccSet, rRoots);
1749 SearchYclessScc(*NewStates. Begin(), count, rGen, rYc, false, NewStates, STACK, StackStates, DFN, LOWLINK, rSccSet, rRoots);
1753 return !rSccSet.empty();
1761 std::set<StateSet>& rSccSet,
1764 FD_DF( "YclessScc(" << rGen. Name() << ")");
1773 std::stack<Idx> STACK;
1781 std::map<const Idx, int> DFN;
1783 std::map<const Idx, int> LOWLINK;
1788 while(!NewStates. Empty()) {
1790 if(NewStates. Exists(InitState)) {
1791 SearchYclessScc(InitState, count, rGen, rYc, true, NewStates, STACK, StackStates, DFN, LOWLINK, rSccSet, rRoots);
1793 SearchYclessScc(*NewStates. Begin(), count, rGen, rYc, true, NewStates, STACK, StackStates, DFN, LOWLINK, rSccSet, rRoots);
1797 return !rSccSet.empty();
1806 std::set<StateSet>& rSccSet)
1808 FD_DF( "YclessScc(" << rGen. Name() << ")");
1814 return YclessScc(rGen,rYc,rSccSet,Roots);
1822 FD_DF( "IsYcLive(" << rGen. Name() << ")");
1824 std::set<StateSet> rSccSet;
1828 return rSccSet.size()==0;
1834 const std::set<StateSet>& rStateSets)
1836 FD_DF( "WriteStateSets()");
1837 std::cout<<std::endl;
1838 if(rStateSets.empty()) {
1839 std::cout<< "WriteStateSets: Set of state sets is empty."<<std::endl;
1840 FD_DF( "WriteStateSets: Set of state sets is empty.");
1843 std::cout<< ">WriteStateSets: Set of state sets begin:"<< std::endl;
1844 std::set<StateSet>::iterator StateSetit = rStateSets.begin();
1845 std::set<StateSet>::iterator StateSetit_end = rStateSets.end();
1846 for (; StateSetit != StateSetit_end; ++StateSetit) {
1847 std::cout<<std::endl<< " >> State set begin:"<< std::endl;
1848 StateSet::Iterator sit = StateSetit->Begin();
1849 StateSet::Iterator sit_end = StateSetit->End();
1850 for (; sit != sit_end; ++sit) {
1851 std::cout<< " >> "<<*sit<<std::endl;
1853 std::cout<< " >> State set end."<< std::endl;
1855 std::cout<<std::endl<< ">WriteStateSets: Set of state sets end."<<std::endl;
1863 const std::set<StateSet>& rStateSets)
1865 FD_DF( "WriteStateSets()");
1866 std::cout<<std::endl;
1867 if(rStateSets.empty()) {
1868 std::cout<< "WriteStateSets: Set of state sets is empty."<<std::endl;
1869 FD_DF( "WriteStateSets: Set of state sets is empty.");
1872 std::cout<< ">WriteStateSets: Set of state sets begin:"<< std::endl;
1873 std::set<StateSet>::iterator StateSetit = rStateSets.begin();
1874 std::set<StateSet>::iterator StateSetit_end = rStateSets.end();
1875 for (; StateSetit != StateSetit_end; ++StateSetit) {
1876 std::cout<<std::endl<< " >> State set begin:"<< std::endl;
1878 std::cout<< " >> State set end."<< std::endl;
1880 std::cout<<std::endl<< ">WriteStateSets: Set of state sets end."<<std::endl;
1886 const std::set<StateSet>& rSccSet,
1890 FD_DF( "SccEntries(...)");
1893 rEntryStates. Clear();
1894 rEntryTransSet. Clear();
1899 FD_DF( "SccEntries: Entry states of all SCCs:");
1902 std::set<StateSet>::iterator sccit = rSccSet.begin();
1903 std::set<StateSet>::iterator sccit_end = rSccSet.end();
1904 for ( int i=0; sccit != sccit_end; ++sccit, i++) {
1905 FD_DF( "SccEntries: SCC " << i << " begin:");
1907 StateSet::Iterator sit = sccit->Begin();
1908 StateSet::Iterator sit_end = sccit->End();
1909 for (; sit != sit_end; ++sit) {
1912 rEntryStates. Insert(*sit);
1917 for(;tit!=tit_end;tit++) {
1921 if(!sccit->Exists(tit->X1)) {
1923 rEntryTransSet. Insert(*tit);
1925 if(!rEntryStates. Exists(*sit)) {
1929 FD_DF( "SccEntries: Entry state:" <<*sit);
1930 rEntryStates. Insert(*sit);
1935 FD_DF( "SccEntries: SCC " << i << " end:");
1937 FD_DF( "SccEntries: done");
1944 std::set<StateSet>& rSccSet,
1945 const Idx EntryState,
1949 FD_DF( "CloneScc(...)");
1951 std::map<const Idx, Idx> clone;
1955 StateSet::Iterator sit=rScc. Begin();
1956 StateSet::Iterator sit_end=rScc. End();
1957 for(;sit!=sit_end;sit++) {
1975 for(;sit!=sit_end;sit++) {
1978 for(;tit!=tit_end;tit++) {
1980 if(rScc. Exists(tit->X2)) {
1989 if(rEntryStates. Exists(tit->X2)) {
1990 rEntryTransSet. Insert(clone[*sit],tit->Ev,tit->X2);
1997 TransSet TransToClear, EntryTransToInsert;
2000 for(;tit!=tit_end;tit++) {
2005 EntryTransToInsert. Insert(tit->X1,tit->Ev,clone[EntryState]);
2007 TransToClear. Insert(*tit);
2012 for(;tit2!=tit2_end;tit2++) {
2015 rEntryTransSet. Erase(*tit2);
2020 for(;tit3!=tit3_end;tit3++) {
2022 rEntryTransSet. Insert(*tit3);
2025 rEntryStates. Erase(EntryState);
2026 rEntryStates. Insert(clone[EntryState]);
2033 const Idx EntryState,
2037 FD_DF( "CloneUnMarkedScc(...)");
2039 std::map<const Idx, Idx> clone;
2043 StateSet::Iterator sit=rScc. Begin();
2044 StateSet::Iterator sit_end=rScc. End();
2045 for(;sit!=sit_end;sit++) {
2046 if(*sit != EntryState) {
2050 else clone[*sit]=*sit;
2062 bool isEntryState= false;
2064 for(;sit!=sit_end;sit++) {
2065 isEntryState=(*sit==EntryState);
2068 for(;tit!=tit_end;tit++) {
2070 if(rScc. Exists(tit->X2)) {
2075 TransToClear. Insert(*tit);
2084 if(rEntryStates. Exists(tit->X2)) {
2085 rEntryTransSet. Insert(clone[*sit],tit->Ev,tit->X2);
2093 tit=TransToClear. Begin();
2094 tit_end=TransToClear. End();
2095 for(;tit!=tit_end;tit++) {
2110 FD_DF( "YcAcyclic: Statesize before: "<<rGen. Size()<< " - starting...");
2112 std::set<StateSet> SccSet,UnMarkedSccSet;
2114 StateSet Scc,Roots,EntryStates,notRoots,UnMarkedRoots;
2127 if(! YclessScc(rResGen,rYc,SccSet,Roots)) {
2132 FD_DF( "YcAcyclic: Statesize of result: "<<rResGen. Size());
2148 SccEntries(rResGen,SccSet,EntryStates,EntryTransSet);
2152 notRoots=EntryStates - Roots;
2161 StateSet::Iterator sit=notRoots. Begin();
2162 StateSet::Iterator sit_end=notRoots. End();
2163 for(;sit!=sit_end;sit++)
2166 std::set<StateSet>::iterator sccit = SccSet.begin();
2167 std::set<StateSet>::iterator sccit_end = SccSet.end();
2168 for (; sccit != sccit_end; ++sccit)
2170 if(sccit->Exists(*sit))
2179 CloneScc(rResGen,Scc,SccSet,*sit,EntryStates,EntryTransSet);
2198 std::set<StateSet>::iterator sccit = UnMarkedSccSet.begin();
2199 std::set<StateSet>::iterator sccit_end = UnMarkedSccSet.end();
2200 for (; sccit != sccit_end; ++sccit) {
2202 if( !( ((*sccit)*EntryStates).Empty() ) ) {
2203 Idx EntryState=*(((*sccit)*EntryStates).Begin());
2217 std::set<StateSet>::iterator sccit = SccSet.begin();
2218 std::set<StateSet>::iterator sccit_end = SccSet.end();
2220 for (; sccit != sccit_end; ++sccit)
2223 StateSet::Iterator sit = sccit-> Begin();
2224 StateSet::Iterator sit_end = sccit->End();
2225 for (; sit != sit_end; ++sit)
2231 for(;tit!=tit_end;tit++)
2235 if(sccit->Exists(tit->X2) && EntryStates. Exists(tit->X2)
2239 TransToClear. Insert(*tit);
2248 for(;tit!=tit_end;tit++)
2289 FD_DF( "ConstrSynth_Beta(...)");
2296 rOpConstraint. Clear();
2299 Parallel(rPlant,rLocConstr,rOpConstraint);
2303 rOpConstraint. Clear();
2311 Project(rOpConstraint,sigmap,tmpGen);
2312 rOpConstraint. Clear();
2322 HioFreeInput(tmpGen, rYp, rUp, rOpConstraint, "errUp", "errYp");
2324 rOpConstraint. Name( "ConstrSynth_Beta("+rPlant. Name()+ ")");
2343 FD_DF( "HioSynth(...)");
2345 rController. Clear();
2353 sigmacp. InsertSet(rUc + rYc + rUp + rYp);
2355 sigmace. InsertSet(rUc + rYc + rUel + rYel);
2377 minhio = HioSortCL(rYc,rUc,rYp,rUp,rYel,rUel);
2392 FD_DF( "Size of plantspec: "<<plantspec. Size()<< " - Statemin...");
2394 FD_DF( "done. New Statesize: "<<plantspec. Size()<< ".");
2397 FD_DF( "******************** computing YcAcyclic(plantspec):");
2401 YcAcyclic(plantspec,rYc,yclifeplantspec);
2407 Parallel(yclifeplantspec,minhio,plantspec);
2408 yclifeplantspec. Clear();
2410 Parallel(plantspec,rLocConstr,plantspec);
2412 plantspec. Name( "actualspec");
2423 FD_DF( "size of closed loop before StateMin: "<<loop. Size()<< ", starting StateMin...");
2425 FD_DF( "...size of closed loop after StateMin (tmp_closedloop.gen): "<<loop. Size());
2429 FD_DF( "********* IsYcLive(closed loop): "<< IsYcLive(loop,rYc));
2433 FD_DF( "******************** external closed loop: tmp_extloop.gen");
2435 Project(loop,sigmace,extloop);
2436 FD_DF( "size of external closed loop: "<<extloop. Size());
2450 FD_DF( "******************** project closed loop: tmp_controller.gen");
2453 Project(loop,sigmacp,controller);
2459 HioFreeInput(controller, rYp, rUp, rController, "errUp", "errYp");
2461 FD_DF( "size of marked IO controller: "<<rController. Size()<< ". PrefixClosure, StateMin...");
2467 FD_WARN( "Careful: marking information of the specification has been erased from the resulting controller.");
2471 FD_DF( "...size of prefix-closed IO controller after StateMin: "<<rController. Size());
2473 rController. Name( "HioSynth("+rPlant. Name()+ ","+rSpec. Name()+ ")");
2474 FD_DF( "IO controller synthesis done. ******************** " );
2492 rController. Clear();
2494 #ifdef FAUDES_CHECKED
2497 std::stringstream errstr;
2498 errstr << "Empty Yc alphabet\n";
2499 throw Exception( "HioSynth", errstr.str(), 0);
2502 std::stringstream errstr;
2503 errstr << "Empty Uc alphabet\n";
2504 throw Exception( "HioSynth", errstr.str(), 0);
2507 std::stringstream errstr;
2508 errstr << "Empty Yp alphabet\n";
2509 throw Exception( "HioSynth", errstr.str(), 0);
2512 std::stringstream errstr;
2513 errstr << "Empty Up alphabet\n";
2514 throw Exception( "HioSynth", errstr.str(), 0);
2517 std::stringstream errstr;
2518 errstr << "Empty Ye alphabet\n";
2519 throw Exception( "HioSynth", errstr.str(), 0);
2522 std::stringstream errstr;
2523 errstr << "Empty Ue alphabet\n";
2524 throw Exception( "HioSynth", errstr.str(), 0);
2532 EventSet::Iterator evit;
2534 for (evit = rUc. Begin(); evit != rUc. End(); ++evit) {
2538 for (evit = rYp. Begin(); evit != rYp. End(); ++evit) {
2542 for (evit = rUp. Begin(); evit != rUp. End(); ++evit) {
2546 for (evit = rYel. Begin(); evit != rYel. End(); ++evit) {
2550 for (evit = rUel. Begin(); evit != rUel. End(); ++evit) {
2554 if (!errevents. Empty()){
2555 std::stringstream errstr;
2556 errstr << "Non-disjoint parameters; ambiguous events:\n" <<errevents. ToString();
2557 throw Exception( "HioSynth", errstr.str(), 0);
2564 if (!(plantEvents*specEvents==rYel+rUel)){
2565 std::stringstream errstr;
2566 errstr << "Alphabet mismatch between plant and spec:\n";
2567 errstr << "plant: " << plantEvents. ToString() << "\n";
2568 errstr << "spec: " << specEvents. ToString() << "\n";
2569 errstr << "Yel+Uel: " << (rYel+rUel).ToString() << "\n";
2570 throw Exception( "HioSynth", errstr.str(), 0);
2573 if (!(rExtConstr. Alphabet()<=specEvents)){
2574 std::stringstream errstr;
2575 errstr << "Alphabet mismatch between external constraints and spec.\n";
2576 throw Exception( "HioSynth", errstr.str(), 0);
2579 if (!(rLocConstr. Alphabet()<=plantEvents)){
2580 std::stringstream errstr;
2581 errstr << "Alphabet mismatch between internal constraints and plant.\n";
2582 throw Exception( "HioSynth", errstr.str(), 0);
2586 HioPlant spec(rSpec,rYc,rUc,rYel,rUel);
2589 std::stringstream errstr;
2590 errstr << "Spec not in HioPlantForm:\n" << report;
2591 throw Exception( "HioSynth", errstr.str(), 0);
2597 HioSynthUnchecked(rPlant,rSpec,rExtConstr,rLocConstr,rYc,rUc,rYp,rUp,rYel,rUel,rController);
2609 rController. Clear();
2611 #ifdef FAUDES_CHECKED
2617 std::stringstream errstr;
2618 errstr << "Plant not in HioPlantForm:\n" << report;
2619 throw Exception( "HioSynthMonolithic", errstr.str(), 0);
2639 HioSynth(rPlant,rSpec,extConstr,rSp,yc,uc,yp,up,ye,ue,rController);
2642 rController. SetYc(yc);
2643 rController. SetUc(uc);
2644 rController. SetYp(yp);
2645 rController. SetUp(up);
2659 rController. Clear();
2661 #ifdef FAUDES_CHECKED
2667 std::stringstream errstr;
2668 errstr << "HioShuffle not in HioPlantForm:\n" << report;
2669 throw Exception( "HioSynthHierarchical", errstr.str(), 0);
2678 std::stringstream errstr;
2679 errstr << "Environment not in HioEnvironmentForm:\n" << report;
2680 throw Exception( "HioSynthHierarchical", errstr.str(), 0);
2687 std::stringstream errstr;
2688 errstr << "Alphabet mismatch between I/O-shuffle and environment.\n";
2689 throw Exception( "HioSynthHierarchical", errstr.str(), 0);
2693 std::stringstream errstr;
2694 errstr << "Alphabet mismatch between specification and environment.\n";
2695 throw Exception( "HioSynthHierarchical", errstr.str(), 0);
2703 Parallel(rHioShuffle,rEnvironment,ioShuffParEnv);
2719 HioSynth(ioShuffParEnv,rSpec,extConstr,rIntConstr,yc,uc,yp,up,ye,ue,rController);
2722 rController. SetYc(yc);
2723 rController. SetUc(uc);
2724 rController. SetYp(yp);
2725 rController. SetUp(up);
2742 FD_DF( "HioShuffle()_Musunoi");
2745 EventSet A,B,SigmaP, Yp, Up, Ye, Ue;
2756 Parallel(rPlantA,rPlantB,parallel1);
2762 Idx state1,state2,state3;
2767 EventSet::Iterator evit;
2768 for (evit = A. Begin(); evit != A. End(); ++evit) {
2772 for (evit = B. Begin(); evit != B. End(); ++evit) {
2776 Parallel(parallel1,EventPairs,parallel2);
2811 Parallel(parallel2, AltAB, parallel1);
2823 StateSet::Iterator sit_end = parallel1. StatesEnd();
2825 for(; sit != sit_end; sit++)
2835 if (!(ActiveYe. Empty())&& !(ActiveYp. Empty()))
2840 for(;tit!=tit_end;tit++)
2843 if(ActiveYp. Exists(tit->Ev))
2845 TransToClear. Insert(*tit);
2848 tit=TransToClear. Begin();
2849 tit_end=TransToClear. End();
2850 for(;tit!=tit_end;tit++)
2865 HioFreeInput(parallel1, Up, Yp, parallel2, "errYp_Ye", "errUp");
2868 HioFreeInput(parallel2, Ue, Ye, parallel1, "errYp_Ye", "errUe");
2871 rIOShuffAB = parallel1;
2892 locconstr = rLocConstr;
2904 sigmacp. InsertSet(rUc + rYc + rUp + rYp);
2906 sigmace. InsertSet(rUc + rYc + rUe + rYe);
2920 FD_DF( "******************** actual plant: composition with environment constraint: tmp_cplant.gen ");
2927 FD_DF( "******************** mininmal hio structure: tmp_minhio.gen, composition with plant: tmp_hioplant.gen ");
2937 FD_DF( "******************** composition plant-specification: tmp_plantspec.gen ");
2941 Parallel(hiocplant,spec,plantspec);
2945 FD_DF( "Size of plantspec: "<<plantspec. Size()<< " - Statemin...");
2949 FD_DF( "done. New Statesize: "<<plantspecMin. Size()<< ".");
2950 plantspec=plantspecMin;
2951 plantspecMin. Clear();
2953 FD_DF( "******************** computing YcAcyclic(plantspec):");
2957 YcAcyclic(plantspec,yc,yclifeplantspec);
2962 yclifeplantspecMin=yclifeplantspec;
2966 FD_DF( "******************** actual spec: composition yclifeplantspec||minhio||locconstr (tmp_actualspec.gen)");
2968 Parallel(yclifeplantspecMin,minhio,plantspec);
2972 Parallel(plantspec,locconstr,actualspec);
2975 FD_DF( "******************** closed loop synthesis: tmp_closedloop.gen/.dot");
2978 FD_DF( "Starting NormalCompleteSynth....");
2986 FD_DF( "size of closed loop before StateMin: "<<loop. Size()<< ", starting StateMin...");
2989 FD_DF( "Starting NormalCompleteSynth....done... starting StateMin");
2993 FD_DF( "...size of closed loop after StateMin (tmp_closedloop.gen): "<<minloop. Size());
2999 minlooptest=minloop;
3000 std::set<StateSet> SccSet;
3003 FD_DF( "*********number of Yc-less strongly connencted components in closed loop (should be zero): "
3009 FD_DF( "******************** external closed loop: tmp_extloop.gen/.dot");
3011 Project(minloop,sigmace,extloop);
3012 FD_DF( "size of external closed loop: "<<extloop. Size());;
3016 FD_DF( "External closed loop meets specification.");
3019 FD_DF( "External closed loop EQUALS specification.");
3026 FD_DF( "******************** project closed loop: tmp_controller.gen/.dot ");
3029 Project(minloop,sigmacp,controller);
3034 FD_DF( "******************** extend to IO controller: tmp_IOcontroller.gen/.dot ");
3043 FD_DF( "...size of IO controller after StateMin: "<<minIOcontroller. Size());
3048 rController = minIOcontroller;
3066 FD_DF( "IO controller synthesis done. ******************** " );
#define FD_WARN(message) Debug: always report warnings.
#define FD_DF(message) Debug: optional report on user functions.
Idx Insert(void) Insert new index to set.
Set of indices with symbolic names.
bool Exists(const Idx &rIndex) const Test existence of index.
void SymbolicName(Idx index, const std::string &rName) Set new name for existing index.
virtual void InsertSet(const NameSet &rOtherSet) Inserts all elements of rOtherSet.
bool Insert(const Idx &rIndex) Add an element by index.
void RestrictSet(const NameSet &rOtherSet) Restrict to elements specified by rOtherSet.
Iterator class for high-level api to TBaseSet.
EventSet UEvents(void) const Get EventSet with U-events.
void SetErr(Idx index) Mark state as Err-state (by index)
void SetU(Idx index) Mark event U-event(by index)
void SetY(Idx index) Mark event as Y-event (by index)
EventSet YEvents(void) const Get EventSet with Y-events.
EventSet YcEvents(void) const Get EventSet with Yc-events.
void SetErr(Idx index) Mark state as Err-state (by index)
void SetYp(Idx index) Mark event as Yp-event (by index)
void SetYc(Idx index) Mark event as Yc-event (by index)
void SetUc(Idx index) Mark event as Uc-event (by index)
EventSet UcEvents(void) const Get EventSet with Uc-events.
EventSet YpEvents(void) const Get EventSet with Yp-events.
void SetQYp(Idx index) Mark state as QYP-state (by index)
THioController * New(void) const Construct on heap.
void SetQUp(Idx index) Mark event as QUp-state (by index)
void SetUp(Idx index) Mark event Up-event(by index)
EventSet UpEvents(void) const Get EventSet with Up-events.
void SetUl(Idx index) Mark event as Ul-event (by index)
void SetYe(Idx index) Mark event as Ye-event (by index)
void SetQUe(Idx index) Mark event as QUe-state (by index)
void SetQYe(Idx index) Mark event as QYe-state (by index)
EventSet UeEvents(void) const Get EventSet with Ue-events.
void SetYl(Idx index) Mark event as Yl-event (by index)
EventSet YeEvents(void) const Get EventSet with Ye-events.
EventSet LEvents(void) const Get EventSet with E-events.
EventSet UlEvents(void) const Get EventSet with Ul-events.
void SetErr(Idx index) Mark state as Err-state (by index)
EventSet YlEvents(void) const Get EventSet with Yl-events.
THioEnvironment * New(void) const Construct on heap.
EventSet EEvents(void) const Get EventSet with P-events.
void SetUe(Idx index) Mark event Ue-event(by index)
void SetYp(Idx index) Mark event as Yp-event (by index)
EventSet EEvents(void) const Get EventSet with E-events.
void SetErr(Idx index) Mark state as Err-state (by index)
void SetYe(Idx index) Mark event as Ye-event (by index)
EventSet UeEvents(void) const Get EventSet with Ue-events.
EventSet UpEvents(void) const Get EventSet with Up-events.
void SetUp(Idx index) Mark event Up-event(by index)
EventSet YpEvents(void) const Get EventSet with Yp-events.
EventSet YeEvents(void) const Get EventSet with Ye-events.
void SetUe(Idx index) Mark event as Ue-event (by index)
Iterator Begin(void) const Iterator to begin of set.
Iterator End(void) const Iterator to end of set.
EventSet ActiveEvents(Idx x1, SymbolTable *pSymTab=NULL) const Get set of events that are active for a specified current state Since a transition set does not refer...
Iterator BeginByX2(Idx x2) const Iterator to first Transition specified by successor state x2.
bool Insert(const Transition &rTransition) Add a Transition.
Iterator EndByX2(Idx x2) const Iterator to first Transition after specified successor state x2.
bool Erase(const Transition &t) Remove a Transition.
TBaseSet< Transition, TransSort::X1EvX2 >::Iterator Iterator Iterator on transition.
virtual void Clear(void) Clear generator data.
virtual TaGenerator & Assign(const Type &rSrc) Copy from other faudes Type (try to cast to agenerator or pass to base)
virtual void Move(TaGenerator &rGen) Destructive copy to other TaGenerator Copy method with increased performance at the cost of invalidat...
const TaEventSet< EventAttr > & Alphabet(void) const Return const reference to alphabet.
bool SetTransition(Idx x1, Idx ev, Idx x2) Add a transition to generator by indices.
std::string ToString(const std::string &rLabel="", const Type *pContext=0) const Write configuration data to a string.
Base class of all FAUDES generators.
StateSet::Iterator StatesBegin(void) const Iterator to Begin() of state set.
StateSet::Iterator InitStatesBegin(void) const Iterator to Begin() of mInitStates.
const TransSet & TransRel(void) const Return reference to transition relation.
bool SetTransition(Idx x1, Idx ev, Idx x2) Add a transition to generator by indices.
const StateSet & MarkedStates(void) const Return const ref of marked states.
const EventSet & Alphabet(void) const Return const reference to alphabet.
Idx InsMarkedState(void) Create new anonymous state and set as marked state.
virtual void Move(vGenerator &rGen) Destructive copy to other vGenerator.
bool InitStatesEmpty(void) const Check if set of initial states are empty.
EventSet ActiveEventSet(Idx x1) const Return active event set at state x1.
TransSet::Iterator TransRelBegin(void) const Iterator to Begin() of transition relation.
void ClrTransition(Idx x1, Idx ev, Idx x2) Remove a transition by indices.
bool Accessible(void) Make generator accessible.
bool Trim(void) Make generator trim.
virtual vGenerator * New(void) const Construct on heap.
void InjectMarkedStates(const StateSet &rNewMarkedStates) Replace mMarkedStates with StateSet given as parameter without consistency checks.
Idx MarkedStatesSize(void) const Get number of marked states.
StateSet AccessibleSet(void) const Compute set of accessible states.
bool ExistsState(Idx index) const Test existence of state in state set.
std::string StateSetToString(const StateSet &rStateSet) const Write a stateset to string (no re-indexing).
void Name(const std::string &rName) Set the generator's name.
bool DelState(Idx index) Delete a state from generator by index.
StateSet::Iterator StatesEnd(void) const Iterator to End() of state set.
void DelStates(const StateSet &rDelStates) Delete a set of states Cleans mpStates, mInitStates, mMarkedStates, mpTransrel, and mpStateSymboltabl...
TransSet::Iterator TransRelEnd(void) const Iterator to End() of transition relation.
StateSet TerminalStates(void) const Compute set of terminal states.
Idx InsState(void) Add new anonymous state to generator.
void SetMarkedState(Idx index) Set an existing state as marked state by index.
Idx InsInitState(void) Create new anonymous state and set as initial state.
bool StateNamesEnabled(void) const Whether libFAUEDS functions are requested to generate state names.
bool IsTrim(void) const Check if generator is trim.
Idx Size(void) const Get generator size (number of states)
bool ExistsInitState(Idx index) const Test existence of state in mInitStates.
virtual void Clear(void) Clear generator data.
bool ExistsMarkedState(Idx index) const Test existence of state in mMarkedStates.
std::string UniqueStateName(const std::string &rName) const Create a new unique symbolic state name.
const StateSet & States(void) const Return reference to state set.
void InjectAlphabet(const EventSet &rNewalphabet) Set mpAlphabet without consistency check.
bool Empty(void) const Test whether if the TBaseSet is Empty.
bool Exists(const T &rElem) const Test existence of element.
virtual void Clear(void) Clear all set.
Iterator End(void) const Iterator to the end of set.
Iterator Begin(void) const Iterator to the begin of set.
virtual bool Erase(const T &rElem) Erase element by reference.
const std::string & Name(void) const Return name of TBaseSet.
Idx Size(void) const Get Size of TBaseSet.
void StateMin(const Generator &rGen, Generator &rResGen) State set minimization.
bool LanguageInclusion(const Generator &rGen1, const Generator &rGen2) Test language inclusion, Lm1<=Lm2.
void PrefixClosure(Generator &rGen) Prefix Closure.
bool LanguageEquality(const Generator &rGen1, const Generator &rGen2) Language equality, Lm1==Lm2.
void LanguageIntersection(const Generator &rGen1, const Generator &rGen2, Generator &rResGen) Language intersection.
void Project(const Generator &rGen, const EventSet &rProjectAlphabet, Generator &rResGen) Deterministic projection.
void Parallel(const Generator &rGen1, const Generator &rGen2, Generator &rResGen) Parallel composition.
void InvProject(Generator &rGen, const EventSet &rProjectAlphabet) Inverse projection.
void LanguageComplement(Generator &rGen, const EventSet &rAlphabet) Language complement wrt specified alphabet.
bool IsNormal(const Generator &rL, const EventSet &rOAlph, const Generator &rK) IsNormal: checks normality of a language K generated by rK wrt a language L generated by rL and the s...
void SupConClosed(const Generator &rPlantGen, const EventSet &rCAlph, const Generator &rSpecGen, Generator &rResGen) Supremal Controllable and Closed Sublanguage.
void CheapAltAnB(const EventSet rAset, const EventSet rBset, const int Depth, Generator &rAltAnB) CheapAltAnB: returns Generator of the following specification: "After a maximum of n (=depth) pairs o...
void CloneScc(Generator &rGen, const StateSet &rScc, std::set< StateSet > &rSccSet, const Idx EntryState, StateSet &rEntryStates, TransSetX2EvX1 &rEntryTransSet) cloneSCC: makes a copy (clone) of strongly connected component (rSCC) of the generator and moves all ...
void HioSynthUnchecked(const Generator &rPlant, const Generator &rSpec, const Generator &rExtConstr, const Generator &rLocConstr, const EventSet &rYc, const EventSet &rUc, const EventSet &rYp, const EventSet &rUp, const EventSet &rYel, const EventSet &rUel, Generator &rController) HioSynthUnchecked: I/O controller synthesis procedure, no parameter check.
void ConstrSynth_Beta(Generator &rPlant, const EventSet &rYp, const EventSet &rUp, const Generator &rLocConstr, Generator &rOpConstraint) ConstrSynth_Beta: compute operator constraint Sp for plant under environment constraint Sl such that ...
void HioSynth(const Generator &rPlant, const Generator &rSpec, const Generator &rExtConstr, const Generator &rLocConstr, const EventSet &rYc, const EventSet &rUc, const EventSet &rYp, const EventSet &rUp, const EventSet &rYel, const EventSet &rUel, Generator &rController) HioSynthUnchecked: I/O controller synthesis procedure.
void HioShuffleTU(const Generator &rPlantA, const Generator &rPlantB, const EventSet &rUp, const EventSet &rYp, const EventSet &rYe, const EventSet &rUe, const int Depth, Generator &rIOShuffAB) HioShuffleTU: IO-shuffle of rPlantA and rPlantB according to definition with additional forced altern...
void MarkAlternationAB(const EventSet rAset, const EventSet rBset, Generator &rAltAB) MarkAlternationAB: returns Generator marking the alternation of Aset-transitions with Bset-transition...
void HioSynthMonolithic(const HioPlant &rPlant, const HioPlant &rSpec, const HioConstraint &rSc, const HioConstraint &rSp, const HioConstraint &rSe, HioController &rController) HioSynthMonolithic: I/O controller synthesis procedure for monolithic plant.
void SearchYclessScc(const Idx state, int &rcount, const Generator &rGen, const EventSet &rYc, const bool UnMarkedOnly, StateSet &rNewStates, std::stack< Idx > &rSTACK, StateSet &rStackStates, std::map< const Idx, int > &rDFN, std::map< const Idx, int > &rLOWLINK, std::set< StateSet > &rSccSet, StateSet &rRoots) SearchYclessSCC: Search for strongly connected ycless components (YC-less SCC's).
void HioFreeInput(const Generator &rGen, const EventSet &rInput, const EventSet &rOutput, Generator &rResGen, const std::string &rErrState1, const std::string &rErrState2, Idx &rErrState1Idx, Idx &rErrState2Idx) HioFreeInput: extend generator by obviously missing input transitions.
void CheapAltAB(const EventSet rAset, const EventSet rBset, const int Depth, Generator &rAltAB) CheapAltAB: returns Generator of the following specification: "After a maximum of n (=depth) pairs of...
void WriteStateSets(const std::set< StateSet > &rStateSets) WriteStateSets: Write set of StateSet's to console (indeces).
Generator HioSortCL(const EventSet &rYc, const EventSet &rUc, const EventSet &rYp, const EventSet &rUp, const EventSet &rYe, const EventSet &rUe) IoSortCL: returns IO-sorting structure required for closed loops.
void SccEntries(const Generator &rGen, const std::set< StateSet > &rSccSet, StateSet &rEntryStates, TransSetX2EvX1 &rEntryTransSet) SCCEntries: figure entry states and entry transitions of strongly connected components rSccSet of rGe...
bool YclessUnmarkedScc(const Generator &rGen, const EventSet &rYc, std::set< StateSet > &rSccSet, StateSet &rRoots) YclessUnmarkedSCC: Search for strongly connected ycless components (YC-less SCC's) consisting of unma...
void YcAcyclic(const Generator &rGen, const EventSet &rYc, Generator &rResGen) YcAcyclic: Computes the supremal(?) Yc-acyclic sublanguage of L(Gen).
void CloneUnMarkedScc(Generator &rGen, const StateSet &rScc, const Idx EntryState, const StateSet &rEntryStates, TransSetX2EvX1 &rEntryTransSet) CloneUnMarkedSCC: makes a copy (clone) of strongly connected unmarked component (rSCC) of rGen.
void HioShuffleUnchecked(const Generator &rPlantA, const Generator &rPlantB, const EventSet &rYp, const EventSet &rUp, const EventSet &rYe, const EventSet &rUe, Generator &rIOShuffAB) HioShuffleUnchecked: IO-shuffle of rPlantA and rPlantB according to definition, no parameter check.
bool NormalCompleteSynthNB(Generator &rPlant, const EventSet &rCAlph, const EventSet &rOAlph, const Generator &rSpec, Generator &rClosedLoop) NormalCompleteSynthNB: compute normal, complete, controllable and nonblocking sublanguage.
bool IsYcLive(const Generator &rGen, const EventSet &rYc) IsYcLive: This function checks if generator is Yc-live.
bool NormalCompleteSynth(Generator &rPlant, const EventSet &rCAlph, const EventSet &rOAlph, const Generator &rSpec, Generator &rClosedLoop) NormalCompleteSynth: compute normal, complete and controllable (and closed) sublanguage.
void HioSynthHierarchical(const HioPlant &rHioShuffle, const HioEnvironment &rEnvironment, const HioPlant &rSpec, const Generator &rIntConstr, const HioConstraint &rSc, const HioConstraint &rSl, HioController &rController) HioSynthHierarchical: I/O controller synthesis procedure for I/O-shuffle of i plants and their intera...
void MarkHioShuffle(const Generator &rGen1, const Generator &rGen2, const std::map< std::pair< Idx, Idx >, Idx > &rMapOrigToResult, Generator &rShuffle) MarkHioShuffle: marking rule for HioShuffle() in case of marked parameters rGen1 and rGen2 - UNDER CO...
bool CompleteSynth(const Generator &rPlant, const EventSet rCAlph, const Generator &rSpec, Generator &rClosedLoop) CompleteSynth: compute supremal complete and controllable (and closed) sublanguage.
bool YclessScc(const Generator &rGen, const EventSet &rYc, std::set< StateSet > &rSccSet, StateSet &rRoots) YclessSCC: Search for strongly connected ycless components (YC-less SCC's) - convenience api.
void HioShuffle(const Generator &rPlantA, const Generator &rPlantB, const EventSet &rYp, const EventSet &rUp, const EventSet &rYe, const EventSet &rUe, Generator &rIOShuffAB) HioShuffle: IO-shuffle of rPlantA and rPlantB according to definition.
Algorithms for hierarchical discrete event systems with inputs and outputs.
libFAUDES resides within the namespace faudes.
uint32_t Idx Type definition for index type (allways 32bit)
THioController< AttributeVoid, HioStateFlags, HioEventFlags, AttributeVoid > HioController
void NormalityConsistencyCheck(const Generator &rL, const EventSet &rOAlph, const Generator &rK) NormalityConsistencyCheck: Consistency check for normality input data.
bool IsHioEnvironmentForm(HioEnvironment &rHioEnvironment, StateSet &rQYe, StateSet &rQUe, StateSet &rQUl, StateSet &rQYlUe, EventSet &rErrEvSet, TransSet &rErrTrSet, StateSet &rErrStSet, std::string &rReportStr) IsHioEnvironmentForm: check if rHioEnvironment is in I/O-environment form and assign state attributes...
bool IsHioControllerForm(HioController &rHioController, StateSet &rQUc, StateSet &rQYP, StateSet &rQUp, StateSet &rQYcUp, EventSet &rErrEvSet, TransSet &rErrTrSet, StateSet &rErrStSet, std::string &rReportStr) IsHioControllerForm: check if rHioController is in I/O-controller form and assign state attributes.
THioPlant< AttributeVoid, HioStateFlags, HioEventFlags, AttributeVoid > HioPlant
void HioSynth_Musunoi(const Generator &rPlant, const HioPlant &rSpec, const Generator &rConstr, const Generator &rLocConstr, const EventSet &rYp, const EventSet &rUp, Generator &rController)
std::string ToStringInteger(Int number) integer to string
bool IsHioPlantForm(HioPlant &rHioPlant, StateSet &rQYpYe, StateSet &rQUp, StateSet &rQUe, EventSet &rErrEvSet, TransSet &rErrTrSet, StateSet &rErrStSet, std::string &rReportStr) IsHioPlantForm: check if rHioPlant is in I/O-plant form and assign state attributes.
void HioShuffle_Musunoi(const HioPlant &rPlantA, const HioPlant &rPlantB, int depth, Generator &rIOShuffAB)
bool SupNormSP(Generator &rL, const EventSet &rOAlph, const Generator &rK, Generator &rResult)
Includes all header files of the synthesis plug-in.
libFAUDES 2.32f
--- 2024.12.22
--- c++ api documentaion by doxygen
|