con_1_simple.cpp
Go to the documentation of this file.
1 /** @file con_1_simple.cpp
2 
3 Tutorial, coordination control
4 
5 @ingroup Tutorials
6 
7 @include con_1_simple.cpp
8 
9 */
10 
11 #include "libfaudes.h"
12 
13 // we make the faudes namespace available to our program
14 using namespace faudes;
15 
16 /////////////////
17 // main program
18 /////////////////
19 
20 int main(void) {
21 
22  System g1, g2, g3, gk, spec, plant;
23  EventSet e1, e2, e3, ek, ec;
24  EventSetVector eVector;
25  GeneratorVector gVector, specV;
26 
27  g1.Read("data/gen1.gen");
28  g2.Read("data/gen2.gen");
29  g3.Read("data/gen3.gen");
30  spec.Read("data/spec.gen");
31 
32  gVector.Append(g1);
33  gVector.Append(g2);
34  gVector.Append(g3);
35  aParallel(gVector,plant);
36 
37  e1.Read("data/e1.alph");
38  e2.Read("data/e2.alph");
39  e3.Read("data/e3.alph");
40  ek.Read("data/ek.alph");
41  ec.Read("data/ec.alph"); // controllable events
42 
43  eVector.Append(e1);
44  eVector.Append(e2);
45  eVector.Append(e3);
46 
47  System proof;
48 
49  bool result1 = IsConditionalDecomposable(spec,eVector,ek,proof);
50 
51  if (result1) {
52  std::cout << "The language is conditionally decomposable." << std::endl;
53  }
54  else {
55  std::cout << "The language is not conditionally decomposable." << std::endl
56  << "The proof strings are showin in the \'proof\' generator." << std::endl;
57  }
58 
59  FAUDES_TEST_DUMP("is cond decomp",result1);
60 
61  //Coordinator
62  Project(plant,ek,gk);
63 
64  //PkK, PikK, i=1,2,3
65  System PkK, P1kK, P2kK, P3kK;
66  Project(spec,ek,PkK);
67  Project(spec,e1+ek,P1kK);
68  Project(spec,e2+ek,P2kK);
69  Project(spec,e3+ek,P3kK);
70 
71  specV.Append(P1kK);
72  specV.Append(P2kK);
73  specV.Append(P3kK);
74 
75  bool result2 = IsConditionalControllable(specV,PkK,gVector,gk,ec);
76 
77 
78  if (result2) {
79  std::cout << "The language is conditionally controllable." << std::endl;
80  }
81  else {
82  std::cout << "The language is not conditionally controllable." << std::endl;
83  }
84 
85 
86  bool result3 = IsConditionalClosed(specV,PkK,gVector,gk);
87 
88  FAUDES_TEST_DUMP("is cond ctrl",result2);
89 
90  if (result3) {
91  std::cout << "The language is conditionally closed." << std::endl;
92  }
93  else {
94  std::cout << "The language is not conditionally closed." << std::endl;
95  }
96 
97  FAUDES_TEST_DUMP("is cond closed",result3);
98 
100 }
101 
#define FAUDES_TEST_DIFF()
Test protocol diff macro.
Definition: cfl_helper.h:493
#define FAUDES_TEST_DUMP(mes, dat)
Test protocol record macro ("mangle" filename for platform independance)
Definition: cfl_helper.h:483
Set of indices with symbolic names.
Definition: cfl_nameset.h:69
Vector template.
Generator with controllability attributes.
void Read(const std::string &rFileName, const std::string &rLabel="", const Type *pContext=0)
Read configuration data from file with label specified.
Definition: cfl_types.cpp:261
virtual void Append(const Type &rElem)
Append specified entry.
int main(void)
bool IsConditionalClosed(const GeneratorVector &specVect, const Generator &pk, const GeneratorVector &genVect, const Generator &gk)
Conditionalclosedness Checking Algorithm.
Definition: con_closed.cpp:16
bool IsConditionalControllable(const GeneratorVector &specVect, const Generator &pk, const GeneratorVector &genVect, const Generator &gk, const EventSet &ACntrl)
Conditionalcontrollability Checking Algorithm.
bool IsConditionalDecomposable(const Generator &gen, const EventSetVector &ee, const EventSet &ek, Generator &proof)
Conditionaldecomposability Checking Algorithm.
void aParallel(const Generator &rGen1, const Generator &rGen2, Generator &rResGen)
Parallel composition.
void Project(const Generator &rGen, const EventSet &rProjectAlphabet, Generator &rResGen)
Deterministic projection.
Includes all libFAUDES headers, incl plugings
libFAUDES resides within the namespace faudes.

libFAUDES 2.32b --- 2024.03.01 --- c++ api documentaion by doxygen