Commit 94fcef90 authored by sparsa's avatar sparsa

first commit

parents
[Dolphin]
Timestamp=2017,6,30,14,26,53
Version=4
[Settings]
HiddenFilesShown=true
INSTALLATION GUIDE :
1. Install c++ compiler g++ .
2. Install the graph drawing tool 'graphviz' using the following command in the terminal
sudo apt-get install graphviz
BUILD THE SOURCE FILES :
1.Come to the project folder 'mtp2' in the terminal
2. Execute the following command :
make
3. executable fileS named 'tree' and 'drawsystem' should be created
HOW TO RUN THE TOOL :
1. First write an input file corresponding the timed system. Sample example with explanation has been given in the file 'input/sample'. Let us consider you have created a file named 'automata.txt' in the folder './input'.
2. Run the following command in the terminal to see the automaton graphically :
./draw.sh input/automata.txt
3. Check for emptiness of the timed sytem by running the follwing command in the terminal:
./tree <input_file_path> <optional_param>
Example :
./tree input/automata.txt
Congrats, You have just done your job.
Example #stacks #clocks #states #tran Max Cons run time uppaal run time
p1 1 0 5 5 5 0.004 sec NA
p2 1 0 3 3 5 0.013 sec NA
p3 1 0 5 6 5 0.072 sec NA
p4 1 0 4 6 50 50 sec NA
p5 1 0 5 7 5 0.034 sec NA
t1 0 2 5 5 5 5.52 sec 0.002 sec
t2 0 2 2 3 9 84 sec 0.002 sec
t3 0 1 3 3 1 0.02 sec 0.002 sec
t4 0 2 3 4 5 3.13 sec 0.004 sec
t5 0 2 3 3 2 1.99 sec 0.004 sec
t6 0 1 3 4 2 0.05 sec 0.004 sec
t7 0 2 2 4 2 0.04 sec 0.004 sec
t8 0 2 4 6 2 2.64 sec 0.004 sec
t9 0 2 4 6 1 1.34 sec .004 sec
t10 0 3 6 8 6 279 sec 0.008 sec
t11 0 4 6 8 5 228 sec
tp1 1 2 3 4 2 538.892 sec NA
tp2 1 1 3 3 1 34.1568 sec NA
tp3 1 1 3 2 2 0.2379 sec NA
tp4 1 1 4 2 1 0.582661 sec NA
tp5 1 1 5 4 1 3.20973 NA
tp6 1 2 6 8 4 1.5 hours NA
Example |X| Transitions Maximum constants Run time
tp9 1 1 1 0.000437 seconds
tp10 1 1 2 0.00025 seconds
tp11 1 1 3 0.016949 seconds
tp12 1 1 4 0.015443 seconds
tp13 1 1 5 0.035402 seconds
tp14 1 1 10 0.105494 seconds
tp15 1 1 20 0.420387 seconds
tp16 1 1 50 2.0639 seconds
tp17 1 1 100 8.08796 seconds
tp17 1 1 120 11.4239 seconds
tp19 1 2 1 0.209932 seconds
tp20 1 2 2 0.692367 seconds
tp21 1 2 3 2.24773 seconds
tp22 1 2 4 8.06586 seconds
tp23 1 2 5 19.6632 seconds
tp24 1 2 6 36.236 seconds
tp25 1 2 7 141.894 seconds
tp26 1 2 8 290.82 seconds
tp27 1 2 9 428.632 seconds
tp28 1 3 1 0.264313 seconds
tp29 1 3 2 2.85213 seconds
tp30 1 3 3 8.32226 seconds
tp31 1 3 4 18.5062 seconds
tp33 1 3 5 35.0779 seconds
tp34 1 3 6 99.1919 seconds
tp35 1 3 7 234.359 seconds
tp36 1 3 8 370.326 seconds
tp37 1 3 9 966.927 seconds
tp38 1 4 1 (not completed in 20 min time with full color)
tp38 1 4 1 0.741028(4-colors)
tp39 1 4 2 6.90133(4-colors)
tp40 1 4 2 34.6366(4-colors)
tp41 1 4 3 42.9276(4-colors)
tp42 1 4 4 197.58(4-colors)
tp42 2 1 1 0.044485
tp43 2 1 2 0.048453
tp45 2 1 20 4.10182
tp46 2 1 50 21.0796
tp47 2 1 100 21.1479
tp48 2 2 1 0.950384
tp49 2 2 2 5.49052
tp49 2 2 3 13.1378
tp50 2 2 4 30.5954
tp51 2 2 5 47.9801
tp52 2 3 1 0.967496
tp53 2 3 2 4.23774
tp54 2 3 3 10.7196
tp55 2 3 4 22.2556
tp56 2 3 5
pushdown system :
#trans M time
6 0 0.000275
6 1 0.003488
6 2 0.010188
6 3 0.005319
6 4 0.022071
6 5 0.066717
6 6 0.023303
6 7 0.039065
6 8 0.067187
6 10 0.135559
15 0.572183
20 1.64088
25 3.78623
30 7.95845
35 15.8334
40 24.1085
45 37.6506
#trans run time
0 0.000243
1 0.001314
2 0.002179
3 0.002127
4 0.014129
5 0.024787
6 0.030262
7 0.034
14 2.98399
15 5.09424
25 16.6489
26 20.2956
29 23.9509
Ram in the machine : 8 gb
#cpus : 4
cpu model : Intel(R) Core(TM) i5-4690 CPU @ 3.50GHz
**********
New code : general one clock + one stack:
Eg. #trans M (sec)run time
tp17 1 120 0.000519
tp27 2 9 0.000172
tp61 2 10 0.000126
tp61 2 120 0.000368
tp37 3 9 0.001152
tp37 3 120 0.077424
tp42 4 4 0.00064
tp42 4 120 0.180572
***********
New code : general one clock + one stack:
Experiments done on tpg2(#tran = 6)
M time
1 0.000887
2 0.005571
3 0.03677
4 0.18576
5 0.732166
6 2.41135
7 6.72983
8 17.3284
9 45.1559
10 104.982
11 196.923
New code : general one clock + one stack:
Experiments done on (M == 5)
e.g. #trans time
1 0.000262
2 0.000318
3 0.000468
4 0.000758
5 0.001677
8 0.004263
9 0.00814
one stack + one clock(consecutive reset and transitions) :
e.g tps4(#transitions = 6)
M Run time
1 0.000343
3 0.00043
5 0.000517
7 0.000591
9 0.000918
10 0.001131
11 0.001349
12 0.001527
13 0.001925
14 0.002434
20 0.006207
25 0.014641
30 0.022661
35 0.039456
40 0.063975
50 0.146298
55 0.209322
60 0.29141
70 0.524645
80 0.935695
90 1.41289
100 2.11851
110 3.09092
120 4.33606
one stack + one clock(consecutive reset and transitions) tricky example(tps5) (#transitions=8) :
M Runtime
6 0.00295
7 0.004041
8 0.005887
10 0.009491
12 0.022176
15 0.045263
20 0.130269
25 0.231522
30 0.289782
40 0.776147
50 1.7009
70 5.93762
100 23.0724
one stack + one clock(consecutive reset and transitions) :
M = 10
E.G #trans Runtime
tps6 1 0.000176
tps7 2 0.000366
tps8 3 0.000295
tps9 4 0.000329
tps10 5 0.000335
why the graph is not smooth : Run time depdend on the particular structure of the automation. We are considering only timed system recognizes empty language. If the
language is empty, then all possible tree automata states will be generated.
(i) Maximal Constant
(ii) Depends on the constraints. As the number and constraints increases, less number of tree automata states will be generated.
(iii) How many possibility are there for the next transition coming and what are the possible tsm values.
(iv) How many push or pops are there. As the number of push pop increases, less number of possible tree automata states generated.
(v) Depends on the os scheduling(how much time given to this process)
Constraints :
1. GLobal time bound : [3,3]
2. Time bound on staying on junction 9 : [1,1]
3.
(i) After starting journey, bound on visiting time of place 1 : [2,3]
(ii) After starting journey, bound on visiting time of place 2 : [1,2]
(iii) After starting journey, bound on visiting time of place 3 : [1,1]
(iv) After visiting place 2, bound on visiting time of place 4 : [1,2]
(v) After visiting place 2, bound on visiting time of place 5 : [0,1]
(vi) After visiting place 2, bound on visiting time of place 6 : [0,1]
(vii) After visiting place 5, bound on visiting time of place 7 : [2,3]
(viii) After visiting place 5, bound on visiting time of place 8 : [0,1]
Automata Construction process :
1. Constraints (1) and (2) is similiar to earliar approach we discussed
2. For constraints (3), if the constraint is :
After visiting place i, bound on visiting time of place j : [a,b]
In this construction pop of symbol i denotes : visit of place i
Then, after popping symbol i, push the symbol j. When popping symbol j the bound is [a,b]
Experiments on nested maze : p26(#transitions 39) :
M run_time(sec)
0 0.106245
1 0.977339
2 4.40974
3 12.786
4 30.6616
5 65.925
6 130.821
7 232.286
8 382.595
9 574.995
(34, 0.0), (35, 0.0), (26, 0.0), (3, 0.0), (28, 0.0), (23, 0.0), (16, 0.0), (2, 0.0), (36, 0.0), (37, 0.0), (17, 0.0), (13, 0.0), (10, 0.0), (20, 0.0), (6, 0.0), (22, 0.0), (11, 0.0), (29, 0.0), (5, 0.0), (38, 0.0), (31, 0.0), (23, 0.0), (17, 0.0), (12, 0.0), (8, 0.0), (13, 0.0), (10, 0.0), (21, 0.0), (7, 0.0), (22, 0.0), (9, 0.0), (15, 0.0), (18, 0.0), (24, 0.0), (27, 0.0), (4, 0.0), (28, 0.0), (23, 0.0), (17, 0.0)
32 34 35 3 36 37 5 38 (22 13 30) 39
14 16 26 27 29 20 21 12 (9 10 11) 33
rm tree drawsystem main.o obj/*.o src/*.cpp~ include/*.h~
rm tree drawsystem main.o obj/*.o src/*.cpp~ include/*.h~
rm newinput/*.png newinput/*.out
rm input/*.png input/*.out
#!/bin/bash
name=$1
#echo $name
./drawsystem "$name" "$name.out"
dot -Tpng "$name.out" -o "$name.png"
for i in {1..67}
do
./draw.sh "input/tp$i"
done
File added
/*This file is for one clock and one stack general tpda*/
#include<vector>
#include<set>
#include<string>
using namespace std;
// state info for one clock and one stack general tpda
class tpdastate{
public:
char gc; /*0-th bit of gc is 1 iff push edge added to L, 7-th bit is 1 iff pop edge added to R, 1st bit is 1 iff gap between d1 and d2 is small, 2nd bit is 1 iff gap between d2 and d3 is small, 3rd bit is 1 iff gap between d3 and d4 is small */
char d1, d2, d3, d4; /* d1 : hanging reset trans for clock x1, d2 : trans at L, d3 : trans between L and R(reset trans for clock x1), d4 : trans at R
d1 == -1 if no hanging clock, d3 == -1 if only two points are there or there is a reset at R
*/
char w1, w2, w3, w4; // tsm values corresponding to trans d1,d2,d3 and d4 resp.
bool big(char i, char j); // distance between point i to point j is big
short int dist(char i, char j); // distance between point i to point j
// check if pop condition satisfied by the new transitions
bool popTest(char d5, char w5, int lb, int ub);
// check if after adding trans d5 with tsm w5, the clock constraint [lbc, ubc ] is satisfied or not
bool clockTest(char d5, char w5, int lbc, int ubc);
char getGc(char d5, char w5); // get new accuracy flag after adding trans d5 with tsm w5
// add next transition to the state rs
vector<tpdastate*> addNextTPDA();
// shuffle of two states
tpdastate* shuffle(tpdastate *s2);
tpdastate* copyState(); // create a copy of this state and return
bool isFinal(); // return true if this state is final
void print(); // print a state of tree automation
};
// run of the timed system
class gtpda_run{
public :
char P; // #points
char *del; // transitions
//char *ac; // accuracy between two consecutive points
char *w; // tsm values
gtpda_run* add_next(char d5, char w5); // new run after adding trans d5 of tsm w5
gtpda_run* shuffle(gtpda_run *s2);
void print();
};
// info to keep track which states generates which states
class bp_gtpda{
public :
char type; // type of operation : atomic : 0, add_stack : 1, shuffle : 2
int left; // shuffle left state index of all the states generated bottom-up
int right; // shuffle right state index of all the states generated bottom-up
};
extern set<string> gtpdatrie;
// atomic state
tpdastate* atomictpda(char d1, char d2, char d3, char d4, char w1, char w2, char w3, char w4, char gc);
bool identity(tpdastate *vs); // return 1 iff vs is a new state
// check if a tpda of one clock is empty or not
bool isEmptyTPDA();
gtpda_run* getatomicrunpds(tpdastate*); // get run for an atomic states
typedef unsigned char weighttype;
typedef unsigned char deltatype; // type used depending on the #transitions in the automation
extern weighttype B;
class transition{
public:
unsigned short int source; // source state
unsigned short int target; // target state
char a; // action in this transition
//char op; // stack operation in this transition
char as; // stack symbol in this transition
char ps; // push symbol in this transition
char pp; // pop symbol in this transition
int guard; // Let i-th bit of guard from right hand is g_i
int reset; // Let i-th bit of reset from right hand is r_i
/*
0-th bit of gurad and reset is for stack operation
1 to 15-th bits are for clock(15 clock supported)
g_i=1(1<=i<=15) : i-th clock is checked in this transition
r_i=1(1<=i<=15) : i-th clock is reset in this transition
g_0=0 && r_0=0 : no stack operation
g_0=1 && r_0=0 : stack push operation
g_0=0 && r_0=1 : stack pop operation
g_0=1 && r_0=1 : invalid : push and pop at the same time not possible
*/
int *lbs; // constraint lower bounds
int *ubs; // constraint upper bounds
/*
size of lbs and ubs is equal to (|X|+1), where |X| is the number of clocks
lbs[0] : lower bound for pop operation
lbs[i](1<=i<=15) : lower bound for i-th clock
ubs[0] : upper bound for pop operation
ubs[i](1<=i<=15) : upper bound for i-th clock
*/
bool isReset(char i);
};
extern char inputfilename[100]; // input file name for timed push-down system
extern int M; // maximum constant+1 in the timed system
extern unsigned short int S; // number of states in the timed system
extern unsigned short int T; // number of transitions in the timed system
extern unsigned short int SI; // initial state
extern unsigned short int SF; // final state
extern char X; // number of clocks in the timed system
extern char A; // number of events or actions in the timed system
extern char AS; // number of stack symbols in the timed system
extern transition *transitions; // transitions of the timed system
void inputSystem(); // get the input timed system given as a file(file name stored in the global variable 'inputfilename')
void print_system();
#include<iostream>
#include<vector>
#include<set>
using namespace std;
extern set<string> pstrie;
// datatype for a state of final tree automation
class pds_state{
public:
char del1; // transition at first active color
char del2; // transition at second active color
char w1;
char w2;
char gc;
pds_state* add_stack();
pds_state* shuffle(pds_state *s2); // shuffle with state s2
bool isFinal(); // check if this state is a final state
void print(); // print a state
};
bool identity(pds_state *vs);
pds_state* atomic(char del1, char del2, char w1, char w2, char gc);
bool pdsempty();
class pds_run{
public :
char P; // #points
char *del; // transitions
char *ac; // accuracy between two consecutive points
char *w; // tsm values
pds_run* add_stack();
pds_run* shuffle(pds_run *s2);
void print();
};
class bp_pds{
public :
char type; // type of operation : atomic : 0, add_stack : 1, shuffle : 2
int left; // shuffle left state index of all the states generated bottom-up
int right; // shuffle right state index of all the states generated bottom-up
};
pds_run* getatomicrunpds(pds_state*);
#include<vector>
using namespace std;
class transition{
public:
short source; // source state
short target; // target state
char a; // action in this transition
char as; // stack symbol in this transition, **** this variable is obsolete in new version of code
char ps; // push symbol in this transition
char pp; // pop symbol in this transition
int guard; // Let i-th bit of guard from right hand is g_i
int reset; // Let i-th bit of reset from right hand is r_i
int openl; // i-th bit openl is 1 iff lower bound of constraint for clock i is open
int openu; // i-th bit openr is 1 iff upper bound of constraint for clock i is open
/*
0-th bit of gurad and reset is for stack operation
1 to 15-th bits are for clock(15 clock supported)
g_i=1(1<=i<=15) : i-th clock is checked in this transition
r_i=1(1<=i<=15) : i-th clock is reset in this transition
g_0=0 && r_0=0 : no stack operation
g_0=1 && r_0=0 : stack push operation
g_0=0 && r_0=1 : stack pop operation
g_0=1 && r_0=1 : invalid : push and pop at the same time not possible
*/
int *lbs; // constraint lower bounds
int *ubs; // constraint upper bounds
/*
size of lbs and ubs is equal to (|X|+1), where |X| is the number of clocks
lbs[0] : lower bound for pop operation
lbs[i](1<=i<=15) : lower bound for i-th clock
ubs[0] : upper bound for pop operation
ubs[i](1<=i<=15) : upper bound for i-th clock
*/
};
extern char inputfilename[100]; // input file name for timed push-down system
extern int M; // maximum constant+1 in the timed system
extern short S; // number of states in the timed system
extern short T; // number of transitions in the timed system
extern short SI; // initial state
extern short SF; // final state
extern char X; // number of clocks in the timed system
extern char A; // number of events or actions in the timed system
extern char AS; // number of stack symbols in the timed system
extern transition *transitions; // transitions of the timed system
extern vector<vector<short> > prevtrans; // prevtrans[i] : list of previous transitions for state i
extern vector<vector<short> > nexttrans; // nexttrans[i] : list of next transitions for state i
extern vector<vector<short> > resettrans; // resettrans[i] : list of reset transitions for clock i
extern vector<vector<short> > checktrans; // checktrans[i] : list of check transitions for clock i
extern vector<vector<pair<short, short> > > resecktrans; // resecktrans[i] : list of reset-check transitions for clock i
// this applies for one clock TPDA
extern vector<vector<short> > possibleresets; // possibleresets[t] : list of reset transitions for clock x_1 possible for the check transition t of clock x_1
// pushDone[t][w] : 1 iff atomic state generated with starting trans t with tsm w
extern bool** pushDone;
// if d1 and d2 are valid pair of reset-check for only clock x1(used for one clock + one stack special tpda)
bool isPossibleReset(char d1, char d2);
void getresecktrans(); // get all the reset-check pair of transition for some clock
void inputSystem(); // get the input timed system given as a file(file name stored in the global variable 'inputfilename')
void print_system(); // print system details
// is clock x has been reset at transition delta
bool isReset(char x, short int delta);
// is clock x has been checked at transition delta
bool isChecked(char x, short int delta);
// is there a push at transition delta
bool isPush(short int delta);
// is there a pop at transition delta
bool isPop(short int delta);
// return a mod b(always return a +ve number unlike c % operator)
short int mod(short int a, short int b);
/*This file is for one clock and one stack special(contiguous reset and check of the clock) tpda*/
#include<vector>
#include<set>
#include<string>
using namespace std;
// state info for one clock and one stack general tpda
class stpdastate{
public:
char gc; /*0-th bit of gc is 1 iff push edge added to L, 7-th bit is 1 iff pop edge added to R, 1st bit is 1 iff gap between d1 and d2 is small, 2nd bit is 1 iff gap between d2 and d3 is small, 3rd bit is 1 iff gap between d3 and d4 is small */
char d1, d2; /* d1 : hanging reset trans for clock x1, d2 : trans at L, d3 : trans between L and R(reset trans for clock x1), d4 : trans at R
d1 == -1 if no hanging clock, d3 == -1 if only two points are there or there is a reset at R
*/
char w1, w2; // tsm values corresponding to trans d1,d2,d3 and d4 resp.
// add next transition to the state rs
vector<stpdastate*> addNextTPDA();
// shuffle of two states
stpdastate* shuffle(stpdastate *s2);
bool isFinal(); // return true if this state is final
void print(); // print a state of tree automation
};
// run of the timed system
class stpda_run{
public :
char P; // #points
char *del; // transitions
char *w; // tsm values
stpda_run* add_next(char d5, char w5); // new run after adding trans d5 of tsm w5
stpda_run* shuffle(stpda_run *s2);
void print();
};
// info to keep track which states generates which states
class bp_stpda{
public :
char type; // type of operation : atomic : 0, add_stack : 1, shuffle : 2
int left; // shuffle left state index of all the states generated bottom-up
int right; // shuffle right state index of all the states generated bottom-up
};
extern set<string> gtpdatrie;
// atomic state
stpdastate* atomicstpda(char d1, char d2, char w1, char w2, char gc);
bool identity(stpdastate *vs); // return 1 iff vs is a new state
// check if a tpda of one clock is empty or not
bool isEmptySTPDA();
stpda_run* getatomicrunstpda(stpdastate*); // get run for an atomic states
// This file is for general TPDA emptiness checking with continuous implementation, pop and push also can happen at the same transition
#include<vector>
#include<set>
#include<string>
#include <unordered_map>
using namespace std;
#define a3215 32768 // 2^15 shortcut
// state for general TPDA with pop ande push happens at the same time
class stateGCPP{
public:
char P; // number of points in this state
short f; // flag variable contain accuracy between consecutive points and push-pop edge information
char *del; // transitions in this state
char *w; // tsm values in this state
char L; // left point of the non-trivial block
bool big(char i, char j); // return true iff distance between point i to point j is big
short int dist(char i, char j); // return distance between point i to point j
// add next transition to this state if possible and return all generated states by doing this operation
vector<stateGCPP*> addNextTPDA();
// add transition 'dn' to this state and then forget some points if possible, return the new state, tsm value of last point not decided yet
stateGCPP* reduce(char dn);
// return true iff clock gurards on new transition 'dn' with tsm value 'wn' is satisfied
bool consSatisfied(char dn, char wn, short *clockDis, bool *clockAcc);
// check for stack constraint where 'dlr' and 'aclr' are distance and accuracy resp. from L to R
bool stackCheck(char dn, char wn, short dlr, bool aclr);
// reduce the #points after shuffle operation by using forget operation if possible
stateGCPP* reduceShuffle(stateGCPP* vs);
// check if shuffle of this state with s2 is possible
bool shuffleCheck(stateGCPP *s2);
// return shuffle of this state with s2
stateGCPP* shuffle(stateGCPP *s2);
// Return the first successor state whoose childrens will be right state for shuffle with current state
stateGCPP* sucState();
bool isFinal(); // return true iff this state is final
void print(); // print this state
// return unique string for last reset points of a state participating in a combine operation as a left state
string getKeyLeft();
// return unique string for hanging points of a state participating in a combine operation as a right state
string getKeyRight();
};
// partial run of the timed system as a sequence of pairs: (1) transition and (2) tsm value
class runCGPP{
public :
char P; // #points
char *del; // transitions
char *w; // tsm values
runCGPP* addNext(char dn, char wn); // new run after adding transition 'dn' of tsm value 'wn'
runCGPP* shuffle(runCGPP *s2); // concatenation of two partial runs
void print(); // print the run with concrete global time stamps
};
// info to keep track parents of current state or who are the states generated current state
class trackCGPP{
public :
char type; //***** type of operation : atomic : 0, addNextTPDA : 1, shuffle or combine : 2
int left; // *****shuffle left state index in the main vector
int right; // ****shuffle right state index in the main vector
};
// this is used for checking if newly generated state was already generated earlier or not
//extern set<string> tpdaGCPPtrie;
// alternative : this is used for checking if newly generated state was already generated earlier or not
extern unordered_map<string,bool> mapGCPP;
// this vector contains all the states generated for a TPDA with corresponding tracking information
extern vector<pair<stateGCPP*, trackCGPP*> > allStates;
// get the partial run corresponding the tree automata state vs, ignore the hanging points
runCGPP* getRun(stateGCPP* vs);
// return true iff language recognized by the TPDA is empty
bool isEmptyGCPP();
// This file is for general TPDA emptiness checking with continuous implementation, pop and push also can happen at the same transition
#include<vector>
#include<string>
#include <unordered_map>
using namespace std;
// index is a function from 2d array index to 1d array index considering all diagonal elements are 0
#define index(i, j, n) ( i*n + j - i - (j < i ? 0 : 1) )
extern short **WT1, **WT2; // used as temporary storage for weight matrix in floyd warshal algorithm
extern bool **open1, **open2; // temporary variables for storing some edge weight is strictly less than some integer or not
// state for timed automata
class stateZone{
public:
char P; // number of points in this state
char f; // 7-th bit is 1 iff push at L is done, rightmost 7 bits used for L or L = f & 127
char *del; // transitions in this state
short *w; // forward and backward edges weight, this will act like a 2d array, index can calculated using function index(i, j, n) defined tpdaZone.h
// add next transition to this state if possible and return all generated states by doing this operation
stateZone* addNextTPDA(char dn);
// check if shuffle of this state with s2 is possible
bool shuffleCheck(stateZone *s2);
// return shuffle of this state with s2
stateZone* shuffle(stateZone *s2);
// Return the first successor state whoose childrens will be right state for shuffle with current state
stateZone* sucState();
bool isFinal(); // return true iff this state is final
void print(); // print this state
// return unique string for last reset points of a state participating in a combine operation as a left state
string getKeyLeft();
// return unique string for hanging points of a state participating in a combine operation as a right state
string getKeyRight();
};
// partial run of the timed system as a sequence of pairs: (1) transition and (2) tsm value
class runZone{
public :
short P; // #points
char *del; // transitions
short **w; // weight matrix
runZone* addNext(char dn, char wn); // new run after adding transition 'dn' of tsm value 'wn'
runZone* shuffle(runZone *s2); // concatenation of two partial runs
void print(); // print the run with concrete global time stamps
};
// info to keep track parents of current state or who are the states generated current state
class trackZone{
public :
char type; //***** type of operation : atomic : 0, addNextTPDA : 1, shuffle or combine : 2
int left; // *****shuffle left state index in the main vector
int right; // ****shuffle right state index in the main vector
};
//this is used for checking if newly generated state was already generated earlier or not
extern unordered_map<string,bool> mapZone;
// this vector contains all the states generated for a TPDA with corresponding tracking information
extern vector<pair<stateZone*, trackZone*> > allStatesZone;
// get the partial run corresponding the tree automata state vs, ignore the hanging points
runZone* getRun(stateZone* vs);
// return true iff language recognized by the TPDA is empty
bool isEmptyZone();
// apply all pair shortest path algorithms for the graph with n number of nodes(edge weight given in w)
void allPairSP(int n);
\ No newline at end of file
#include<string>
#include<limits.h>
using namespace std;
typedef unsigned short int usint;
typedef unsigned int uint;
typedef unsigned long long int ullint;
typedef unsigned char uchar;
//TINDEX : given two pair of integers, find the position in 1d array
#define BY2(i) (i >> 1) // divide by 2 ...
#define BY4(i) (i >> 2)
#define BY8(i) (i >> 3)
#define BY16(i) (i >> 4)
#define INF (INT_MAX >> 1) //now infinity value is maximum integer divided by 2
#define INF16 (a32[14])
extern unsigned int a32[]; /* a contains all the binary strings where only one bit is '1'
a[i] contains binary number where only (i-1)-th from right side is '1'(bit position starts from 0 from right hand side) */
extern unsigned int b32[];/*b[i] contains an integer where all bits are '1' from zeroth bit position upto (i-1)-th bit position
For example, b[4] contains binary number 00..01111 or integer 15
*/
extern unsigned int c32[];/*c[i] contains an integer where all bits are '1' from i+1-th bit position upto last bit position
For example, c[4] contains binary number 11..10000 or integer -16
*/
extern unsigned int d32[]; /* a contains all the binary strings where only one bit is '1'
a[i] contains binary number where only (i-1)-th from right side is '1'(bit position starts from 0 from right hand side) */
extern char K; // this denote number of maximum active colors
void setBits(); // set all the global bit variables
int noofones(unsigned int x, int B); // #ones upto B bits
string inttobinary(int x); // return binary string corresponding to number x
8 7 0 0 2
1
8
1 2 0 0 0
0
2 3 0 0 0
1 1
3 4 0 0 0
3 1 1 1 2
4 5 0 0 0
2 2 1 -1
5 6 0 0 0
0
6 7 0 0 0
1 1
7 8 0 0 0
2 1 1 -1
0 0 0
0 0 0
5 5 2 0 1
1
5
1 2 0 0 1
1
0
2 3 0 0 1
2
0
3 4 0 1 1
1 0 2
2
0
4 2 0 1 0
2 1 1
1 1
4 1 0 0 1
2
2 1 0 -1
4 11 2 9 1
1
4
1 2 1 0 0
0
2 3 2 1 1
1 1 2
2
0
3 4 3 1 0
2 0 1
1 1
4 2 4 1 0
1 1 2
0
2 4 5 1 2
2 1 2
1 2
0
4 3 6 0 1
1
0
3 2 7 0 0
2 1 2 2
2 1 8 0 0
0
1 4 9 2 0
1 0 2
2 1 1
0
1 1 0 0 1
2
0
3 3 0 0 1
1
0
//TPDA corresponding to this file used to demonstrate the example in the report
4 4 2 0 2
1
4
1 2 0 1 1
2 2 3
1
1 1
1 4 0 0 0
2 2 2 2
2 3 0 2 0
1 0 2
2 1 2
3 1 0 2 2
3 1 0 0 2
1 2
0
******CORRESPONDING TO THE ABOVE INPUT REFER TO THE TIMED SYSTEM GIVEN IN THE PICTURE 'sample.png' *******
Transition description of the automaton :
Each transition contain four information :
(i) Transition number(Transition number 3 shown as : 'tn:3')
(ii) Clock constraint(x1>=2 && x2==3 is shown as : '2 <= x1 <= inf, 3<=x2<=3')(for tpda and timed automation)
(iii) Update or reset of clocks(x1:=0,x2:=0 is shown as : 'x1:=0,x2:=0')(for tpda and timed automation)
(iv) Stack Operations :(for tpda and pushdown system with age checking while popping)
(a) Nop(No operation) : shown as : 'np'.
(b) push symbol 2 : shown as 'ps_2'.
(c) Pop symbol 2 with age between 2 and 5 shown as : 'pp_2:2<=ag(2)<=5'
INPUT FORMAT(Ignore blank lines and spaces) :
1. First line of the input(5 space separated integers) : <#states> <#transitions> <#clocks> <#actions> <#stack_symbols>
In the above example, Input for the first line is : 3 3 2 0 2
Number of states is 3( they are numbered as 1, 2 and 3)
Number of transitions is 3( they are numbered as 1, 2 and 3)
Two clocks are there( they are numbered as x_1 and x_2 )
Actions are not important for us, So simply enter 0 in place of 'number of actions'
Number of stack symbols is 2( they are numbered as 1 and 2)
2. Second line : Initial state number(1 is the initial state for the above example)
3. Third line : Final state number(4 is the final state for the above example)
4. For each transitions, there can be variable number of lines.
First line of each transition(5 space separated integers) : <source_state> <target_state> <action> <#guards> <#resets>
For the above example, in the first transition :
source state : 1
target state : 2
action : 0(action is not important for us, just put 0 in place of action)
#guards : number of clock checks are there
#resets : number of clock reset at this transition
If number of clock check(#guards) is m, then each of the next m lines will have three space separated intergers : <clock_number> <lower_bound> <upper_bound>
clock_number : clock(x) for which there is a check in this transition
lower bound : x >= lower_bound is the lower bound constraint
upper bound : x <= upper_bound is the upper bound constraint
overall the constraint is lower_bound <= x <= upper_bound
If number of clock reset at this transition is n, then the next line has n space separated integers : Each integer is a clocks_number has been reset in this transition
Last line of the input can contain maximum 5 space separated integers : <stack_op>
The value of first integer determine the stack operation
First interger is 0 : no stack operation
First interger is 1 : Only stack push operation, This integer will be followed by another integer : <stack_symbol_2>
First interger is 2 : Only stack pop operation, This integer will be followed by another three space separated integers : <stack_symbol> <lower_bound> <upper_bound>
First interger is 3 : Both pop and push happens at this transition, This integer will be followed by another four space separated integers : <stack_symbol> <lower_bound> <upper_bound> <stack_symbol_2>
where
<stack_symbol> : stack symbol number popped in this transition
<lower_bound> : lower bound on the age of the stack symbol currently popped in this transition
<upper_bound> : lower bound on the age of the stack symbol currently popped in this transition
<stack_symbol_2> : stack symbol number pushed in this transition
6 5 2 3 0
1
6
1 2 1 1 1
2 5 -1
2
0
2 3 0 1 0
1 0 4
0
5 4 1 1 0
1 0 4
0
1 5 0 1 1
1 2 -1
2
0
4 3 0 1 0
2 5 -1
0
// edit the ages for checking emptiness
6 8 3 3 0
1
5
1 2 0 1 0
1 4 -1
0
1 3 1 1 1
3 1 1
2
0
2 6 0 2 0
1 1 6
2 0 1
0
3 4 1 0 2
3 1
0
3 5 0 1 0
1 0 0
0
4 5 2 2 0
1 1 1
2 0 0
0
6 3 3 1 0
1 1 1
0
6 5 0 2 0
1 0 1
2 1 -1
0
00 00
7 8 4 3 0
1
7
1 2 0 1 1
2 5 -1
1
0
1 3 1 1 2
3 3 -1
2 3
0
2 3 0 1 1
1 2 2
2
0
3 4 1 2 1
3 0 5
2 0 2
3
0
4 5 0 1 1
4 3 3
4
0
4 6 2 1 2
3 0 1
3 4
0
5 6 3 2 1
1 2 2
2 2 2
4
0
6 3 0 1 1
4 1 1
1
0
00 00
6 7 3 3 0
1
3
1 4 0 2 2
1 1 3
2 2 2
1 2
0
1 2 1 1 1
3 3 -1
2
0
2 3 2 1 1
1 1 2
3
0
2 5 3 1 1
2 1 3
3
0
4 3 2 1 1
3 0 0
1
0
5 6 1 2 0
1 1 1
3 2 2
0
6 1 0 1 1
3 1 3
2
0
00 00
4 6 2 4 0
4
3
4 1 1 1 1
1 0 -1
2
0
1 2 2 1 0
2 1 1
0
1 3 1 2 0
1 0 0
2 1 -1
0
2 3 3 1 0
1 0 0
0
3 3 4 1 0
1 2 -1
0
3 1 1 1 1
2 0 0
2
0
http://computerscience.unicam.it/tesei/pubdownload/T04Phd.pdf
fig 2.5
10 9 2 0 1
1
10
1 2 0 0 1
1
0
2 3 0 0 2
1 2
0
3 4 0 0 1
2
0
4 5 0 0 0
1 1
5 6 0 0 0
0
6 7 0 0 2
1 2
0
7 8 0 1 0
1 10 18
0
8 9 0 0 1
1
0
9 10 0 0 0
2 1 0 9
M Run_time
1 0.000565
2 0.001978
3 0.008165
4 0.023927
5 0.083782
6 0.15712
7 0.375192
8 0.672718
9 1.28486
10 2.00171
12 4.94463
14 10.8798
16 21.9186
18 bad memory allocation(#states : 5716700 )
\ No newline at end of file
4 4 1 2 1
4
1
1 2 1 1 0
1 1 1
0
2 3 2 0 1
1
2 1 1 -1
3 4 0 1 0
1 0 0
0
4 1 0 0 1
1
1 1
00 00
|X| = 1
|T| = 4
|M| = 1
10 9 3 0 1
1
10
1 2 0 0 2
2 3
0
2 3 0 0 1
2
0
3 4 0 0 0
1 1
4 5 0 0 0
0
5 6 0 0 2
1 2
0
6 7 0 0 2
2 3
0
7 8 0 1 0
1 7 12
0
8 9 0 0 1
3
0
9 10 0 0 0
2 1 0 6
M Run_time
1 0.004453
2 0.010471
3 0.031199
4 0.152298
5 0.451474
6 1.0779
7 2.67533
8 5.42333
9 11.2027
10 20.8801
11 35.6042
12 bad mem allocation(#states : 3526500)
\ No newline at end of file
6 8 2 3 2
1
5
1 2 0 1 0
1 1 -1
1 1
1 3 1 1 1
1 1 1
2
0
2 6 0 2 0
1 1 1
2 0 3
0
3 4 1 0 2
2 1
0
3 5 0 1 0
1 0 0
0
4 5 2 2 0
1 1 1
2 0 0
0
6 3 3 1 0
1 1 1
0
6 5 0 2 0
1 0 1
2 1 -1
2 1 1 1
00 00
5 6 1 0 1
1
4
1 2 0 1 0
1 0 0
0
2 3 0 0 0
1 1
3 4 0 0 0
0
4 1 0 1 1
1 0 2
1
2 1 0 -1
3 5 0 0 1
1
0
5 4 0 1 0
1 0 0
2 1 0 0
00 00
|X| = 1
|T| = 3
|M| = 5
5 6 1 0 1
1
5
1 2 0 0 1
1
1 1
1 3 0 1 0
1 3 -1
0
2 3 0 1 0
1 1 -1
0
3 4 0 1 0
1 3 100
0
3 5 0 1 0
1 0 2
0
4 5 0 0 0
2 1 2 3
00 00
|X| = 1
|T| = 2
|M| = 9
5 8 1 2 2
1
5
1 2 0 0 0
1 2
1 5 0 1 0
1 1 2
2 2 6 8
2 1 0 0 0
0
2 2 0 1 1
1 1 1
1
1 1
2 3 0 1 0
1 0 1
0
3 4 0 0 0
0
4 2 0 1 0
1 0 2
0
4 4 0 0 0
2 1 1 2
5 4 1 1 1
1
5
1 2 0 0 0
0
2 3 0 0 0
1 1
3 4 0 0 0
2 1 1 2
4 5 0 0 0
3 1 0 -1 1
14 26 1 1 2
1
1
1 2 0 0 0
1 1
2 3 0 0 0
0
3 2 0 0 0
0
3 4 0 0 0
0
4 3 0 0 0
0
4 5 0 0 0
0
5 4 0 0 0
0
5 6 0 0 0
0
6 5 0 0 0
0
6 7 0 0 0
0
7 6 0 0 0
0
7 8 0 0 0
0
8 7 0 0 0
0
8 9 0 0 0
0
9 8 0 0 0
0
9 10 0 0 0
0
10 9 0 0 0
0
10 11 0 0 0
0
11 10 0 0 0
0
11 12 0 0 0
0
12 11 0 0 0
0
12 13 0 0 0
0
13 12 0 0 0
0
13 14 0 0 0
0
14 13 0 0 0
0
2 1 0 1 0
1 6 10
2 1 11 15
T Time
2 0.000355
4 0.134996
6 0.223448
8 0.281873
10 0.381145
12 0.526717
14 0.650515
16 0.772484
18 0.836541
20 1.01429
22 1.04948
24 1.15572
26 1.26705
8 7 1 0 2
1
8
1 2 0 0 1
1
0
2 3 0 0 0
1 1
3 4 0 0 1
1
3 1 1 1 2
4 5 0 0 0
2 2 1 -1
5 6 0 0 1
1
0
6 7 0 0 0
1 1
7 8 0 0 0
2 1 1 -1
0 0 0
0 0 0
26 24 16 0 0
1
26
1 2 0 0 1
1
0
2 3 0 0 1
2
0
3 4 0 0 1
3
0
4 5 0 0 1
4
0
5 6 0 0 1
5
0
6 7 0 0 1
6
0
7 8 0 0 1
7
0
8 9 0 0 1
8
0
9 10 0 0 1
9
0
10 11 0 0 1
10
0
11 12 0 0 1
11
0
12 13 0 0 1
12
0
13 14 0 0 1
13
0
14 15 0 0 1
14
0
15 16 0 0 1
15
0
16 17 0 0 1
16
0
17 18 0 2 0
9 1 1
1 2 2
0
18 19 0 2 0
10 1 1
2 2 2
0
19 20 0 2 0
11 1 1
3 2 2
0
20 21 0 2 0
12 1 1
4 2 2
0
21 22 0 2 0
13 1 1
5 2 2
0
22 23 0 2 0
14 1 1
6 2 2
0
23 24 0 2 0
15 1 1
7 2 2
0
24 25 0 2 0
16 1 1
8 2 2
0
8 6 2 0 1
1
8
1 2 0 1 1
1 3 11
2
0
2 3 0 1 1
2 2 13
2
0
3 4 0 1 0
2 1 15
1 1
4 5 0 1 1
2 0 10
1
1 1
5 6 0 0 1
1
2 1 2 6
6 7 0 1 1
2 0 -1
2
2 1 3 9
12 11 2 0 2
1
12
1 2 0 1 1
1 0 0
1
0
2 3 0 1 0
1 0 0
1 1
3 4 0 1 1
2 0 0
2
0
4 5 0 0 0
1 1
5 6 0 1 0
1 0 0
0
6 7 0 1 2
2 0 0
1 2
2 1 0 0
7 8 0 0 0
3 1 0 0 2
8 9 0 1 1
1 0 0
2
0
9 10 0 1 2
2 0 0
1 2
0
10 11 0 1 1
1 0 0
1
0
11 12 0 1 0
1 0 0
2 2 0 0
8 8 1 1 2
1
8
1 2 0 0 0
1 2
2 3 0 1 0
1 0 -1
1 1
3 4 0 0 1
1
2 1 1 2
4 5 0 0 0
1 1
5 6 0 1 0
1 1 1
2 1 0 -1
6 1 0 1 1
1 0 1
1
2 2 0 1
2 7 0 1 1
1 1 2
1
1 2
7 3 0 1 1
1 1 2
1
2 2 2 2
6 6 1 1 2
1
1
1 2 0 0 0
1 2
2 3 0 1 0
1 0 -1
1 1
3 4 0 0 1
1
2 1 1 5
4 5 0 0 0
1 1
5 6 0 1 0
1 1 1
2 1 0 -1
6 1 0 1 1
1 0 1
1
2 2 0 1
10 14 1 1 3
1
6
1 2 0 0 1
1
1 1
1 9 0 0 0
1 2
2 8 0 1 0
1 4 5
0
3 2 0 0 1
1
0
4 3 0 1 0
1 3 5
0
4 5 0 1 0
1 1 2
0
5 6 0 0 0
2 2 1 2
6 7 0 0 0
1 3
7 10 0 0 1
1
2 3 0 5
8 4 0 1 0
1 3 4
0
8 6 0 0 0
2 1 2 3
9 7 0 1 0
1 4 5
0
9 8 0 0 1
1
0
10 1 0 1 1
1 1 -1
1
0
4 5 1 1 2
1
1
1 2 0 1 1
1 0 2
1
1 1
1 3 0 1 1
1 1 1
1
1 2
2 3 0 1 1
1 3 4
1
1 2
3 4 0 1 1
1 2 6
1
2 2 3 7
4 1 0 1 1
1 6 8
1
2 1 5 10
5 6 1 1 2
1
1
1 2 0 1 1
1 0 2
1
1 1
1 5 0 1 1
1 2 4
1
1 1
2 3 0 1 1
1 3 4
1
1 2
3 4 0 1 1
1 2 6
1
2 2 3 7
4 1 0 1 1
1 6 8
1
2 1 5 10
5 3 0 1 1
1 1 4
1
1 2
4 6 1 0 2
1
4
1 2 0 1 1
1 0 0
1
1 2
2 2 0 1 1
1 0 0
1
1 1
2 3 0 1 1
1 0 0
1
0
3 2 0 1 1
1 0 0
1
0
3 3 0 1 1
1 1 1
1
2 1 0 -1
3 4 0 1 1
1 0 0
1
2 2 2 2
6 6 1 0 2
1
6
1 2 0 0 1
1
1 1
2 3 0 1 1
1 1 1
1
1 2
3 4 0 0 0
2 2 0 1
4 1 0 0 0
2 1 1 1
1 5 0 0 1
1
0
5 3 0 1 0
1 0 1
0
5 8 1 1 2
1
5
1 1 0 1 1
1 0 0
1
1 1
1 2 0 1 1
1 0 0
1
1 2
2 1 0 1 1
1 1 2
1
0
2 3 0 1 1
1 3 3
1
0
3 1 0 1 1
1 0 0
1
0
3 4 0 1 1
1 0 0
1
2 2 0 -1
4 3 0 1 1
1 1 1
1
0
1 5 0 1 1
1 0 0
1
2 1 6 6
5 4 1 1 2
1
5
1 2 0 1 1
1 0 2
1
1 1
2 3 0 1 1
1 1 2
1
1 2
3 4 0 1 1
1 2 2
1
2 2 1 2
4 1 0 1 1
1 2 2
1
2 1 0 2
#include<math.h> // c headers
#include<string.h>
#include <time.h>
#include <string> // c++ headers
#include<vector>
#include"timePushDown.h" // TPDA file processing, representation(all info about the TPDA is in this file)
#include"treeBitOperations.h" // bit wise operations
#include"pds.h" // system with no extra clocks
#include"tpda2.h" // one clock special kind of TPDA
#include<continuoustpda.h> // one clock TPDA
#include<tpdaCGPP.h> // general TPDA
#include<tpdaZone.h> // general TPDA with zone
using namespace std;
// process the input TPDA file and set all the global variables according to the TPDA
void setGlobal(char *filename) {
setBits(); // set variables for bitwise operations(defined in "treeBitOperations.h")
M = 0; // set maximum constant to 0, we update it when reading the system
strcpy(inputfilename, filename); // copy the input timed system input file name to the variable 'inputfilename'
inputSystem(); // process the input TPDA(defined in "timePushDown.h")
if(X != 0)
getresecktrans(); // which are the compatible reset transition with some check transition
M = M + 1; // maximum constant for the system(computed M in the function inputSystem() + 1 )
if(X == 0) // no clock, push-down system, tree-width 2, so #colors = 3
K = 3;
else if(AS == 0) // #stack symbols = 0, timed automata, tree-width X+1, #colors = X+2
K = X+2;
else // TIMED push-down system, tree width 3K+2
K = 3*X + 3;
}
// calculate 2^x
inline unsigned int p2(unsigned int x) {
return (1 << x);
}
// string to integer conversion
int str_to_int(string s) {
int sum = 0;
for(int i=0; i < s.size(); i++) {
sum = sum*10 + s[i]-'0';
}
return sum;
}
// MAIN PROGRAM
int main(int argc, char *argv[]) {
// Command line arguments :
// first argument(argv[1]) : input TPDA text file with specific format
/* Second argument(argv[2]) :
1 : TPDA with no extra clock, but there can be constraints on ages of stack symbols
2 : special kind of TPDA with one clock x(x must be reset in all transitions just before some check transitoin on clock x )
3 : general TPDA with one clock
No arg : general TPDA with one or more clocks
*/
if(argc < 2) {
cout << "Input TPDA file must be given !" << endl;
return 0;
}
clock_t start = clock(); // Start measuring time
////**********////
setGlobal(argv[1]); // set all the global variables
bool b;
if(argc >= 3) { // If there is any arguments for special kind of TPDA
int x = str_to_int(argv[2]);
if(x == 1) //TPDA with no extra clock, but there can be constraints on ages of stack symbols
b = pdsempty();
else if(x == 2) // special kind of TPDA with one clock x(x must be reset in all transitions just before some check transitoin on clock x )
b = isEmptySTPDA();
else if(x == 3) // general TPDA with one clock
b = isEmptyTPDA();
else if(x == 4)
b = isEmptyZone();
}
else // general TPDA with one or more clocks
b = isEmptyGCPP();
// the returned value b will be true iff the language is empty
if(b)
cout << "The language recognized by the TPDA is EMPTY!" << endl;
else
cout << "The language recognized by the TPDA is NOT EMPTY!" << endl;
cout << endl;
if(AS == 0) // no stacks
cout << "#stacks : " << 0 << endl;
else // one stack
cout << "#stacks : " << 1 << endl;
cout << "#clocks : " << int(X) << endl;
cout << "#states : " << int(S) << endl;
cout << "#transitions : " << int(T) << endl;
cout << "Maximum constant(M) : " << int(M) << endl;
cout << "Tree-Width(K) : " << int(K-1) << endl;
cout << endl << "---END OF EXECUTION---" << endl << endl;
clock_t stop = clock(); // end of time calculation
double elapsed = (double)(stop - start) * 1000.0 / CLOCKS_PER_SEC; // Time elapsed calculation
cout << "Execution time : " << (elapsed/1000) << " seconds." << endl << endl;
/*
short **w;
bool **open;
int n;
cout << "n : ";
cin >> n;
w = new short*[n];
open = new bool*[n];
for(char i=0; i < n; i++) {
w[i] = new short[n];
open[i] = new bool[n];
for(char j=0; j < n; j++) {
cin >> w[i][j];
}
}
for(char i=0; i < n; i++) {
for(char j=0; j < n; j++) {
cout << w[i][j] << "\t";
}
cout << endl;
}
allPairSP(w, open, n);
for(char i=0; i < n; i++) {
for(char j=0; j < n; j++) {
cout << w[i][j] << "\t";
}
cout << endl;
}
*/
return 0;
}
CC := g++
CFLAG := -lm -std=c++11
SRC := ./src
OBJ := ./obj
INC := ./include
EXE := tree
GDB := -g
tree : main.o $(OBJ)/treeBitOperations.o $(OBJ)/timePushDown.o $(OBJ)/continuoustpda.o $(OBJ)/pds.o $(OBJ)/tpdaCGPP.o $(OBJ)/tpdaZone.o $(OBJ)/tpda2.o drawsystem
g++ $(GDB) main.o $(OBJ)/treeBitOperations.o $(OBJ)/timePushDown.o $(OBJ)/continuoustpda.o $(OBJ)/pds.o $(OBJ)/tpdaCGPP.o $(OBJ)/tpdaZone.o $(OBJ)/tpda2.o -o $(EXE) $(CFLAG)
main.o : main.cpp
g++ $(GDB) -I $(INC) -c main.cpp -o main.o $(CFLAG)
$(OBJ)/tpdaZone.o : $(SRC)/tpdaZone.cpp
g++ $(GDB) -I $(INC) -c $(SRC)/tpdaZone.cpp -o $(OBJ)/tpdaZone.o $(CFLAG)
$(OBJ)/tpdaCGPP.o : $(SRC)/tpdaCGPP.cpp
g++ $(GDB) -I $(INC) -c $(SRC)/tpdaCGPP.cpp -o $(OBJ)/tpdaCGPP.o $(CFLAG)
$(OBJ)/continuoustpda.o : $(SRC)/continuoustpda.cpp
g++ $(GDB) -I $(INC) -c $(SRC)/continuoustpda.cpp -o $(OBJ)/continuoustpda.o $(CFLAG)
$(OBJ)/tpda2.o : $(SRC)/tpda2.cpp
g++ $(GDB) -I $(INC) -c $(SRC)/tpda2.cpp -o $(OBJ)/tpda2.o $(CFLAG)
$(OBJ)/pds.o : $(SRC)/pds.cpp
g++ $(GDB) -I $(INC) -c $(SRC)/pds.cpp -o $(OBJ)/pds.o $(CFLAG)
drawsystem : $(OBJ)/drawsystem.o $(OBJ)/treeBitOperations.o
g++ $(GDB) $(OBJ)/drawsystem.o $(OBJ)/treeBitOperations.o -o drawsystem $(CFLAG)
$(OBJ)/drawsystem.o : $(SRC)/drawsystem.cpp
g++ $(GDB) -I $(INC) -c $(SRC)/drawsystem.cpp -o $(OBJ)/drawsystem.o $(CFLAG)
$(OBJ)/timePushDown.o : $(SRC)/timePushDown.cpp
g++ $(GDB) -I $(INC) -c $(SRC)/timePushDown.cpp -o $(OBJ)/timePushDown.o $(CFLAG)
$(OBJ)/treeBitOperations.o : $(SRC)/treeBitOperations.cpp
g++ $(GDB) -I $(INC) -c $(SRC)/treeBitOperations.cpp -o $(OBJ)/treeBitOperations.o $(CFLAG)
<?xml version="1.0" encoding="UTF-8"?>
<configurationDescriptor version="100">
<logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">
<df root="." name="0">
<df name="src">
<in>continuoustpda.cpp</in>
<in>drawsystem.cpp</in>
<in>pds.cpp</in>
<in>timePushDown.cpp</in>
<in>tpda2.cpp</in>
<in>tpdaCGPP.cpp</in>
<in>tpdaZone.cpp</in>
<in>treeBitOperations.cpp</in>
</df>
<in>main.cpp</in>
</df>
<logicalFolder name="ExternalFiles"
displayName="Important Files"
projectFiles="false"
kind="IMPORTANT_FILES_FOLDER">
<itemPath>nbproject/private/launcher.properties</itemPath>
<itemPath>makefile</itemPath>
</logicalFolder>
</logicalFolder>
<sourceFolderFilter>^(nbproject)$</sourceFolderFilter>
<sourceRootList>
<Elem>.</Elem>
</sourceRootList>
<projectmakefile>makefile</projectmakefile>
<confs>
<conf name="Default" type="0">
<toolsSet>
<compilerSet>default</compilerSet>
<dependencyChecking>false</dependencyChecking>
<rebuildPropChanged>false</rebuildPropChanged>
</toolsSet>
<flagsDictionary>
<element flagsID="0" commonFlags="-std=c++11"/>
</flagsDictionary>
<codeAssistance>
</codeAssistance>
<makefileType>
<makeTool>
<buildCommandWorkingDir>.</buildCommandWorkingDir>
<buildCommand>${MAKE} -f makefile</buildCommand>
<cleanCommand>${MAKE} -f makefile clean</cleanCommand>
<executablePath></executablePath>
<ccTool>
<incDir>
<pElem>include</pElem>
</incDir>
</ccTool>
</makeTool>
<preBuild>
<preBuildCommandWorkingDir>.</preBuildCommandWorkingDir>
<preBuildCommand></preBuildCommand>
</preBuild>
</makefileType>
<folder path="0/src">
<ccTool>
<incDir>
<pElem>.</pElem>
</incDir>
</ccTool>
</folder>
<item path="main.cpp" ex="false" tool="1" flavor2="8">
<ccTool flags="0">
</ccTool>
</item>
<item path="src/continuoustpda.cpp" ex="false" tool="1" flavor2="8">
<ccTool flags="0">
</ccTool>
</item>
<item path="src/drawsystem.cpp" ex="false" tool="1" flavor2="8">
<ccTool flags="0">
</ccTool>
</item>
<item path="src/pds.cpp" ex="false" tool="1" flavor2="8">
<ccTool flags="0">
</ccTool>
</item>
<item path="src/timePushDown.cpp" ex="false" tool="1" flavor2="8">
<ccTool flags="0">
</ccTool>
</item>
<item path="src/tpda2.cpp" ex="false" tool="1" flavor2="8">
<ccTool flags="0">
</ccTool>
</item>
<item path="src/tpdaCGPP.cpp" ex="false" tool="1" flavor2="8">
<ccTool flags="0">
</ccTool>
</item>
<item path="src/tpdaZone.cpp" ex="false" tool="1" flavor2="8">
<ccTool flags="0">
</ccTool>
</item>
<item path="src/treeBitOperations.cpp" ex="false" tool="1" flavor2="8">
<ccTool flags="0">
</ccTool>
</item>
</conf>
</confs>
</configurationDescriptor>
g++ -g -I ./include -c main.cpp -o main.o -lm -std=c++11
g++ -g -I ./include -c ./src/treeBitOperations.cpp -o ./obj/treeBitOperations.o -lm -std=c++11
g++ -g -I ./include -c ./src/timePushDown.cpp -o ./obj/timePushDown.o -lm -std=c++11
g++ -g -I ./include -c ./src/continuoustpda.cpp -o ./obj/continuoustpda.o -lm -std=c++11
g++ -g -I ./include -c ./src/pds.cpp -o ./obj/pds.o -lm -std=c++11
g++ -g -I ./include -c ./src/tpdaCGPP.cpp -o ./obj/tpdaCGPP.o -lm -std=c++11
g++ -g -I ./include -c ./src/tpdaZone.cpp -o ./obj/tpdaZone.o -lm -std=c++11
g++ -g -I ./include -c ./src/tpda2.cpp -o ./obj/tpda2.o -lm -std=c++11
g++ -g -I ./include -c ./src/drawsystem.cpp -o ./obj/drawsystem.o -lm -std=c++11
g++ -g ./obj/drawsystem.o ./obj/treeBitOperations.o -o drawsystem -lm -std=c++11
g++ -g main.o ./obj/treeBitOperations.o ./obj/timePushDown.o ./obj/continuoustpda.o ./obj/pds.o ./obj/tpdaCGPP.o ./obj/tpdaZone.o ./obj/tpda2.o -o tree -lm -std=c++11
called: g++
/home/sparsa/Programming/mtp
g++
-g
-I
./include
-c
main.cpp
-o
main.o
-lm
-std=c++11
called: g++
/home/sparsa/Programming/mtp
g++
-g
-I
./include
-c
./src/treeBitOperations.cpp
-o
./obj/treeBitOperations.o
-lm
-std=c++11
called: g++
/home/sparsa/Programming/mtp
g++
-g
-I
./include
-c
./src/timePushDown.cpp
-o
./obj/timePushDown.o
-lm
-std=c++11
called: g++
/home/sparsa/Programming/mtp
g++
-g
-I
./include
-c
./src/continuoustpda.cpp
-o
./obj/continuoustpda.o
-lm
-std=c++11
called: g++
/home/sparsa/Programming/mtp
g++
-g
-I
./include
-c
./src/pds.cpp
-o
./obj/pds.o
-lm
-std=c++11
called: g++
/home/sparsa/Programming/mtp
g++
-g
-I
./include
-c
./src/tpdaCGPP.cpp
-o
./obj/tpdaCGPP.o
-lm
-std=c++11
called: g++
/home/sparsa/Programming/mtp
g++
-g
-I
./include
-c
./src/tpdaZone.cpp
-o
./obj/tpdaZone.o
-lm
-std=c++11
called: g++
/home/sparsa/Programming/mtp
g++
-g
-I
./include
-c
./src/tpda2.cpp
-o
./obj/tpda2.o
-lm
-std=c++11
called: g++
/home/sparsa/Programming/mtp
g++
-g
-I
./include
-c
./src/drawsystem.cpp
-o
./obj/drawsystem.o
-lm
-std=c++11
called: g++
/home/sparsa/Programming/mtp
g++
-g
./obj/drawsystem.o
./obj/treeBitOperations.o
-o
drawsystem
-lm
-std=c++11
called: /usr/bin/ld
/home/sparsa/Programming/mtp
/usr/bin/ld
-plugin
/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/liblto_plugin.so
-plugin-opt=/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/lto-wrapper
-plugin-opt=-fresolution=/tmp/cciKZpSO.res
-plugin-opt=-pass-through=-lgcc_s
-plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lc
-plugin-opt=-pass-through=-lgcc_s
-plugin-opt=-pass-through=-lgcc
--build-id
--eh-frame-hdr
--hash-style=gnu
-m
elf_x86_64
-dynamic-linker
/lib64/ld-linux-x86-64.so.2
-o
drawsystem
/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../lib/crt1.o
/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../lib/crti.o
/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/crtbegin.o
-L/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1
-L/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../lib
-L/lib/../lib
-L/usr/lib/../lib
-L/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/../../..
./obj/drawsystem.o
./obj/treeBitOperations.o
-lstdc++
-lm
-lgcc_s
-lgcc
-lc
-lgcc_s
-lgcc
/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/crtend.o
/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../lib/crtn.o
called: g++
/home/sparsa/Programming/mtp
g++
-g
main.o
./obj/treeBitOperations.o
./obj/timePushDown.o
./obj/continuoustpda.o
./obj/pds.o
./obj/tpdaCGPP.o
./obj/tpdaZone.o
./obj/tpda2.o
-o
tree
-lm
-std=c++11
called: /usr/bin/ld
/home/sparsa/Programming/mtp
/usr/bin/ld
-plugin
/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/liblto_plugin.so
-plugin-opt=/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/lto-wrapper
-plugin-opt=-fresolution=/tmp/cctG1Nkd.res
-plugin-opt=-pass-through=-lgcc_s
-plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lc
-plugin-opt=-pass-through=-lgcc_s
-plugin-opt=-pass-through=-lgcc
--build-id
--eh-frame-hdr
--hash-style=gnu
-m
elf_x86_64
-dynamic-linker
/lib64/ld-linux-x86-64.so.2
-o
tree
/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../lib/crt1.o
/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../lib/crti.o
/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/crtbegin.o
-L/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1
-L/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../lib
-L/lib/../lib
-L/usr/lib/../lib
-L/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/../../..
main.o
./obj/treeBitOperations.o
./obj/timePushDown.o
./obj/continuoustpda.o
./obj/pds.o
./obj/tpdaCGPP.o
./obj/tpdaZone.o
./obj/tpda2.o
-lstdc++
-lm
-lgcc_s
-lgcc
-lc
-lgcc_s
-lgcc
/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/crtend.o
/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../lib/crtn.o
/home/sparsa/Programming/mtp/src/tpdaCGPP.cpp=/home/sparsa/Programming/mtp#-g -I ./include -c ./src/tpdaCGPP.cpp -o ./obj/tpdaCGPP.o -lm -std=c++11
/home/sparsa/Programming/mtp/src/timePushDown.cpp=/home/sparsa/Programming/mtp#-g -I ./include -c ./src/timePushDown.cpp -o ./obj/timePushDown.o -lm -std=c++11
/home/sparsa/Programming/mtp/src/tpda2.cpp=/home/sparsa/Programming/mtp#-g -I ./include -c ./src/tpda2.cpp -o ./obj/tpda2.o -lm -std=c++11
/home/sparsa/Programming/mtp/src/drawsystem.cpp=/home/sparsa/Programming/mtp#-g -I ./include -c ./src/drawsystem.cpp -o ./obj/drawsystem.o -lm -std=c++11
/home/sparsa/Programming/mtp/src/continuoustpda.cpp=/home/sparsa/Programming/mtp#-g -I ./include -c ./src/continuoustpda.cpp -o ./obj/continuoustpda.o -lm -std=c++11
/home/sparsa/Programming/mtp/src/tpdaZone.cpp=/home/sparsa/Programming/mtp#-g -I ./include -c ./src/tpdaZone.cpp -o ./obj/tpdaZone.o -lm -std=c++11
/home/sparsa/Programming/mtp/src/treeBitOperations.cpp=/home/sparsa/Programming/mtp#-g -I ./include -c ./src/treeBitOperations.cpp -o ./obj/treeBitOperations.o -lm -std=c++11
/home/sparsa/Programming/mtp/src/pds.cpp=/home/sparsa/Programming/mtp#-g -I ./include -c ./src/pds.cpp -o ./obj/pds.o -lm -std=c++11
/home/sparsa/Programming/mtp/main.cpp=/home/sparsa/Programming/mtp#-g -I ./include -c main.cpp -o main.o -lm -std=c++11
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
*
* Oracle and Java are registered trademarks of Oracle and/or its affiliates.
* Other names may be trademarks of their respective owners.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common
* Development and Distribution License("CDDL") (collectively, the
* "License"). You may not use this file except in compliance with the
* License. You can obtain a copy of the License at
* http://www.netbeans.org/cddl-gplv2.html
* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
* specific language governing permissions and limitations under the
* License. When distributing the software, include this License Header
* Notice in each file and include the License file at
* nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the
* License Header, with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* If you wish your version of this file to be governed by only the CDDL
* or only the GPL Version 2, indicate your decision by adding
* "[Contributor] elects to include this software in this distribution
* under the [CDDL or GPL Version 2] license." If you do not indicate a
* single choice of license, a recipient has the option to distribute
* your version of this file under either the CDDL, the GPL Version 2 or
* to extend the choice of license to its licensees as provided above.
* However, if you add GPL Version 2 code and therefore, elected the GPL
* Version 2 license, then the option applies only if the new code is
* made subject to such option by the copyright holder.
*
* Contributor(s):
*/
// List of standard headers was taken in http://en.cppreference.com/w/c/header
#include <assert.h> // Conditionally compiled macro that compares its argument to zero
#include <ctype.h> // Functions to determine the type contained in character data
#include <errno.h> // Macros reporting error conditions
#include <float.h> // Limits of float types
#include <limits.h> // Sizes of basic types
#include <locale.h> // Localization utilities
#include <math.h> // Common mathematics functions
#include <setjmp.h> // Nonlocal jumps
#include <signal.h> // Signal handling
#include <stdarg.h> // Variable arguments
#include <stddef.h> // Common macro definitions
#include <stdio.h> // Input/output
#include <string.h> // String handling
#include <stdlib.h> // General utilities: memory management, program utilities, string conversions, random numbers
#include <time.h> // Time/date utilities
#include <iso646.h> // (since C95) Alternative operator spellings
#include <wchar.h> // (since C95) Extended multibyte and wide character utilities
#include <wctype.h> // (since C95) Wide character classification and mapping utilities
#ifdef _STDC_C99
#include <complex.h> // (since C99) Complex number arithmetic
#include <fenv.h> // (since C99) Floating-point environment
#include <inttypes.h> // (since C99) Format conversion of integer types
#include <stdbool.h> // (since C99) Boolean type
#include <stdint.h> // (since C99) Fixed-width integer types
#include <tgmath.h> // (since C99) Type-generic math (macros wrapping math.h and complex.h)
#endif
#ifdef _STDC_C11
#include <stdalign.h> // (since C11) alignas and alignof convenience macros
#include <stdatomic.h> // (since C11) Atomic types
#include <stdnoreturn.h> // (since C11) noreturn convenience macros
#include <threads.h> // (since C11) Thread library
#include <uchar.h> // (since C11) UTF-16 and UTF-32 character utilities
#endif
<?xml version="1.0" encoding="UTF-8"?>
<configurationDescriptor version="100">
<logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">
<df root="." name="0">
<df name="include">
<in>continuoustpda.h</in>
<in>drawsystem.h</in>
<in>pds.h</in>
<in>timePushDown.h</in>
<in>tpda2.h</in>
<in>tpdaCGPP.h</in>
<in>tpdaZone.h</in>
<in>treeBitOperations.h</in>
</df>
<df name="input">
</df>
<df name="obj">
</df>
<df name="src">
<in>continuoustpda.cpp</in>
<in>drawsystem.cpp</in>
<in>pds.cpp</in>
<in>timePushDown.cpp</in>
<in>tpda2.cpp</in>
<in>tpdaCGPP.cpp</in>
<in>tpdaZone.cpp</in>
<in>treeBitOperations.cpp</in>
</df>
<in>main.cpp</in>
</df>
</logicalFolder>
<projectmakefile>makefile</projectmakefile>
<confs>
<conf name="Default" type="0">
<toolsSet>
<developmentServer>localhost</developmentServer>
<platform>2</platform>
</toolsSet>
<compile>
<compiledirpicklist>
<compiledirpicklistitem>.</compiledirpicklistitem>
<compiledirpicklistitem>${AUTO_FOLDER}</compiledirpicklistitem>
</compiledirpicklist>
<compiledir>${AUTO_FOLDER}</compiledir>
<compilecommandpicklist>
<compilecommandpicklistitem>${MAKE} ${ITEM_NAME}.o</compilecommandpicklistitem>
<compilecommandpicklistitem>${AUTO_COMPILE}</compilecommandpicklistitem>
</compilecommandpicklist>
<compilecommand>${AUTO_COMPILE}</compilecommand>
</compile>
<dbx_gdbdebugger version="1">
<gdb_pathmaps>
</gdb_pathmaps>
<gdb_interceptlist>
<gdbinterceptoptions gdb_all="false" gdb_unhandled="true" gdb_unexpected="true"/>
</gdb_interceptlist>
<gdb_options>
<DebugOptions>
</DebugOptions>
</gdb_options>
<gdb_buildfirst gdb_buildfirst_overriden="false" gdb_buildfirst_old="false"/>
</dbx_gdbdebugger>
<nativedebugger version="1">
<engine>gdb</engine>
</nativedebugger>
<runprofile version="9">
<runcommandpicklist>
<runcommandpicklistitem>"${OUTPUT_PATH}"</runcommandpicklistitem>
</runcommandpicklist>
<runcommand>"${OUTPUT_PATH}"</runcommand>
<rundir>.</rundir>
<buildfirst>false</buildfirst>
<terminal-type>0</terminal-type>
<remove-instrumentation>0</remove-instrumentation>
<environment>
</environment>
</runprofile>
</conf>
</confs>
</configurationDescriptor>
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
*
* Oracle and Java are registered trademarks of Oracle and/or its affiliates.
* Other names may be trademarks of their respective owners.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common
* Development and Distribution License("CDDL") (collectively, the
* "License"). You may not use this file except in compliance with the
* License. You can obtain a copy of the License at
* http://www.netbeans.org/cddl-gplv2.html
* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
* specific language governing permissions and limitations under the
* License. When distributing the software, include this License Header
* Notice in each file and include the License file at
* nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the
* License Header, with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* If you wish your version of this file to be governed by only the CDDL
* or only the GPL Version 2, indicate your decision by adding
* "[Contributor] elects to include this software in this distribution
* under the [CDDL or GPL Version 2] license." If you do not indicate a
* single choice of license, a recipient has the option to distribute
* your version of this file under either the CDDL, the GPL Version 2 or
* to extend the choice of license to its licensees as provided above.
* However, if you add GPL Version 2 code and therefore, elected the GPL
* Version 2 license, then the option applies only if the new code is
* made subject to such option by the copyright holder.
*
* Contributor(s):
*/
// List of standard headers was taken in http://en.cppreference.com/w/cpp/header
#include <cstdlib> // General purpose utilities: program control, dynamic memory allocation, random numbers, sort and search
#include <csignal> // Functions and macro constants for signal management
#include <csetjmp> // Macro (and function) that saves (and jumps) to an execution context
#include <cstdarg> // Handling of variable length argument lists
#include <typeinfo> // Runtime type information utilities
#include <bitset> // std::bitset class template
#include <functional> // Function objects, designed for use with the standard algorithms
#include <utility> // Various utility components
#include <ctime> // C-style time/date utilites
#include <cstddef> // typedefs for types such as size_t, NULL and others
#include <new> // Low-level memory management utilities
#include <memory> // Higher level memory management utilities
#include <climits> // limits of integral types
#include <cfloat> // limits of float types
#include <limits> // standardized way to query properties of arithmetic types
#include <exception> // Exception handling utilities
#include <stdexcept> // Standard exception objects
#include <cassert> // Conditionally compiled macro that compares its argument to zero
#include <cerrno> // Macro containing the last error number
#include <cctype> // functions to determine the type contained in character data
#include <cwctype> // functions for determining the type of wide character data
#include <cstring> // various narrow character string handling functions
#include <cwchar> // various wide and multibyte string handling functions
#include <string> // std::basic_string class template
#include <vector> // std::vector container
#include <deque> // std::deque container
#include <list> // std::list container
#include <set> // std::set and std::multiset associative containers
#include <map> // std::map and std::multimap associative containers
#include <stack> // std::stack container adaptor
#include <queue> // std::queue and std::priority_queue container adaptors
#include <algorithm> // Algorithms that operate on containers
#include <iterator> // Container iterators
#include <cmath> // Common mathematics functions
#include <complex> // Complex number type
#include <valarray> // Class for representing and manipulating arrays of values
#include <numeric> // Numeric operations on values in containers
#include <iosfwd> // forward declarations of all classes in the input/output library
#include <ios> // std::ios_base class, std::basic_ios class template and several typedefs
#include <istream> // std::basic_istream class template and several typedefs
#include <ostream> // std::basic_ostream, std::basic_iostream class templates and several typedefs
#include <iostream> // several standard stream objects
#include <fstream> // std::basic_fstream, std::basic_ifstream, std::basic_ofstream class templates and several typedefs
#include <sstream> // std::basic_stringstream, std::basic_istringstream, std::basic_ostringstream class templates and several typedefs
#include <strstream> // std::strstream, std::istrstream, std::ostrstream(deprecated)
#include <iomanip> // Helper functions to control the format or input and output
#include <streambuf> // std::basic_streambuf class template
#include <cstdio> // C-style input-output functions
#include <locale> // Localization utilities
#include <clocale> // C localization utilities
#include <ciso646> // empty header. The macros that appear in iso646.h in C are keywords in C++
#if __cplusplus >= 201103L
#include <typeindex> // (since C++11) std::type_index
#include <type_traits> // (since C++11) Compile-time type information
#include <chrono> // (since C++11) C++ time utilites
#include <initializer_list> // (since C++11) std::initializer_list class template
#include <tuple> // (since C++11) std::tuple class template
#include <scoped_allocator> // (since C++11) Nested allocator class
#include <cstdint> // (since C++11) fixed-size types and limits of other types
#include <cinttypes> // (since C++11) formatting macros , intmax_t and uintmax_t math and conversions
#include <system_error> // (since C++11) defines std::error_code, a platform-dependent error code
#include <cuchar> // (since C++11) C-style Unicode character conversion functions
#include <array> // (since C++11) std::array container
#include <forward_list> // (since C++11) std::forward_list container
#include <unordered_set> // (since C++11) std::unordered_set and std::unordered_multiset unordered associative containers
#include <unordered_map> // (since C++11) std::unordered_map and std::unordered_multimap unordered associative containers
#include <random> // (since C++11) Random number generators and distributions
#include <ratio> // (since C++11) Compile-time rational arithmetic
#include <cfenv> // (since C++11) Floating-point environment access functions
#include <codecvt> // (since C++11) Unicode conversion facilities
#include <regex> // (since C++11) Classes, algorithms and iterators to support regular expression processing
#include <atomic> // (since C++11) Atomic operations library
#include <ccomplex> // (since C++11)(deprecated in C++17) simply includes the header <complex>
#include <ctgmath> // (since C++11)(deprecated in C++17) simply includes the headers <ccomplex> (until C++17)<complex> (since C++17) and <cmath>: the overloads equivalent to the contents of the C header tgmath.h are already provided by those headers
#include <cstdalign> // (since C++11)(deprecated in C++17) defines one compatibility macro constant
#include <cstdbool> // (since C++11)(deprecated in C++17) defines one compatibility macro constant
#include <thread> // (since C++11) std::thread class and supporting functions
#include <mutex> // (since C++11) mutual exclusion primitives
#include <future> // (since C++11) primitives for asynchronous computations
#include <condition_variable> // (since C++11) thread waiting conditions
#endif
#if __cplusplus >= 201300L
#include <shared_mutex> // (since C++14) shared mutual exclusion primitives
#endif
#if __cplusplus >= 201500L
#include <any> // (since C++17) std::any class template
#include <optional> // (since C++17) std::optional class template
#include <variant> // (since C++17) std::variant class template
#include <memory_resource> // (since C++17) Polymorphic allocators and memory resources
#include <string_view> // (since C++17) std::basic_string_view class template
#include <execution> // (since C++17) Predefined execution policies for parallel versions of the algorithms
#include <filesystem> // (since C++17) std::path class and supporting functions
#endif
# Launchers File syntax:
#
# [Must-have property line]
# launcher1.runCommand=<Run Command>
# [Optional extra properties]
# launcher1.displayName=<Display Name, runCommand by default>
# launcher1.hide=<true if lancher is not visible in menu, false by default>
# launcher1.buildCommand=<Build Command, Build Command specified in project properties by default>
# launcher1.runDir=<Run Directory, ${PROJECT_DIR} by default>
# launcher1.runInOwnTab=<false if launcher reuse common "Run" output tab, true by default>
# launcher1.symbolFiles=<Symbol Files loaded by debugger, ${OUTPUT_PATH} by default>
# launcher1.env.<Environment variable KEY>=<Environment variable VALUE>
# (If this value is quoted with ` it is handled as a native command which execution result will become the value)
# [Common launcher properties]
# common.runDir=<Run Directory>
# (This value is overwritten by a launcher specific runDir value if the latter exists)
# common.env.<Environment variable KEY>=<Environment variable VALUE>
# (Environment variables from common launcher are merged with launcher specific variables)
# common.symbolFiles=<Symbol Files loaded by debugger>
# (This value is overwritten by a launcher specific symbolFiles value if the latter exists)
#
# In runDir, symbolFiles and env fields you can use these macroses:
# ${PROJECT_DIR} - project directory absolute path
# ${OUTPUT_PATH} - linker output path (relative to project directory path)
# ${OUTPUT_BASENAME}- linker output filename
# ${TESTDIR} - test files directory (relative to project directory path)
# ${OBJECTDIR} - object files directory (relative to project directory path)
# ${CND_DISTDIR} - distribution directory (relative to project directory path)
# ${CND_BUILDDIR} - build directory (relative to project directory path)
# ${CND_PLATFORM} - platform name
# ${CND_CONF} - configuration name
# ${CND_DLIB_EXT} - dynamic library extension
#
# All the project launchers must be listed in the file!
#
# launcher1.runCommand=...
# launcher2.runCommand=...
# ...
# common.runDir=...
# common.env.KEY=VALUE
# launcher1.runCommand=<type your run command here>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<code-assistance-data xmlns="http://www.netbeans.org/ns/make-project-private/1">
<code-model-enabled>true</code-model-enabled>
</code-assistance-data>
<data xmlns="http://www.netbeans.org/ns/make-project-private/1">
<activeConfTypeElem>0</activeConfTypeElem>
<activeConfIndexElem>0</activeConfIndexElem>
</data>
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/home/sparsa/Programming/mtp/src/tpdaZone.cpp</file>
</group>
</open-files>
</project-private>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.cnd.makeproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/make-project/1">
<name>mtp</name>
<c-extensions/>
<cpp-extensions>cpp</cpp-extensions>
<header-extensions>h</header-extensions>
<sourceEncoding>UTF-8</sourceEncoding>
<make-dep-projects/>
<sourceRootList>
<sourceRootElem>.</sourceRootElem>
</sourceRootList>
<confList>
<confElem>
<name>Default</name>
<type>0</type>
</confElem>
</confList>
<formatting>
<project-formatting-style>false</project-formatting-style>
</formatting>
</data>
</configuration>
</project>
File added
sample.png

38.1 KB

This diff is collapsed.
#include<fstream>
#include<iostream>
#include<stdlib.h>
#include"drawsystem.h"
#include"treeBitOperations.h"
//using namespace std;
//char inputfilename[100]; // input file name for timed push-down system
weighttype B;
int M; // maximum constant+1 in the timed system
unsigned short int S; // number of states in the timed system
unsigned short int SI; // initial state
unsigned short int SF; // final state
unsigned short int T; // number of transitions in the timed system
char X; // number of clocks in the timed system
char A; // number of events or actions in the timed system
char AS; // number of stack symbols in the timed system
transition *transitions; // transitions of the timed system
inline bool transition::isReset(char i) {
return (a32[i] & reset);
}
void showsystem(char *outfile) {
int source,ns;
int i,j,k;
int guard,reset;
int action, ub, lb, ps, pp;
ofstream tiimeoutfile(outfile); // timed automata output file for showing the automata
tiimeoutfile << "digraph finite_state_machine {\n";
//tiimeoutfile << "ratio=\"fill\";\nsize=\"10,10!\";\n";
for(i=0; i <= S; i++) {
//tiimeoutfile << i << " [label=\""<<i<<"\"];\n";
}
tiimeoutfile << "\tnode [shape = point ]; qi" << 0 << ";\n";
tiimeoutfile << "\tnode [shape = doublecircle];" << SF << ";\n";
tiimeoutfile << "\tnode [shape=circle];\n"; // all the states other than final states are labelled in a circle
tiimeoutfile << "\tqi" << "0" << " -> " << SI << ";\n";
for(i=0; i <= T; i++) { // take input for all the transitions
source = transitions[i].source; // previous and next state of the i-th transition
ns = transitions[i].target;
tiimeoutfile << "\t" << source << " -> " << ns << " [ label = \"{tn:" << (i); // output transition between two states
guard = transitions[i].guard;
reset = transitions[i].reset;
action = transitions[i].a;
for(j=1; j <= X; j++) { // save all the conjunction of a constraint
if(guard & a32[j]) {
lb = transitions[i].lbs[j];
ub = transitions[i].ubs[j];
//if (ub == 0 && lb == 0) {} //***this line will not be active other than maze, only else part will remain****
//else{
if(ub == INF)
tiimeoutfile << "," << lb << "<=" << "x" << j << "<=" << "inf";
else
tiimeoutfile << "," << lb << "<=" << "x" << j << "<=" << ub;
//}
}
}
//tiimeoutfile << ",a" << action; // output action number
for(j=1;j <= X; j++) { // reset clocks for i-th transition 'transitions[i]'
if(reset & a32[j]) {
tiimeoutfile << ",x" << j << ":=0"; //***this line will be active other than maze****
}
}
//stack_symbol = transitions[i].as ;
ps = transitions[i].ps ;
pp = transitions[i].pp ;
if( (reset & 1) == 0 && (guard & 1) == 0 ) { // nop stack operation
//tiimeoutfile << ",np"; //***this line will be active other than maze****
}
else if( (reset & 1) == 0 && (guard & 1) == 1 ) { // push operation
tiimeoutfile << ",ps_" << ps;
}
else if( (reset & 1) == 1 && (guard & 1) == 0 ) { // pop operation
tiimeoutfile << ",pp_" << pp;
lb = transitions[i].lbs[0];
ub = transitions[i].ubs[0];
if(ub == INF)
tiimeoutfile << ":" << lb << "<=ag(" << pp << ")<=" << "inf";
else
tiimeoutfile << ":" << lb << "<=ag(" << pp << ")<=" << ub;
}
else if( (reset & 1) && (guard & 1) ) { // pop operation
tiimeoutfile << ",pp_" << pp;
lb = transitions[i].lbs[0];
ub = transitions[i].ubs[0];
if(ub == INF)
tiimeoutfile << ":" << lb << "<=ag(" << pp << ")<=" << "inf";
else
tiimeoutfile << ":" << lb << "<=ag(" << pp << ")<=" << ub;
tiimeoutfile << ",ps_" << ps;
}
tiimeoutfile << "}\" ];\n";
}
tiimeoutfile << "}"; // output the last closing brace // graph complete for the automata tiimeoutfile.close();
}
// get the input timed system given as a file(file name stored in the global variable 'inputfilename')
int main(int argc, char *argv[]) {
setBits();
int x; // temporary variable
short int i, j; // loopers
int lb, ub; // used as lower and upper bound
short int noofguards, noofresets; // #gurads and #reset clocks in a transition
int guard, reset;
if(argc < 2) {
cout << "You must give the timed system input file!" << endl;
return 0;
}
//ifstream tiimeinfile (argv[1]); // timed system input file stream
ifstream tiimeinfile (argv[1]); // timed system input file stream
//cout << "ilias" << endl;
// if there is any error opening the file
if( !(tiimeinfile.is_open()) ) {
cout << "\n****INPUT TIMED PUSH-DOWN FILE NOT FOUND ! ****\n";
exit(1);
}
tiimeinfile >> S; // #states in origianl automata
tiimeinfile >> T; // #transitions
transitions = new transition[T+1]; // allocate memory for transitions
tiimeinfile >> x; // #clocks
X = x;
tiimeinfile >> x; // #actions
A = x;
tiimeinfile >> x; // #stack_symbols
AS = x;
tiimeinfile >> SI; // input initial state
tiimeinfile >> SF; // input final state
transitions[0].source = 0;
transitions[0].target = SI;
transitions[0].a = 0; // event or action in this transition is silent
transitions[0].lbs = new int[X+1]; // allocate memory for lower bounds for clock's check and stack pop operation
transitions[0].ubs = new int[X+1]; // allocate memory for upper bounds for clock's check and stack pop operation
transitions[0].guard = 0; // 0-th bits of gurad and reset are '0' / no stack operation
transitions[0].reset = (~0) ^ 1;
SI = 0;
// get all the transitions
for(i=1; i <= T; i++) {
tiimeinfile >> x;
transitions[i].source = x; // source state in this transition
tiimeinfile >> x;
transitions[i].target = x; // target state in this transition
tiimeinfile >> x;
transitions[i].a = x; // event or action in this transition
tiimeinfile >> noofguards; // #guards in this transition
tiimeinfile >> noofresets; // #resets in this transition
transitions[i].lbs = new int[X+1]; // allocate memory for lower bounds for clock's check and stack pop operation
transitions[i].ubs = new int[X+1]; // allocate memory for upper bounds for clock's check and stack pop operation
guard = 0;
for(j=0; j < noofguards; j++) {
tiimeinfile >> x; // clock number for guard
if(x <= 0 || x > X) {
cout << "Clock number is not in the limit!" << endl;
exit(1);
}
guard |= a32[x]; // set i-th bit of guard to '1'
tiimeinfile >> lb >> ub; // bounds on the guard
if(lb < 0 || ub < (-1)) {
cout << "Bounds can't be negative!" << endl;
exit(1);
}
transitions[i].lbs[x] = lb; // lower bound for clock x
if(ub == (-1)) { // upper bound -1 means infinity
transitions[i].ubs[x] = INF;
}
else {
transitions[i].ubs[x] = ub;
}
}
reset = 0;
// set i-th bit of 'reset' to '1' if i-th clock has been reset in this transition
for(j=0; j < noofresets; j++) {
tiimeinfile >> x; // clock number for guard
if(x <= 0 || x > X) {
cout << "Clock number is not in the limit!" << endl;
exit(1);
}
reset |= a32[x]; // set x-th bit of 'reset' to '1'
}
// read stack operation number, 0 : nop, 1 : push, 2 : pop
tiimeinfile >> x;
if(x == 0) { // nop operation
// do nothing
}
else if(x == 1) { // push operation
guard |= 1; // set 0-th bit of gurad to '1'
tiimeinfile >> x; // stack push symbol
transitions[i].ps = x;
}
else if(x == 2) { // pop operation
reset |= 1; // set 0-th bit of reset to '1'
tiimeinfile >> x; // stack pop symbol
transitions[i].pp = x;
tiimeinfile >> lb >> ub; // read stack pop bounds
transitions[i].lbs[0] = lb; // lower bound for clock x
if(ub == (-1)) // upper bound -1 means infinity
transitions[i].ubs[0] = INF;
else
transitions[i].ubs[0] = ub;
}
else if(x == 3) { // pop operation
reset |= 1; // set 0-th bit of reset to '1'
guard |= 1; // set 0-th bit of reset to '1'
tiimeinfile >> x; // stack pop symbol
transitions[i].pp = x;
tiimeinfile >> lb >> ub; // read stack pop bounds
transitions[i].lbs[0] = lb; // lower bound for clock x
if(ub == (-1)) // upper bound -1 means infinity
transitions[i].ubs[0] = INF;
else
transitions[i].ubs[0] = ub;
tiimeinfile >> x; // stack pop symbol
transitions[i].ps = x;
}
else {
cout << "Invalid stack operation!" << endl;
exit(1);
}
transitions[i].guard = guard;
transitions[i].reset = reset;
}
tiimeinfile.close();
showsystem(argv[2]);
return 0;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#include<sstream>
#include<string>
#include<iostream>
#include"treeBitOperations.h"
unsigned int a32[32]; /* a[i] contains an integer where only one '1' is there in the bit position (i-1)
For example, a[3] contains binary number 00..01000 or integer 8
*/
unsigned int b32[32]; /*b[i] contains an integer where all bits are '1' from zeroth bit position upto i-th bit position
For example, b[4] contains binary number 00..01111 or integer 15
*/
unsigned int c32[32]; /*c[i] contains an integer where all bits are '1' from (i+1)-th bit position upto last bit position
For example, c[4] contains binary number 11..10000 or integer -16
*/
unsigned int d32[32]; /* d32[i] contains an integer where only one '0' is there in the bit position i
For example, a[3] contains binary number 11..10111 or integer 8
*/
char K; // this denote number of maximum active colors
// number of 1's in a integer represented in binary
int noofones(unsigned int x, int B) {
unsigned int y = 1;
int i,count=0;
for(i=0; i < B; i++) {
if( (y & x) != 0)
count++;
y = y << 1;
}
return count;
}
// unsigned integer to binary conversion and print(for testing purpose)
string inttobinary(int x) {
unsigned int y=1;
y = y << 31;
int i;
stringstream ss;
for(i=0;i<32;i++){
if((y&x) == 0)
ss << 0;
else
ss << 1;
y = y >> 1;
if((i%4) == 3)
ss << " ";
}
return ss.str();
}
// initialization of the integer arrays a,b and c defined above
void setBits() {
char i;
unsigned int x32=1,y32=1;
for(i=0;i<32;i++) { // we are ignoring a[0],b[0] and c[0]
a32[i] = x32;
d32[i] = ~x32;
b32[i] = y32;
c32[i] = ~y32;
x32 = x32 << 1; // x = 2 * x or left shift the '1' in x one position left
y32 = x32 | y32; // If old y = 0011 and x = 0100, then new y = 0011 | 0100 = 0111
}
/*
for(i=0;i<32;i++) {
cout << inttobinary(a32[i]) << endl;
cout << inttobinary(b32[i]) << endl;
cout << inttobinary(c32[i]) << endl;
cout << inttobinary(d32[i]) << endl;
cout << endl;
}
cout << endl << endl;
*/
}
File added
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment