Commit 3a3fc041 authored by SPARSA ROYCHOWDHURY's avatar SPARSA ROYCHOWDHURY

21/9/17:

Started Open Guards
parent 169968bb
No preview for this file type
......@@ -8,7 +8,7 @@
using namespace std;
#define a3215 32768 // 2^15 shortcut
typedef enum {leq=1,les,na} relation; // to implement open guards leq deontes the relation to be less than equal to, les means less than relation and na means notapplicable.
// state for general TPDA with pop ande push happens at the same time
class stateGCPP{
......@@ -23,7 +23,9 @@ class stateGCPP{
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
relation **r_matrix; // the matrix of relation which denotes the relation between the points fractional part. clearly the size of the matrix is P*P as p is the total number of active colors.
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
......
......@@ -359,11 +359,11 @@ bool stateGCPP::consSatisfied(char dn, char wn, short *clockDis, bool *clockAcc)
// situation : we are trying to add trans 'dn' with tsm 'wn' to the right of current state
// check for stack constraint where dlr and aclr are distance and accuracy from L to R resp.
bool stateGCPP::stackCheck(char dn, char wn, short dlr, bool aclr) {
int ub = transitions[dn].ubs[0];
int ub = transitions[dn].ubs[0];// the stacks upper bound
if(aclr) { // if distance from L to R is small
short dis = dlr + mod( wn - w[P-1], M );
short dis = dlr + mod( wn - w[P-1], M ); // mark
if( ( dis < transitions[dn].lbs[0] ) || dis > ub )
if( ( dis < transitions[dn].lbs[0] ) || dis > ub ) // check if d(source,destination) \in I
return false;
else
......@@ -698,7 +698,14 @@ stateGCPP* getZeroState() {
vs->L = 1; // only one point is there
vs->P = 1;
vs->f = 0; // no push pop info yet, no accuracy info yet
vs->r_matrix = new relation*[vs->P]; //starting the first matrix for the open
for(int i = 0;i < vs->P;i++) // guard checking, the first point cant have any
{
vs->r_matrix[i] = new relation[vs->P]; // information so we will assign it
}
for(int i =0 ; i < vs->P;i++) // with 'na'.
for(int j = 0; j < vs->P; j++)
vs->r_matrix[i][j] = na;
vs->del = new char[1]; // memory allocation
vs->w = new char[1];
......
No preview for this file type
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