20 std::stringstream errstr;
21 errstr <<
"Generator must be deterministic, but is nondeterministic";
22 throw Exception(
"ConditionalDecomposabilityExtension", errstr.str(), 201);
26 if (gen.
IsTrim() ==
false) {
27 std::stringstream errstr;
28 errstr <<
"Generator must be trim, but is blocking";
29 throw Exception(
"ConditionalDecomposabilityExtension", errstr.str(), 201);
33 if (rAlphabets.
Size() < 2) {
34 std::stringstream errstr;
35 errstr <<
"At least two alphabets must be included in the EventSetVector";
36 throw Exception(
"ConditionalDecomposabilityExtension", errstr.str(), 201);
45 for (i = 0; i < ee.
Size(); i++) {
46 unionset = unionset + ee.
At(i);
50 for (i = 0; i < ee.
Size(); i++) {
51 for (
Idx j = 0; j < ee.
Size(); j++) {
53 shared = shared + ( ee.
At(i) * ee.
At(j) );
61 std::stringstream errstr;
62 errstr <<
"Generator alphabet is not included in union of the alphabets";
63 throw Exception(
"ConditionalDecomposabilityExtension", errstr.str(), 100);
69 std::stringstream errstr;
70 errstr <<
"Generator alphabet does not include the alphabet ek";
71 throw Exception(
"ConditionalDecomposabilityExtension", errstr.str(), 100);
77 std::stringstream errstr;
78 errstr <<
"Ek does not include all shared events";
79 throw Exception(
"ConditionalDecomposabilityExtension", errstr.str(), 100);
83 for (
Idx i = 0; i < ee.
Size(); ++i) {
88 for (
Idx j = 0; j < ee.
Size(); ++j) {
89 if ( i == j )
continue;
90 uset = uset + ee.
At(j);
93 CDExt(gen,eev,unionset,ek);
116 EventSet::Iterator eit;
118 for (
Idx i = 0; i < ee.
Size(); i++) {
120 notInEiEk = unionset - ( ee.
At(i) + ek );
122 for (eit = notInEiEk.
Begin(); eit != notInEiEk.
End(); ++eit) {
126 unionsetNew = unionsetNew + copy.Alphabet();
130 for (
Idx i = 1; i < copies.
Size(); i++) {
142 std::stack< std::pair<Idx,Idx> > todo;
144 std::map< std::pair<Idx,Idx>,
Idx> testedTrans;
147 std::pair<Idx,Idx> currentstates, newstates;
151 StateSet::Iterator lit1, lit2;
153 std::map< std::pair<Idx,Idx>,
Idx>::iterator rcit;
158 currentstates = std::make_pair(*lit1, *lit2);
159 todo.push(currentstates);
160 testedTrans[currentstates] = tmpstate++;
170 while (! todo.empty()) {
172 currentstates = todo.top();
176 tit1_end = tildeGen.
TransRelEnd(currentstates.first);
177 for (; tit1 != tit1_end; ++tit1) {
179 if (! sharedalphabet.
Exists(tit1->Ev)) {
180 newstates = std::make_pair(tit1->X2, currentstates.second);
187 rcit = testedTrans.find(newstates);
188 if (rcit == testedTrans.end()) {
189 todo.push(newstates);
190 testedTrans[newstates] = tmpstate++;
193 tmpstate = rcit->second;
200 tit2_end = rGen.
TransRelEnd(currentstates.second, tit1->Ev);
205 if (tit2 == tit2_end) {
207 std::cerr <<
"ConDecExtension: Event " << rGen.
EventName(lastNonEk)
208 <<
" has been added to Ek." << std::endl;
211 for (; tit2 != tit2_end; ++tit2) {
212 newstates = std::make_pair(tit1->X2, tit2->X2);
213 if (! ek.
Exists(tit1->Ev)) {
214 lastNonEk = tit1->Ev;
222 rcit = testedTrans.find(newstates);
223 if (rcit == testedTrans.end()) {
224 todo.push(newstates);
225 testedTrans[newstates] = tmpstate++;
228 tmpstate = rcit->second;
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.
virtual const T & At(const Position &pos) const
Access element.
TBaseSet< Transition, TransSort::X1EvX2 >::Iterator Iterator
Iterator on transition.
virtual void Append(const Type &rElem)
Append specified entry.
Idx Size(void) const
Get size of vector.
Base class of all FAUDES generators.
StateSet::Iterator InitStatesBegin(void) const
Iterator to Begin() of mInitStates.
const EventSet & Alphabet(void) const
Return const reference to alphabet.
TransSet::Iterator TransRelBegin(void) const
Iterator to Begin() of transition relation.
bool EventRename(Idx event, const std::string &rNewName)
Rename event in this generator.
TransSet::Iterator TransRelEnd(void) const
Iterator to End() of transition relation.
bool IsDeterministic(void) const
Check if generator is deterministic.
StateSet::Iterator InitStatesEnd(void) const
Iterator to End() of mInitStates.
std::string EventName(Idx index) const
Event name lookup.
bool IsTrim(void) const
Check if generator is trim.
Conditionaldecomposability.
bool SetInclusion(const TBaseSet< T, Cmp > &rSetA, const TBaseSet< T, Cmp > &rSetB)
Iterator End(void) const
Iterator to the end of set.
Iterator Begin(void) const
Iterator to the begin of set.
void ConDecExtension(const Generator &gen, const EventSetVector &rAlphabets, EventSet &ek)
Conditionaldecomposability Extension Algorithm.
void Trim(vGenerator &rGen)
RTI wrapper function.
void Parallel(const Generator &rGen1, const Generator &rGen2, Generator &rResGen)
Parallel composition.
libFAUDES resides within the namespace faudes.
uint32_t Idx
Type definition for index type (allways 32bit)
Generator ComputeTildeG(const EventSet &unionset, const EventSetVector &ee, const EventSet &ek, const Generator &gen)
void CDExt(const Generator &gen, const EventSetVector &ee, const EventSet &unionset, EventSet &ek)
bool isExtendedEk(const Generator &tildeGen, const Generator &rGen, EventSet &ek)