Commit 8e0c58f2 authored by SPARSA ROYCHOWDHURY's avatar SPARSA ROYCHOWDHURY

19/10/17:

1. Forget Bug is there. 
2. Please think how to solve it.
parent aa910b64
3 2 1 0 0
1
3
1 2 0 1 0
1 2 0 2 0
0
2 3 0 1 0
1 1 0 2 1
0
digraph finite_state_machine {
node [shape = point ]; qi0;
node [shape = doublecircle];3;
node [shape=circle];
qi0 -> 0;
0 -> 1 [ label = "{tn:0,x1:=0}" ];
1 -> 1 [ label = "{tn:1,x1:=0}" ];
1 -> 2 [ label = "{tn:2,2<=x1<=2}" ];
2 -> 3 [ label = "{tn:3,1<=x1<2}" ];
}
\ No newline at end of file
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
1 1 1 1
2 3 0 1 0 2 3 0 1 0
1 0 0 1 1 1 0 0 1 0
0 0
3 4 0 0 0 3 4 0 0 0
...@@ -31,4 +31,4 @@ ...@@ -31,4 +31,4 @@
0 0
4 4 0 0 0 4 4 0 0 0
2 1 1 0 2 0 2 1 1 1 2 0
...@@ -8,8 +8,8 @@ digraph finite_state_machine { ...@@ -8,8 +8,8 @@ digraph finite_state_machine {
1 -> 5 [ label = "{tn:2,1<=x1<=2,pp_2,6<=x2<=8}" ]; 1 -> 5 [ label = "{tn:2,1<=x1<=2,pp_2,6<=x2<=8}" ];
2 -> 1 [ label = "{tn:3}" ]; 2 -> 1 [ label = "{tn:3}" ];
2 -> 2 [ label = "{tn:4,1<=x1<=1,x1:=0,ps_1}" ]; 2 -> 2 [ label = "{tn:4,1<=x1<=1,x1:=0,ps_1}" ];
2 -> 3 [ label = "{tn:5,0<=x1<1}" ]; 2 -> 3 [ label = "{tn:5,0<=x1<=1}" ];
3 -> 4 [ label = "{tn:6}" ]; 3 -> 4 [ label = "{tn:6}" ];
4 -> 2 [ label = "{tn:7,0<=x1<=2}" ]; 4 -> 2 [ label = "{tn:7,0<=x1<=2}" ];
4 -> 4 [ label = "{tn:8,pp_1,1<=x2<=2}" ]; 4 -> 4 [ label = "{tn:8,pp_1,1<x2<=2}" ];
} }
\ No newline at end of file
input1/tp63.png

43.1 KB | W: | H:

input1/tp63.png

43.4 KB | W: | H:

input1/tp63.png
input1/tp63.png
input1/tp63.png
input1/tp63.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
#include<iostream> #include<iostream>
//relation comparison[4][4] = {{les,les,les,les},{les,leq,leq,leq},{les,leq,que,que},{les,leq,que,na}}; //relation comparison[4][4] = {{les,les,les,les},{les,leq,leq,leq},{les,leq,que,que},{les,leq,que,na}};
relation addition[4][4] = {{z,les,leq,que},{les,les,les,que},{leq,les,leq,que},{que,que,que,que}};//,{inf,les,leq,que,inf}}; //relation addition[4][4] = {{z,les,leq,que},{les,les,les,que},{leq,les,leq,que},{que,que,que,que}};//,{inf,les,leq,que,inf}};
relation addition[4][4] = {{z,les,leq,que},{les,les,les,que},{leq,les,leq,leq},{que,que,leq,que}};
using namespace std; using namespace std;
// 'tpdaGCPPtrie' is used for checking if newly generated state was already generated earlier or not // 'tpdaGCPPtrie' is used for checking if newly generated state was already generated earlier or not
...@@ -349,6 +350,7 @@ stateGCPP* stateGCPP::reduce(char dn){ ...@@ -349,6 +350,7 @@ stateGCPP* stateGCPP::reduce(char dn){
//vslastindex--; //vslastindex--;
} }
} }
pairWiseTightestRelation(r_matrix,P);
for(char i = 0; i < vs->P-1; i++)// this code may change, later. for(char i = 0; i < vs->P-1; i++)// this code may change, later.
{ {
for(char j = 0 ; j< vs->P-1; j++) for(char j = 0 ; j< vs->P-1; j++)
...@@ -380,7 +382,7 @@ stateGCPP* stateGCPP::reduce(char dn){ ...@@ -380,7 +382,7 @@ stateGCPP* stateGCPP::reduce(char dn){
// last distance accuracy // last distance accuracy
vs->f = nf; // add partial flag variable to new state vs->f = nf; // add partial flag variable to new state
print_r_matrix(vs->r_matrix,vs->P);
return vs; // return the partially new state, **** last tsm missing with partial nf as given return vs; // return the partially new state, **** last tsm missing with partial nf as given
} }
...@@ -403,7 +405,10 @@ bool stateGCPP::consSatisfied(stateGCPP* vs,char dn, char wn, short *clockDis, b ...@@ -403,7 +405,10 @@ bool stateGCPP::consSatisfied(stateGCPP* vs,char dn, char wn, short *clockDis, b
} }
} }
// bool flag1; // bool flag1;
#pragma openmp parallel for // cout << int(dn) << endl;
// cout << int(wn) << endl;
// cout << endl;
//#pragma openmp parallel for
for(char x=1; x <= X; x++) { for(char x=1; x <= X; x++) {
if( isChecked(x, dn) ) { // if there is a check for clock x if( isChecked(x, dn) ) { // if there is a check for clock x
...@@ -456,7 +461,8 @@ bool stateGCPP::consSatisfied(stateGCPP* vs,char dn, char wn, short *clockDis, b ...@@ -456,7 +461,8 @@ bool stateGCPP::consSatisfied(stateGCPP* vs,char dn, char wn, short *clockDis, b
} }
// if(flag1) // if(flag1)
// print_r_matrix(store_matrix,vs->P); cout << endl;
print_r_matrix(store_matrix,vs->P);
pairWiseTightestRelation(store_matrix,vs->P); pairWiseTightestRelation(store_matrix,vs->P);
// if(flag1) // if(flag1)
// print_r_matrix(store_matrix,vs->P); // print_r_matrix(store_matrix,vs->P);
...@@ -478,7 +484,7 @@ bool stateGCPP::consSatisfied(stateGCPP* vs,char dn, char wn, short *clockDis, b ...@@ -478,7 +484,7 @@ bool stateGCPP::consSatisfied(stateGCPP* vs,char dn, char wn, short *clockDis, b
} }
} }
} }
#pragma openmp parallel for //#pragma openmp parallel for
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++)
...@@ -515,7 +521,7 @@ bool stateGCPP::stackCheck(stateGCPP* vs,char dn, char wn, short dlr, bool aclr) ...@@ -515,7 +521,7 @@ bool stateGCPP::stackCheck(stateGCPP* vs,char dn, char wn, short dlr, bool aclr)
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);
#pragma openmp parallel for //#pragma openmp parallel for
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++)
...@@ -571,7 +577,7 @@ bool stateGCPP::stackCheck(stateGCPP* vs,char dn, char wn, short dlr, bool aclr) ...@@ -571,7 +577,7 @@ bool stateGCPP::stackCheck(stateGCPP* vs,char dn, char wn, short dlr, bool aclr)
return false; return false;
else else
{ {
#pragma openmp parallel for //#pragma openmp parallel for
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++)
...@@ -618,7 +624,7 @@ vector<stateGCPP*> stateGCPP::addNextTPDA() { ...@@ -618,7 +624,7 @@ vector<stateGCPP*> stateGCPP::addNextTPDA() {
char q = transitions[ del[P-1] ].target; // target state of last transition char q = transitions[ del[P-1] ].target; // target state of last transition
// iterate through all the upcoming transitions // iterate through all the upcoming transitions
#pragma openmp parallel for //#pragma openmp parallel for
for(char i=0; i < nexttrans[q].size(); i++) { for(char i=0; i < nexttrans[q].size(); i++) {
dn = nexttrans[q][i]; // i-th upcoming transition dn = nexttrans[q][i]; // i-th upcoming transition
...@@ -637,6 +643,7 @@ vector<stateGCPP*> stateGCPP::addNextTPDA() { ...@@ -637,6 +643,7 @@ vector<stateGCPP*> stateGCPP::addNextTPDA() {
// o.w try to add new transtitions to the right // o.w try to add new transtitions to the right
else{ else{
// 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
cout << int(dn)<<endl;
stateGCPP* vs = reduce(dn); // get partial new state after adding transition 'dn'(TSM for 'dn' not known yet) stateGCPP* vs = reduce(dn); // get partial new state after adding transition 'dn'(TSM for 'dn' not known yet)
short *clockDis = new short[X + 1]; // distance from last reset of clock x to point P, stored in clockDis[x] short *clockDis = new short[X + 1]; // distance from last reset of clock x to point P, stored in clockDis[x]
...@@ -662,9 +669,10 @@ vector<stateGCPP*> stateGCPP::addNextTPDA() { ...@@ -662,9 +669,10 @@ vector<stateGCPP*> stateGCPP::addNextTPDA() {
// iterate through all possible TSM value for tranistion 'dn' and check for constraints on clocks and stack // iterate through all possible TSM value for tranistion 'dn' and check for constraints on clocks and stack
//relation rel[2] = {leq,les}; //relation rel[2] = {leq,les};
#pragma openmp parallel for //#pragma openmp parallel for
for(char wn=0; wn < M; wn++) { for(char wn=0; wn < M; wn++) {
//is it checking after adding the point to the state returned by reduce? //is it checking after adding the point to the state returned by reduce?
// if clock constraint not satisfied // if clock constraint not satisfied
if( !consSatisfied( vs,dn, wn, clockDis, clockAcc) ) { } if( !consSatisfied( vs,dn, wn, clockDis, clockAcc) ) { }
...@@ -702,9 +710,9 @@ vector<stateGCPP*> stateGCPP::addNextTPDA() { ...@@ -702,9 +710,9 @@ 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->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 a = 0 ;a < vs->P; a++) for(int a = 0 ;a < rs->P; a++)
{ {
for(int b = 0; b < vs->P; b++) for(int b = 0; b < rs->P; b++)
{ {
rs->r_matrix[a][b]=vs->r_matrix[a][b]; //restoring computed values to the matrix rs->r_matrix[a][b]=vs->r_matrix[a][b]; //restoring computed values to the matrix
} }
......
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