con_controllability.cppGo to the documentation of this file.00001 /** @file con_controllability.cpp Conditionalcontrollability */ 00002 00003 /* 00004 * Implementation of the conditionally controllable algorithm 00005 * 00006 * Copyright (C) 2011 Tomas Masopust 00007 * 00008 */ 00009 00010 00011 #include "con_controllability.h" 00012 #include <vector> 00013 00014 namespace faudes { 00015 00016 bool IsConditionalControllable(const GeneratorVector& specVect, const Generator& pk, const GeneratorVector& genVect, const Generator& gk, const EventSet& ACntrl) { 00017 FD_DF("Conditionalcontrollability checking..."); 00018 00019 Idx i; 00020 00021 // there must be the same number of parameters 00022 if (specVect.Size() != genVect.Size()) { 00023 std::stringstream errstr; 00024 errstr << "The sizes of specVect and genVect are different."; 00025 throw Exception("ConditionalControllability", errstr.str(), 201); 00026 } 00027 00028 // the generators must be deterministic 00029 for (i = 0; i < specVect.Size(); i++) { 00030 if (specVect.At(i).IsDeterministic() == false) { 00031 std::stringstream errstr; 00032 errstr << "Generators of specVect must be deterministic, but there is a nondeterministic one"; 00033 throw Exception("ConditionalControllability", errstr.str(), 201); 00034 } 00035 } 00036 00037 if (pk.IsDeterministic() == false) { 00038 std::stringstream errstr; 00039 errstr << "Generator pk must be deterministic, but is nondeterministic"; 00040 throw Exception("ConditionalControllability", errstr.str(), 201); 00041 } 00042 00043 for (i = 0; i < genVect.Size(); i++) { 00044 if (genVect.At(i).IsDeterministic() == false) { 00045 std::stringstream errstr; 00046 errstr << "Generators of genVect must be deterministic, but there is a nondeterministic one"; 00047 throw Exception("ConditionalControllability", errstr.str(), 201); 00048 } 00049 } 00050 00051 if (gk.IsDeterministic() == false) { 00052 std::stringstream errstr; 00053 errstr << "Generator gk must be deterministic, but is nondeterministic"; 00054 throw Exception("ConditionalControllability", errstr.str(), 201); 00055 } 00056 00057 EventSet ekc; // the set of controllable events E_{k,c} 00058 SetIntersection(gk.Alphabet(),ACntrl,ekc); 00059 00060 // check whether the generators are nonblocking 00061 if (IsNonblocking(pk) && IsNonblocking(gk) == false) { 00062 std::stringstream errstr; 00063 errstr << "Generators pk and gk must be nonblocking"; 00064 throw Exception("ConditionalControllability", errstr.str(), 201); 00065 } 00066 00067 // check if P_k(K) is controllable wrt L(G_k) and E_{k,c} 00068 if (IsControllable(gk,ekc,pk) == false) { 00069 return false; 00070 } 00071 00072 // check if P_{i+k}(K) is controllable wrt L(G_i)||\overline{P_k(K)} and E_{1+k,c} 00073 Generator pkClosure = pk; 00074 PrefixClosure(pkClosure); 00075 for (i = 0; i < specVect.Size(); i++) { 00076 Generator helpPlant; 00077 Parallel(genVect.At(i),pkClosure,helpPlant); 00078 EventSet uSet, Eikc; 00079 SetUnion(genVect.At(i).Alphabet(),pk.Alphabet(),uSet); 00080 SetIntersection(uSet,ACntrl,Eikc); 00081 if (IsControllable(helpPlant,Eikc,specVect.At(i)) == false) { 00082 return false; 00083 } 00084 if (IsNonblocking(genVect.At(i)) && IsNonblocking(specVect.At(i)) == false) { 00085 std::stringstream errstr; 00086 errstr << i << "th generator or specification projection is blocking"; 00087 throw Exception("ConditionalControllability", errstr.str(), 201); 00088 } 00089 } 00090 00091 return true; 00092 } 00093 00094 00095 } // name space 00096 00097 00098 libFAUDES 2.23h --- 2014.04.03 --- c++ api documentaion by doxygen |