Tutorial, pushdown plugin. More... #include "libfaudes.h" #include "pd_include.h" Go to the source code of this file.
Detailed DescriptionTutorial, pushdown plugin. /** @file pd_tutorial.cpp
Tutorial, pushdown plugin.
@ingroup Tutorials
@include pd_tutorial.cpp
*/
/* Pushdown plugin for FAU Discrete Event Systems Library (libfaudes)
Copyright (C) 2013 Stefan Jacobi, Sven Schneider, Anne-Kathrin Hess
*/
#include "libfaudes.h"
#include "pd_include.h"
// make the faudes namespace available to our program
using namespace faudes;
int main(){
//*******************************
//create the specification, a pushdown generator
//*******************************
//insert states
g.InsState("s1");
g.InsState("s2");
g.InsState("s3");
//insert stack symbols
Idx lambda = g.InsStackSymbol(FAUDES_PD_LAMBDA); //always use FAUDES_PD_LAMBDA for empty stack symbol!
//insert events
g.InsControllableEvent("a");
g.InsEvent("b");
//build stack symbol vectors to be inserted as pop and push attributes of transitions
std::vector<Idx> vLambda;
vLambda.push_back(lambda);
std::vector<Idx> vSquare;
vSquare.push_back(square);
std::vector<Idx> vDot;
vDot.push_back(dot);
std::vector<Idx> vDotSquare;
vDotSquare.push_back(dot);
vDotSquare.push_back(square);
//insert transitions
//set state attributes
g.SetInitState("s1");
g.SetMarkedState("s1");
g.SetMarkedState("s2");
g.SetMarkedState("s3");
//*******************************
//create the plant, a DFA
//*******************************
System s;
s.InsState("s1");
s.InsState("s2");
s.InsState("s3");
s.InsControllableEvent("a");
s.InsEvent("b");
s.SetInitState("s1");
s.SetMarkedState("s3");
//*******************************
//print plant and specification
//*******************************
g.Write();
s.Write();
//*******************************
//call synthesis algorithm
//*******************************
PushdownGenerator rPd;
PushdownConstructController(g,s,rPd);
//*******************************
//print result
//*******************************
std::cout << "***************** RESULT *****************" << std::endl;
rPd.Write();
//*******************************
//print words that are possible in the closed loop (only "ab" expected)
//*******************************
LangK test(rPd);
test.FindLangK(50);
test.PrintWords();
return 0;
}
Definition in file pd_tutorial.cpp. Function Documentation
Definition at line 22 of file pd_tutorial.cpp. libFAUDES 2.24g --- 2014.09.15 --- c++ api documentaion by doxygen |