12 FD_DIO(
"IsIoSystem("<< rIoSystem.
Name() <<
",...)");
17 rQErr.
Name(
"ErrorStates");
19 FD_DIO(
"IsIoSystem("<< rIoSystem.
Name() <<
",...): testing completeness");
22 StateSet::Iterator sit=acc.
Begin();
23 StateSet::Iterator sit_end=acc.
End();
24 for(;sit!=sit_end;sit++){
28 if(tit==tit_end) rQErr.
Insert(*sit);
33 FD_DIO(
"IsIoSystem("<< rIoSystem.
Name() <<
",...): not complete");
41 EventSet::Iterator eit_end= rIoSystem.
AlphabetEnd();
42 for(; eit != eit_end; ++eit) {
55 FD_DIO(
"IsIoSystem("<< rIoSystem.
Name() <<
",...): not a u-y partition of events");
58 for(; tit!=tit_end; tit++)
63 FD_DIO(
"IsIoSystem("<< rIoSystem.
Name() <<
",...): trivial partition");
67 FD_DIO(
"IsIoSystem("<< rIoSystem.
Name() <<
",...): i/o alternation");
71 for(; sit != sit_end; ++sit) {
75 for(; tit!=tit_end; tit++) {
86 for(; sit != sit_end; ++sit) {
92 while(!todo.empty()) {
93 const Idx current = todo.top();
95 bool uok = rQU.
Exists(current);
96 bool yok = rQY.
Exists(current);
100 for(; tit!=tit_end; tit++) {
105 if(!uok) rQErr.
Insert(current);
109 if(!yok) rQErr.
Insert(current);
124 bool res=
IsIoSystem(rIoSystem, QU, QY, QErr);
140 FD_DIO(
"IsInputLocallyFree("<< rIoSystem.
Name() <<
",...)");
149 FD_DIO(
"IsInputLocallyFree("<< rIoSystem.
Name() <<
",...)");
152 rQErr.
Name(
"ErrorStates");
157 StateSet::Iterator sit_end= rIoSystem.
StatesEnd();
158 for(; sit != sit_end; ++sit) {
163 for(; tit!=tit_end; tit++)
167 if(lsigu.
Empty())
continue;
169 if(lsigu == sigu)
continue;
174 return rQErr.
Empty();
180 FD_DIO(
"IsInputOmegaFree("<< rIoSystem.
Name() <<
",...)");
189 FD_DIO(
"IsInputOmegaFree("<< rIoSystem.
Name() <<
",...)");
194 FD_DIO(
"IsInputOmegaFree("<< rIoSystem.
Name() <<
",...): failed for locally free");
202 rQErr.
Name(
"ErrorStates");
207 FD_DIO(
"IsInputOmegaFree(...): iterate over good states");
209 StateSet::Iterator sit = rQErr.
Begin();
210 while(sit!=rQErr.
End()) {
212 StateSet::Iterator cit=sit++;
214 if(goodstates.
Exists(*cit))
continue;
219 if(tit==tit_end)
continue;
222 for(; tit!=tit_end; ++tit) {
223 if(goodstates.
Exists(tit->X2)) { exgood=
true;
continue; };
224 if(!yalph.
Exists(tit->Ev))
break;
227 if(exgood && (tit==tit_end)) {
228 FD_DIO(
"IsInputOmegaFree(): ins good state " << rIoSystem.
SStr(*cit));
240 FD_DIO(
"IsInputOmegaFree(): accessible <= good: passed");
245 FD_DIO(
"IsInputOmegaFree(): accessible <= good: failed");
257 FD_DIO(
"IoFreeInput("<< rGen.
Name() <<
",...)");
260 std::stringstream errstr;
261 errstr <<
"Input alphabet must be contained in generator alphabet";
262 throw Exception(
"IoFreeInput(..)", errstr.str(), 100);
268 EventSet::Iterator eit;
269 EventSet::Iterator eit_end;
272 StateSet::Iterator sit_end= rGen.
StatesEnd();
273 for(; sit != sit_end; ++sit) {
278 for(; tit!=tit_end; tit++)
281 if(lsigu.
Empty())
continue;
283 if(lsigu == rUAlph)
continue;
292 for(; eit!=eit_end; eit++) {
301 eit_end=rUAlph.
End();
302 for(; eit!=eit_end; eit++)
311 FD_DIO(
"RemoveIoDummyStates("<< rIoSystem.
Name() <<
",...)");
323 StateSet::Iterator sit_end= rIoSystem.
StatesEnd();
324 for(; sit != sit_end; ++sit) {
331 for(; tit!=tit_end; tit++) {
332 if(qsuc==0) qsuc=tit->X2;
333 if(qsuc!=tit->X2) { qunique=
false;
break;}
337 if(!qunique || qsuc==0)
continue;
339 if(!(lsig == sigy))
continue;
344 FD_DIO(
"RemoveIoDummyStates(): Candidates type 1 " << qerr1.
ToString());
345 FD_DIO(
"RemoveIoDummyStates(): Candidates type 2 " << qerr2.
ToString());
349 sit_end= qerr2.
End();
350 for(; sit != sit_end; ++sit) {
357 for(; tit!=tit_end; tit++) {
358 if(qsuc==0) qsuc=tit->X2;
359 if(qsuc!=tit->X2) { qunique=
false;
break;}
363 if(!qunique)
continue;
365 if(!qerr1.
Exists(qsuc))
continue;
367 if(!(lsig == sigu))
continue;
371 FD_DIO(
"RemoveIoDummyStates(): Candidates type 2 (approved) " << qerr2a.
ToString());
376 sit_end= qerr1.
End();
377 for(; sit != sit_end; ++sit) {
380 if(tit==tit_end) { qrm1.
Insert(*sit);
break;}
381 if(!qerr2a.
Exists(tit->X2)) { qrm1.
Insert(*sit);
break;}
385 sit = qerr2a.
Begin();
386 sit_end= qerr2a.
End();
387 for(; sit != sit_end; ++sit) {
390 if(tit==tit_end) { qrm2.
Insert(*sit);
break;}
400 for(; sit != sit_end; ++sit)
402 FD_DIO(
"RemoveIoDummyStates(): done");
Idx Insert(void)
Insert new index to set.
Set of indices with symbolic names.
bool Exists(const Idx &rIndex) const
Test existence of index.
bool Insert(const Idx &rIndex)
Add an element by index.
TBaseSet< Transition, TransSort::X1EvX2 >::Iterator Iterator
Iterator on transition.
Generator with I/O-system attributes.
bool InputEvent(Idx index) const
Test for input event.
StateSet InputStates(void) const
Retrieve all input states.
StateSet OutputStates(void) const
Retrieve all output states.
StateSet ErrorStates(void) const
Retrieve all error states.
bool OutputEvent(Idx index) const
Test for output event.
EventSet OutputEvents(void) const
Retrieve all output events.
EventSet InputEvents(void) const
Retrieve all input events.
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.
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.
TransSet::Iterator TransRelBegin(void) const
Iterator to Begin() of transition relation.
EventSet::Iterator AlphabetBegin(void) const
Iterator to Begin() of alphabet.
StateSet AccessibleSet(void) const
Compute set of accessible states.
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.
TransSet::Iterator TransRelEnd(void) const
Iterator to End() of transition relation.
StateSet::Iterator InitStatesEnd(void) const
Iterator to End() of mInitStates.
EventSet::Iterator AlphabetEnd(void) const
Iterator to End() of alphabet.
StateSet CoaccessibleSet(void) const
Compute set of Coaccessible states.
std::string SStr(Idx index) const
Return pretty printable state name for index (eg for debugging)
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.
virtual void EraseSet(const TBaseSet &rOtherSet)
Erase elements given by other set.
void RemoveIoDummyStates(IoSystem &rIoSystem)
Remove dummy states.
bool IsInputOmegaFree(IoSystem &rIoSystem)
Test whether the system behaviour has exhibits a free input.
bool IsInputLocallyFree(IoSystem &rIoSystem)
Test whether the system has a locally free input.
bool IsIoSystem(const IoSystem &rIoSystem, StateSet &rQU, StateSet &rQY, StateSet &rQErr)
Test whether the system satisfies basic I/O conditions.
void IoFreeInput(IoSystem &rIoSystem)
Enable all input events for each input state.
void SupConCmplClosed(const Generator &rPlantGen, const EventSet &rCAlph, const Generator &rSpecGen, Generator &rResGen)
Supremal controllable and complete sublanguage.
void OmegaSupConNB(const Generator &rPlantGen, const EventSet &rCAlph, const Generator &rSpecGen, Generator &rResGen)
Omega-synthesis.
Algorithms addressing I/O-systems.
libFAUDES resides within the namespace faudes.
uint32_t Idx
Type definition for index type (allways 32bit)
void IoSynthesisNB(const IoSystem &rPlant, const Generator &rSpec, IoSystem &rSup)
IO system synthesis.
void IoStatePartition(IoSystem &rIoSystem)
Construct io state partition.
void IoSynthesis(const IoSystem &rPlant, const Generator &rSpec, IoSystem &rSup)
IO system synthesis.
Supremal controllable sublanguage for infinite time behaviours.