con_1_simple.cppGo to the documentation of this file.00001 /** @file con_1_simple.cpp 00002 00003 Tutorial, coordination control 00004 00005 @ingroup Tutorials 00006 00007 @include con_1_simple.cpp 00008 00009 */ 00010 00011 #include "libfaudes.h" 00012 00013 // we make the faudes namespace available to our program 00014 using namespace faudes; 00015 00016 ///////////////// 00017 // main program 00018 ///////////////// 00019 00020 int main(void) { 00021 00022 System g1, g2, g3, gk, spec, plant; 00023 EventSet e1, e2, e3, ek, ec; 00024 EventSetVector eVector; 00025 GeneratorVector gVector, specV; 00026 00027 g1.Read("data/gen1.gen"); 00028 g2.Read("data/gen2.gen"); 00029 g3.Read("data/gen3.gen"); 00030 spec.Read("data/spec.gen"); 00031 00032 gVector.Append(g1); 00033 gVector.Append(g2); 00034 gVector.Append(g3); 00035 aParallel(gVector,plant); 00036 00037 e1.Read("data/e1.alph"); 00038 e2.Read("data/e2.alph"); 00039 e3.Read("data/e3.alph"); 00040 ek.Read("data/ek.alph"); 00041 ec.Read("data/ec.alph"); // controllable events 00042 00043 eVector.Append(e1); 00044 eVector.Append(e2); 00045 eVector.Append(e3); 00046 00047 System proof; 00048 00049 bool result1 = IsConditionalDecomposable(spec,eVector,ek,proof); 00050 00051 if (result1) { 00052 std::cout << "The language is conditionally decomposable." << std::endl; 00053 } 00054 else { 00055 std::cout << "The language is not conditionally decomposable." << std::endl 00056 << "The proof strings are showin in the \'proof\' generator." << std::endl; 00057 } 00058 00059 FAUDES_TEST_DUMP("is cond decomp",result1); 00060 00061 //Coordinator 00062 Project(plant,ek,gk); 00063 00064 //PkK, PikK, i=1,2,3 00065 System PkK, P1kK, P2kK, P3kK; 00066 Project(spec,ek,PkK); 00067 Project(spec,e1+ek,P1kK); 00068 Project(spec,e2+ek,P2kK); 00069 Project(spec,e3+ek,P3kK); 00070 00071 specV.Append(P1kK); 00072 specV.Append(P2kK); 00073 specV.Append(P3kK); 00074 00075 bool result2 = IsConditionalControllable(specV,PkK,gVector,gk,ec); 00076 00077 00078 if (result2) { 00079 std::cout << "The language is conditionally controllable." << std::endl; 00080 } 00081 else { 00082 std::cout << "The language is not conditionally controllable." << std::endl; 00083 } 00084 00085 00086 bool result3 = IsConditionalClosed(specV,PkK,gVector,gk); 00087 00088 FAUDES_TEST_DUMP("is cond ctrl",result2); 00089 00090 if (result3) { 00091 std::cout << "The language is conditionally closed." << std::endl; 00092 } 00093 else { 00094 std::cout << "The language is not conditionally closed." << std::endl; 00095 } 00096 00097 FAUDES_TEST_DUMP("is cond closed",result3); 00098 00099 FAUDES_TEST_DIFF(); 00100 } 00101 libFAUDES 2.23h --- 2014.04.03 --- c++ api documentaion by doxygen |