op_ex_bisim.cpp

Go to the documentation of this file.
00001 
00019 #include <stdio.h>
00020 #include <iostream>
00021 #include <libfaudes.h>
00022 #include <op_observer.h>
00023 
00024 
00025 
00026 int main(int argc, char* argv[])
00027 {
00028 
00029   // read original generator from file input 
00030   Generator genOrig("data/ex_bisim/ex_bisim.gen");
00031   // Write the original generator to console
00032     std::cout << "#####################\n";
00033     std::cout << "# original generator \n";
00034     std::cout << "#####################\n";
00035     genOrig.DWrite();
00036   // create an empty map<Idx,Idx>
00037   // it is passed by reference to the fuction calcBisimulation and will map the index of 
00038   // each state (first Idx) to the index of its equivalence class (second Idx)
00039   map<Idx,Idx> mapStateToPartition;
00040   
00041   // create an empty Generator. It is passed by reference to the function calcBisimulation
00042     // and will hold the coarsest quasi-congruence on genOrig, where each equivalence class is represented by a state
00043   Generator genPart;
00044   
00045   // create an empty vecor<Idx>
00046   // this map is passed by reference to the function calcBisimulation and will hold the indices
00047   // of all equivalence classes
00048   vector<Idx> newPartitions;
00049   
00050   // call the function calcBisimulation which computes the coarses quasi-congruence
00051   calcBisimulation(genOrig, mapStateToPartition, genPart, newPartitions);
00052   
00053   // Write the resulting generator that holds the quasi-congruence to console
00054     std::cout << "#########################################\n";
00055     std::cout << "# generator holding the quasi-congruence\n";
00056     std::cout << "#########################################\n";
00057     genPart.DWrite();
00058     // Write the resulting generator to file output 
00059     genPart.Write("./results/ex_bisim/genPart.gen");
00060     // output the map from states in the original generator to equivalence classes (states in genPart)
00061     map<Idx,Idx>::const_iterator mIt, mEndIt;
00062     mIt = mapStateToPartition.begin();
00063     mEndIt = mapStateToPartition.end();
00064     std::cout << "##################################################\n";
00065     std::cout << "# map from original states to equivalence classes\n";
00066     for( ; mIt != mEndIt; mIt++){
00067         std::cout << "state: " << mIt->first << " class: " << mIt->second << "\n";
00068     }
00069     std::cout << "##################################################\n";
00070 
00071 return 0;
00072 }

Generated on Fri May 9 11:26:47 2008 for libFAUDES 2.09b by  doxygen 1.4.4