Commit 7639d7a8 authored by SPARSA ROYCHOWDHURY's avatar SPARSA ROYCHOWDHURY

15/10/2017:

1. Coding is Done.(Aparently) of the open code
2. found some bug in the first run.
3. Have to resolve the bug as soon as possible.

Sparsa Roychowdhury
parent 59d71f67
...@@ -24,8 +24,8 @@ class stateGCPP{ ...@@ -24,8 +24,8 @@ class stateGCPP{
char L; // left point of the non-trivial block char L; // left point of the non-trivial block
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. 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.
relation **allocate_r_matrix(); void allocate_r_matrix();
relation **allocate_r_matrix(relation r); void allocate_r_matrix(relation r);
relation **allocate_r_matrix(char P); relation **allocate_r_matrix(char P);
void delete_r_matrix(); void delete_r_matrix();
void delete_r_matrix(relation **matrix,char P); void delete_r_matrix(relation **matrix,char P);
......
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
</df> </df>
<df name="output"> <df name="output">
</df> </df>
<df name="output2">
</df>
<df name="src"> <df name="src">
<in>circuitfinder.cpp</in> <in>circuitfinder.cpp</in>
<in>continuoustpda.cpp</in> <in>continuoustpda.cpp</in>
......
...@@ -218,9 +218,10 @@ void inputSystem() { ...@@ -218,9 +218,10 @@ void inputSystem() {
tiimeinfile>> ub; // bounds on the guard tiimeinfile>> ub; // bounds on the guard
tiimeinfile >> opnu; tiimeinfile >> opnu;
if(opnl != 1 || opnl!= 0 || opnu!=0 || opnu!=1) if((opnl != 1 && opnl!= 0) || (opnu!=0 && opnu!=1))
{ {
cout << "The value of openl and openu must be 0 or 1" << endl; cout << "The value of openl and openu must be 0 or 1" << endl;
exit(0);
} }
if(opnl == 1) if(opnl == 1)
{ {
...@@ -292,9 +293,10 @@ void inputSystem() { ...@@ -292,9 +293,10 @@ void inputSystem() {
tiimeinfile>> ub; // bounds on the guard tiimeinfile>> ub; // bounds on the guard
tiimeinfile >> opnu; tiimeinfile >> opnu;
if(opnl != 1 || opnl!= 0 || opnu!=0 || opnu!=1) if((opnl != 1 && opnl!= 0) || (opnu!=0 && opnu!=1))
{ {
cout << "The value of openl and openu must be 0 or 1" << endl; cout << "The value of openl and openu must be 0 or 1" << endl;
exit(0);
} }
if(opnl == 1) if(opnl == 1)
{ {
...@@ -336,7 +338,7 @@ void inputSystem() { ...@@ -336,7 +338,7 @@ void inputSystem() {
tiimeinfile>> ub; // bounds on the guard tiimeinfile>> ub; // bounds on the guard
tiimeinfile >> opnu; tiimeinfile >> opnu;
if(opnl != 1 || opnl!= 0 || opnu!=0 || opnu!=1) if((opnl != 1 && opnl!= 0) || (opnu!=0 && opnu!=1))
{ {
cout << "The value of openl and openu must be 0 or 1" << endl; cout << "The value of openl and openu must be 0 or 1" << endl;
} }
......
...@@ -114,7 +114,7 @@ stateGCPP* stateGCPP::reduceShuffle(stateGCPP* s2) { ...@@ -114,7 +114,7 @@ stateGCPP* stateGCPP::reduceShuffle(stateGCPP* s2) {
vs->del = new char[count]; // allocate memory vs->del = new char[count]; // allocate memory
vs->w = new char[count]; vs->w = new char[count];
vs->L = L; vs->L = L;
vs->r_matrix = vs->allocate_r_matrix(que); vs->allocate_r_matrix(que);
short nf = 0; // initially flag is zero short nf = 0; // initially flag is zero
short dis; // distance variable short dis; // distance variable
...@@ -291,7 +291,7 @@ stateGCPP* stateGCPP::reduce(char dn){ ...@@ -291,7 +291,7 @@ stateGCPP* stateGCPP::reduce(char dn){
vs->del = new char[count]; // memory allocation for new state transition vs->del = new char[count]; // memory allocation for new state transition
vs->w = new char[count]; // memory allocation for new state tsm values vs->w = new char[count]; // memory allocation for new state tsm values
vs->r_matrix = vs->allocate_r_matrix(que); //allocating memory for the matrix for open guard checking vs->allocate_r_matrix(que); //allocating memory for the matrix for open guard checking
//*************ASSIGNING VALUES TO THE DYNAMICALLY ALLOCATED VARIABLES*****************// //*************ASSIGNING VALUES TO THE DYNAMICALLY ALLOCATED VARIABLES*****************//
for(i=0; i < L; i++) { // hanging points and left point(L) remain same for(i=0; i < L; i++) { // hanging points and left point(L) remain same
vs->del[i] = del[i]; vs->del[i] = del[i];
...@@ -384,11 +384,14 @@ bool stateGCPP::consSatisfied(stateGCPP* vs, short* transitionMap,char dn, char ...@@ -384,11 +384,14 @@ bool stateGCPP::consSatisfied(stateGCPP* vs, short* transitionMap,char dn, char
openl = transitions[dn].openl; openl = transitions[dn].openl;
openu = transitions[dn].openu; openu = transitions[dn].openu;
relation **store_matrix = allocate_r_matrix(vs->P); relation **store_matrix = allocate_r_matrix(vs->P);
//cout <<"Hi I am called" << endl;
// cout << dn << wn << endl;
for(int i = 0 ;i < vs->P; i++) for(int i = 0 ;i < vs->P; i++)
{ {
for(int j = 0; j < vs->P; j++) for(int j = 0; j < vs->P; j++)
{ {
store_matrix[i][j] = vs->r_matrix[i][j]; //storing values of the relation matrix to detect any cycle with single les symbol in it. store_matrix[i][j] = vs->r_matrix[i][j]; //storing values of the relation matrix to detect any cycle with single les symbol in it.
//cout << store_matrix[i][j] << endl;
} }
} }
for(char x=1; x <= X; x++) { for(char x=1; x <= X; x++) {
...@@ -674,7 +677,7 @@ vector<stateGCPP*> stateGCPP::addNextTPDA() { ...@@ -674,7 +677,7 @@ vector<stateGCPP*> stateGCPP::addNextTPDA() {
} }
//assume the relation of fraction part with respect to the new system. //assume the relation of fraction part with respect to the new system.
//first assume it to be \leq //first assume it to be \leq
rs->r_matrix = rs->allocate_r_matrix();// do we need to allocate? or it is sufficent to just point? rs->allocate_r_matrix();// do we need to allocate? or it is sufficent to just point?
for(int i = 0 ;i < vs->P; i++) for(int i = 0 ;i < vs->P; i++)
{ {
for(int j = 0; j < vs->P; j++) for(int j = 0; j < vs->P; j++)
...@@ -688,8 +691,9 @@ vector<stateGCPP*> stateGCPP::addNextTPDA() { ...@@ -688,8 +691,9 @@ vector<stateGCPP*> stateGCPP::addNextTPDA() {
v.push_back(rs); // rs will be a reachable state after add operation v.push_back(rs); // rs will be a reachable state after add operation
} }
delete[] clockDis,clockAcc,transitionMap; //removing after finishing with it //removing after finishing with it
} }
delete[] clockDis,clockAcc,transitionMap;
} }
} }
...@@ -725,7 +729,7 @@ stateGCPP* stateGCPP::sucState(){ ...@@ -725,7 +729,7 @@ stateGCPP* stateGCPP::sucState(){
vs->del = new char[count]; vs->del = new char[count];
vs->w = new char[count]; vs->w = new char[count];
vs->r_matrix = vs->allocate_r_matrix(que); vs->allocate_r_matrix(que);
vs->del[count-1] = del[P-1]; vs->del[count-1] = del[P-1];
vs->w[count-1] = w[P-1]; vs->w[count-1] = w[P-1];
...@@ -916,10 +920,10 @@ stateGCPP* getZeroState() { ...@@ -916,10 +920,10 @@ stateGCPP* getZeroState() {
vs->L = 1; // only one point is there vs->L = 1; // only one point is there
vs->P = 1; vs->P = 1;
vs->f = 0; // no push pop info yet, no accuracy info yet vs->f = 0; // no push pop info yet, no accuracy info yet
vs->r_matrix = vs->allocate_r_matrix(); vs->allocate_r_matrix(que);
for(int i =0 ; i < vs->P;i++) // with 'na'. // for(int i =0 ; i < vs->P;i++) // with 'na'.
for(int j = 0; j < vs->P; j++) // for(int j = 0; j < vs->P; j++)
vs->r_matrix[i][j] = que; // vs->r_matrix[i][j] = que;
vs->del = new char[1]; // memory allocation vs->del = new char[1]; // memory allocation
vs->w = new char[1]; vs->w = new char[1];
...@@ -1283,21 +1287,30 @@ void stateGCPP::delete_w() ...@@ -1283,21 +1287,30 @@ void stateGCPP::delete_w()
} }
relation ** stateGCPP::allocate_r_matrix() void stateGCPP::allocate_r_matrix()
{ {
//allocating space for r matrix without any initialization and the size //allocating space for r matrix without any initialization and the size
// is same as the value of P of the state // is same as the value of P of the state
r_matrix = new relation*[P]; r_matrix = new relation*[P];
for(int i = 0; i < P; i++) for(int i = 0; i < P; i++)
r_matrix[i] = new relation[P]; r_matrix[i] = new relation[P];
} }
relation ** stateGCPP::allocate_r_matrix(relation r) void stateGCPP::allocate_r_matrix(relation r)
{ {
//allocate space for the matix r-matrix for the state, //allocate space for the matix r-matrix for the state,
// this allocation initialized the array with given relation variable // this allocation initialized the array with given relation variable
r_matrix = new relation*[P]; r_matrix = new relation*[P];
for(int i = 0; i < P; i++) for(int i = 0; i < P; i++)
r_matrix[i] = new relation[P]{r}; r_matrix[i] = new relation[P];
for(int i=0; i < P; i++)
for(int j = 0; j< P; j++){
if(i==j)
r_matrix[i][j] = z;
else
r_matrix[i][j] = r;
}
} }
relation** stateGCPP::allocate_r_matrix(char P) relation** stateGCPP::allocate_r_matrix(char P)
{ {
......
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