Commit e4eea6fc authored by SPARSA ROYCHOWDHURY's avatar SPARSA ROYCHOWDHURY

12/7/2017:

1. Some change done in the reduce shuffle function
2. Completely Indented code.
parent 8a8fb4bc
...@@ -2,48 +2,48 @@ ...@@ -2,48 +2,48 @@
using namespace std; using namespace std;
class transition{ class transition{
public: public:
short source; // source state short source; // source state
short target; // target state short target; // target state
char a; // action in this transition char a; // action in this transition
char as; // stack symbol in this transition, **** this variable is obsolete in new version of code char as; // stack symbol in this transition, **** this variable is obsolete in new version of code
char ps; // push symbol in this transition char ps; // push symbol in this transition
char pp; // pop 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 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 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 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 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 0-th bit of gurad and reset is for stack operation
1 to 15-th bits are for clock(15 clock supported) 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 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 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=0 && r_0=0 : no stack operation
g_0=1 && r_0=0 : stack push operation g_0=1 && r_0=0 : stack push operation
g_0=0 && r_0=1 : stack pop 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 g_0=1 && r_0=1 : invalid : push and pop at the same time not possible
*/ */
int *lbs; // constraint lower bounds int *lbs; // constraint lower bounds
int *ubs; // constraint upper bounds int *ubs; // constraint upper bounds
/* /*
size of lbs and ubs is equal to (|X|+1), where |X| is the number of clocks 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[0] : lower bound for pop operation
lbs[i](1<=i<=15) : lower bound for i-th clock lbs[i](1<=i<=15) : lower bound for i-th clock
ubs[0] : upper bound for pop operation ubs[0] : upper bound for pop operation
ubs[i](1<=i<=15) : upper bound for i-th clock ubs[i](1<=i<=15) : upper bound for i-th clock
*/ */
}; };
......
...@@ -17,61 +17,61 @@ extern bool **open1, **open2; // temporary variables for storing some edge weigh ...@@ -17,61 +17,61 @@ extern bool **open1, **open2; // temporary variables for storing some edge weigh
// state for timed automata // state for timed automata
class stateZone{ class stateZone{
public: public:
char P; // number of points in this state 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 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 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 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 // add next transition to this state if possible and return all generated states by doing this operation
stateZone* addNextTPDA(char dn); stateZone* addNextTPDA(char dn);
// check if shuffle of this state with s2 is possible // check if shuffle of this state with s2 is possible
bool shuffleCheck(stateZone *s2); bool shuffleCheck(stateZone *s2);
// return shuffle of this state with s2 // return shuffle of this state with s2
stateZone* shuffle(stateZone *s2); stateZone* shuffle(stateZone *s2);
stateZone* reduceShuffle(stateZone *s2); stateZone* reduceShuffle(stateZone *s2);
// Return the first successor state whoose childrens will be right state for shuffle with current state // Return the first successor state whoose childrens will be right state for shuffle with current state
stateZone* sucState(); stateZone* sucState();
bool isFinal(); // return true iff this state is final bool isFinal(); // return true iff this state is final
void print(); // print this state void print(); // print this state
// return unique string for last reset points of a state participating in a combine operation as a left state // return unique string for last reset points of a state participating in a combine operation as a left state
string getKeyLeft(); string getKeyLeft();
// return unique string for hanging points of a state participating in a combine operation as a right state // return unique string for hanging points of a state participating in a combine operation as a right state
string getKeyRight(); string getKeyRight();
}; };
// partial run of the timed system as a sequence of pairs: (1) transition and (2) tsm value // partial run of the timed system as a sequence of pairs: (1) transition and (2) tsm value
class runZone{ class runZone{
public : public :
short P; // #points short P; // #points
char *del; // transitions char *del; // transitions
short **w; // weight matrix short **w; // weight matrix
runZone* addNext(char dn, char wn); // new run after adding transition 'dn' of tsm value 'wn' 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 runZone* shuffle(runZone *s2); // concatenation of two partial runs
void print(); // print the run with concrete global time stamps 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 // info to keep track parents of current state or who are the states generated current state
class trackZone{ class trackZone{
public : public :
char type; //***** type of operation : atomic : 0, addNextTPDA : 1, shuffle or combine : 2 char type; //***** type of operation : atomic : 0, addNextTPDA : 1, shuffle or combine : 2
int left; // *****shuffle left state index in the main vector int left; // *****shuffle left state index in the main vector
int right; // ****shuffle right 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 //this is used for checking if newly generated state was already generated earlier or not
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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