omg_4_rabinctrl.cpp
Go to the documentation of this file.
1 /** @file omg_4_rabinctrl.cpp
2 
3 Supervision of omega-languages w.r.t. Rabin acceptance
4 
5 @ingroup Tutorials
6 
7 @include omg_4_rabinctrl.cpp
8 
9 */
10 
11 #include "libfaudes.h"
12 
13 
14 // we make the faudes namespace available to our program
15 using namespace faudes;
16 
17 
18 int main() {
19 
20  // Early stage of development ... see whether we can recover
21  // the test cases from Buechi supervisory control.
22 
23  /////////////////////////////////////////////
24  // Control w.r.t Rabin specifications
25  //
26  // The A-B-Machine is a machine that can run process A (event a) or process B (event b).
27  // Per operation, the machine may succeed (event c) of fail (event d). However, it is
28  // guaranteed to eventually suceed when running the same process over and over again.
29  // We have three variations:
30  //
31  // 1: the std case
32  // 2: process B exhausts the machine: it will succeed in process B once and then
33  // fail on further processes B until process A was run.
34  // 3: process B breaks the machine: it will succeed in process B once and
35  // then fail in any further processes
36  //
37  // We synthesise controllers for 3 variant specifications
38  //
39  // 1. Alternate in successfully processing A and B
40  // 2. Keep on eventually succeeding in some process
41  // 3. Run optionally process A, eventually turn to B until success, repeat
42  //
43  /////////////////////////////////////////////
44 
45 
46  // Read A-B-Machines and specifications
47  System machineab1("data/omg_machineab1.gen");
48  System machineab2("data/omg_machineab2.gen");
49  System machineab3("data/omg_machineab3.gen");
50  Generator specab1("data/omg_specab1.gen");
51  Generator specab2("data/omg_specab2.gen");
52  Generator specab3("data/omg_specab3.gen");
53 
54  // compute a controllability prefix
55  const System& plant=machineab1;
56  const Generator& spec=specab3;
57  EventSet sigall = plant.Alphabet() + spec.Alphabet();
58  EventSet sigctrl = plant.ControllableEvents();
59  RabinAutomaton cand=spec;
60  cand.RabinAcceptance(cand.MarkedStates());
61  InvProject(cand,sigall);
62  Automaton(cand);
63  RabinBuechiProduct(cand,plant,cand);
64  //RabinBuechiAutomaton(cand,plant,cand);
65  cand.Write();
66  StateSet ctrlpfx;
67  RabinCtrlPfx(cand,sigctrl,ctrlpfx);
68  cand.WriteStateSet(ctrlpfx);
69  cand.RestrictStates(ctrlpfx);
70  // SupClosed(cand)
71  cand.RabinAcceptanceWrite();
72  cand.GraphWrite("tmp_omg_rabinctrl13.png");
73  Generator test=cand;
74  test.StateNamesEnabled(false);
75  test.InjectMarkedStates(cand.RabinAcceptance().Begin()->RSet());
76  StateMin(test,test);
77  test.GraphWrite("tmp_omg_rabinctrl13_test.png");
78 
79 
80 
81 
82 
83  return 0;
84 }
85 
const TaEventSet< EventAttr > & Alphabet(void) const
EventSet ControllableEvents(void) const
void RabinAcceptanceWrite(void) const
Definition: omg_rabinaut.h:348
virtual void RestrictStates(const StateSet &rStates)
Definition: omg_rabinaut.h:353
void RabinAcceptance(const faudes::RabinAcceptance &rRabAcc)
Definition: omg_rabinaut.h:324
void Write(const Type *pContext=0) const
Definition: cfl_types.cpp:145
const StateSet & MarkedStates(void) const
const EventSet & Alphabet(void) const
void WriteStateSet(const StateSet &rStateSet) const
void InjectMarkedStates(const StateSet &rNewMarkedStates)
bool StateNamesEnabled(void) const
void GraphWrite(const std::string &rFileName, const std::string &rOutFormat="", const std::string &rDotExec="dot") const
void StateMin(const Generator &rGen, Generator &rResGen)
void Automaton(Generator &rGen, const EventSet &rAlphabet)
void InvProject(Generator &rGen, const EventSet &rProjectAlphabet)
void RabinBuechiProduct(const RabinAutomaton &rRAut, const Generator &rBAut, RabinAutomaton &rRes)
void RabinCtrlPfx(const RabinAutomaton &rRAut, const EventSet &rSigmaCtrl, StateSet &rCtrlPfx)
int main()

libFAUDES 2.33h --- 2025.06.18 --- c++ api documentaion by doxygen