34 std::map< std::pair<Idx,Idx>,
Idx> cmap;
37 if(&rResGen== &rGen1 || &rResGen== &rGen2) {
38 pResGen= rResGen.
New();
41 Parallel(rGen1, rGen2, cmap, *pResGen);
43 if(pResGen != &rResGen) {
44 pResGen->
Move(rResGen);
56 FD_DF(
"aParallel(...)");
63 if(&rResGen== &rGen1 || &rResGen== &rGen2) {
64 pResGen= rResGen.
New();
77 if(pResGen != &rResGen) {
78 pResGen->
Move(rResGen);
82 FD_DF(
"aParallel(...): done");
96 if(!rGenVec.
At(i).Alphabet().EqualAttributes(rGenVec.
At(j).Alphabet()))
100 if(rGenVec.
Size()==0) {
105 if(rGenVec.
Size()==1) {
106 rResGen=rGenVec.
At(0);
137 if(&rResGen== &rGen1 || &rResGen== &rGen2) {
138 pResGen= rResGen.
New();
151 if(pResGen != &rResGen) {
152 pResGen->
Move(rResGen);
179 Parallel(rGen1,rGen2,rCompositionMap,rResGen);
202 StateSet::Iterator sit;
215 std::map< std::pair<Idx,Idx>,
Idx>& rCompositionMap,
218 FD_DF(
"Parallel(" << &rGen1 <<
"," << &rGen2 <<
")");
250 if(&rResGen== &rGen1 || &rResGen== &rGen2) {
251 pResGen= rResGen.
New();
255 rCompositionMap.clear();
258 EventSet::Iterator eit;
265 FD_DF(
"Parallel: inserted indices in rResGen.alphabet( "
270 FD_DF(
"Parallel: shared events: " << sharedalphabet.ToString());
273 std::stack< std::pair<Idx,Idx> > todo;
275 std::pair<Idx,Idx> currentstates, newstates;
278 StateSet::Iterator lit1, lit2;
280 std::map< std::pair<Idx,Idx>,
Idx>::iterator rcit;
283 FD_DF(
"Parallel: adding all combinations of initial states to todo:");
286 currentstates = std::make_pair(*lit1, *lit2);
287 todo.push(currentstates);
289 rCompositionMap[currentstates] = tmpstate;
290 FD_DF(
"Parallel: (" << *lit1 <<
"|" << *lit2 <<
") -> "
291 << rCompositionMap[currentstates]);
296 FD_DF(
"Parallel: processing reachable states:");
297 while (! todo.empty()) {
301 FD_WPC(rCompositionMap.size(),rCompositionMap.size()+todo.size(),
"Parallel(): processing");
303 currentstates = todo.top();
305 FD_DF(
"Parallel: processing (" << currentstates.first <<
"|"
306 << currentstates.second <<
") -> "
307 << rCompositionMap[currentstates]);
312 for (; tit1 != tit1_end; ++tit1) {
314 if (! sharedalphabet.Exists(tit1->Ev)) {
315 FD_DF(
"Parallel: exists only in rGen1");
316 newstates = std::make_pair(tit1->X2, currentstates.second);
318 rcit = rCompositionMap.find(newstates);
319 if (rcit == rCompositionMap.end()) {
320 todo.push(newstates);
322 rCompositionMap[newstates] = tmpstate;
323 FD_DF(
"Parallel: todo push: (" << newstates.first <<
"|"
324 << newstates.second <<
") -> "
325 << rCompositionMap[newstates]);
328 tmpstate = rcit->second;
330 pResGen->
SetTransition(rCompositionMap[currentstates], tit1->Ev, tmpstate);
331 FD_DF(
"Parallel: add transition to new generator: "
332 << rCompositionMap[currentstates] <<
"-" << tit1->Ev <<
"-"
337 FD_DF(
"Parallel: common event");
340 tit2_end = rGen2.
TransRelEnd(currentstates.second, tit1->Ev);
341 for (; tit2 != tit2_end; ++tit2) {
342 newstates = std::make_pair(tit1->X2, tit2->X2);
344 rcit = rCompositionMap.find(newstates);
345 if (rcit == rCompositionMap.end()) {
346 todo.push(newstates);
348 rCompositionMap[newstates] = tmpstate;
349 FD_DF(
"Parallel: todo push: (" << newstates.first <<
"|"
350 << newstates.second <<
") -> "
351 << rCompositionMap[newstates]);
354 tmpstate = rcit->second;
358 FD_DF(
"Parallel: add transition to new generator: "
359 << rCompositionMap[currentstates] <<
"-"
360 << tit1->Ev <<
"-" << tmpstate);
367 tit2_end = rGen2.
TransRelEnd(currentstates.second);
368 for (; tit2 != tit2_end; ++tit2) {
369 if (! sharedalphabet.Exists(tit2->Ev)) {
370 FD_DF(
"Parallel: exists only in rGen2");
371 newstates = std::make_pair(currentstates.first, tit2->X2);
373 rcit = rCompositionMap.find(newstates);
374 if (rcit == rCompositionMap.end()) {
375 todo.push(newstates);
377 rCompositionMap[newstates] = tmpstate;
378 FD_DF(
"Parallel: todo push: (" << newstates.first <<
"|"
379 << newstates.second <<
") -> "
380 << rCompositionMap[newstates]);
383 tmpstate = rcit->second;
387 FD_DF(
"Parallel: add transition to new generator: "
388 << rCompositionMap[currentstates] <<
"-"
389 << tit2->Ev <<
"-" << tmpstate);
399 currentstates = std::make_pair(*lit1, *lit2);
400 rcit = rCompositionMap.find(currentstates);
401 if (rcit != rCompositionMap.end()) {
406 FD_DF(
"Parallel: marked states: "
409 if(pResGen != &rResGen) {
423 std::map< std::pair<Idx,Idx>,
Idx> cmap;
425 Product(rGen1, rGen2, cmap, rResGen);
441 if(&rResGen== &rGen1 || &rResGen== &rGen2) {
442 pResGen= rResGen.
New();
455 if(pResGen != &rResGen) {
456 pResGen->
Move(rResGen);
475 if(&rResGen== &rGen1 || &rResGen== &rGen2) {
476 pResGen= rResGen.
New();
489 if(pResGen != &rResGen) {
490 pResGen->
Move(rResGen);
499 std::map< std::pair<Idx,Idx>,
Idx>& rCompositionMap,
506 Product(rGen1,rGen2,rCompositionMap,rResGen);
513 std::map< std::pair<Idx,Idx>,
Idx>::iterator rit;
514 for(rit=rCompositionMap.begin(); rit!=rCompositionMap.end(); ++rit){
524 std::map< std::pair<Idx,Idx>,
Idx>& rCompositionMap,
527 FD_DF(
"Product(" << &rGen1 <<
"," << &rGen2 <<
")");
531 if(&rResGen== &rGen1 || &rResGen== &rGen2) {
532 pResGen= rResGen.
New();
535 rCompositionMap.clear();
539 FD_DF(
"Product: shared alphabet: "
543 std::stack< std::pair<Idx,Idx> > todo;
545 std::pair<Idx,Idx> currentstates, newstates;
549 StateSet::Iterator lit1, lit2;
551 std::map< std::pair<Idx,Idx>,
Idx>::iterator rcit;
554 FD_DF(
"Product: adding all combinations of initial states to todo:");
559 currentstates = std::make_pair(*lit1, *lit2);
560 todo.push(currentstates);
561 rCompositionMap[currentstates] = pResGen->
InsInitState();
562 FD_DF(
"Product: (" << *lit1 <<
"|" << *lit2 <<
") -> "
563 << rCompositionMap[currentstates]);
568 FD_DF(
"Product: processing reachable states:");
569 while (! todo.empty()) {
573 FD_WPC(rCompositionMap.size(),rCompositionMap.size()+todo.size(),
"Product(): processing");
575 currentstates = todo.top();
577 FD_DF(
"Product: processing (" << currentstates.first <<
"|"
578 << currentstates.second <<
") -> " << rCompositionMap[currentstates]);
583 tit2_end = rGen2.
TransRelEnd(currentstates.second);
584 while((tit1 != tit1_end) && (tit2 != tit2_end)) {
586 if(tit1->Ev < tit2->Ev) {
591 if(tit1->Ev > tit2->Ev) {
597 while(tit2 != tit2_end) {
599 if(tit1->Ev != tit2->Ev)
break;
601 newstates = std::make_pair(tit1->X2, tit2->X2);
603 rcit = rCompositionMap.find(newstates);
604 if(rcit == rCompositionMap.end()) {
605 todo.push(newstates);
607 rCompositionMap[newstates] = tmpstate;
608 FD_DF(
"Product: todo push: (" << newstates.first <<
"|"
609 << newstates.second <<
") -> " << rCompositionMap[newstates]);
611 tmpstate = rcit->second;
614 pResGen->
SetTransition(rCompositionMap[currentstates], tit1->Ev, tmpstate);
615 FD_DF(
"Product: add transition to new generator: "
616 << rCompositionMap[currentstates] <<
"-" << tit1->Ev <<
"-" << tmpstate);
623 if(tit1->Ev == tit2_begin->Ev)
633 currentstates = std::make_pair(*lit1, *lit2);
634 rcit = rCompositionMap.find(currentstates);
635 if (rcit != rCompositionMap.end()) {
643 if(pResGen != &rResGen) {
660 const std::map< std::pair<Idx,Idx>,
Idx>& rCompositionMap,
663 std::map< std::pair<Idx,Idx>,
Idx>::const_iterator rcit;
664 for(rcit=rCompositionMap.begin(); rcit!=rCompositionMap.end(); rcit++) {
665 Idx x1=rcit->first.first;
666 Idx x2=rcit->first.second;
667 Idx x12=rcit->second;
673 std::string name12= name1 +
"|" + name2;
682 const std::map< std::pair<Idx,Idx>,
Idx>& rCompositionMap,
683 std::map<Idx,Idx>& rCompositionMap1)
685 rCompositionMap1.clear();
686 std::map< std::pair<Idx,Idx>,
Idx>::const_iterator rcit;
687 for(rcit=rCompositionMap.begin(); rcit!=rCompositionMap.end(); rcit++)
688 rCompositionMap1.insert(std::pair<Idx,Idx>(rcit->second,rcit->first.first));
694 const std::map< std::pair<Idx,Idx>,
Idx>& rCompositionMap,
695 std::map<Idx,Idx>& rCompositionMap2)
697 rCompositionMap2.clear();
698 std::map< std::pair<Idx,Idx>,
Idx>::const_iterator rcit;
699 for(rcit=rCompositionMap.begin(); rcit!=rCompositionMap.end(); rcit++)
700 rCompositionMap2.insert(std::pair<Idx,Idx>(rcit->second,rcit->first.second));
765 std::pair<Idx,Idx> x12(x1,x2);
768 return x12it->second;
776 std::map< std::pair<Idx,Idx>,
Idx>::const_iterator rcit;
778 mArg1Map.insert(std::pair<Idx,Idx>(rcit->second,rcit->first.first));
779 mArg2Map.insert(std::pair<Idx,Idx>(rcit->second,rcit->first.second));
783 std::map< Idx , Idx >::const_iterator x1it=
mArg1Map.find(x1);
793 std::map< std::pair<Idx,Idx>,
Idx>::const_iterator rcit;
795 mArg1Map.insert(std::pair<Idx,Idx>(rcit->second,rcit->first.first));
796 mArg2Map.insert(std::pair<Idx,Idx>(rcit->second,rcit->first.second));
800 std::map< Idx , Idx >::const_iterator x2it=
mArg2Map.find(x2);