Commit 380b617a authored by SPARSA ROYCHOWDHURY's avatar SPARSA ROYCHOWDHURY

16/10/17:

1. Bugs Resolved
2. Logical Bug Exists
3. tp63 is one good example.
I can do it.
parent 7639d7a8
No preview for this file type
...@@ -44,10 +44,10 @@ class stateGCPP{ ...@@ -44,10 +44,10 @@ class stateGCPP{
stateGCPP* reduce(char dn); stateGCPP* reduce(char dn);
// return true iff clock gurards on new transition 'dn' with tsm value 'wn' is satisfied // return true iff clock gurards on new transition 'dn' with tsm value 'wn' is satisfied
bool consSatisfied(stateGCPP* vs, short* transitionMap,char dn, char wn, short *clockDis, bool *clockAcc); bool consSatisfied(stateGCPP* vs,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 // check for stack constraint where 'dlr' and 'aclr' are distance and accuracy resp. from L to R
bool stackCheck(stateGCPP* vs,short* transitionMap,char dn, char wn, short dlr, bool aclr); bool stackCheck(stateGCPP* vs,char dn, char wn, short dlr, bool aclr);
//check if the relation between the fractional parts are good or not. //check if the relation between the fractional parts are good or not.
bool relationSatisfied(char dn,char wn,relation r,short *clockDis,bool *clockAcc); bool relationSatisfied(char dn,char wn,relation r,short *clockDis,bool *clockAcc);
// reduce the #points after shuffle operation by using forget operation if possible // reduce the #points after shuffle operation by using forget operation if possible
...@@ -65,7 +65,7 @@ class stateGCPP{ ...@@ -65,7 +65,7 @@ class stateGCPP{
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
char reset_point(char t, char x);//returns the nearest reset point in the state of the clock x checked in transition t.
// 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();
......
[Dolphin]
Timestamp=2017,10,16,13,56,6
Version=4
[Settings]
HiddenFilesShown=true
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 0 1 0 2
4 5 0 0 0
2 2 1 0 -1 0
5 6 0 0 0
0
6 7 0 0 0
1 1
7 8 0 0 0
2 1 1 0 -1 0
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 0 2 0
2
0
4 2 0 1 0
2 1 0 1 0
1 1
4 1 0 0 1
2
2 1 0 0 -1 0
4 11 2 9 1
1
4
1 2 1 0 0
0
2 3 2 1 1
1 1 0 2 0
2
0
3 4 3 1 0
2 0 0 1 0
1 1
4 2 4 1 0
1 1 0 2 0
0
2 4 5 1 2
2 1 0 2 0
1 2
0
4 3 6 0 1
1
0
3 2 7 0 0
2 1 2 0 2 0
2 1 8 0 0
0
1 4 9 2 0
1 0 0 2 0
2 1 0 1 0
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 0 3 0
1
1 1
1 4 0 0 0
2 2 2 0 2 0
2 3 0 2 0
1 0 0 2 0
2 1 0 2 0
3 1 0 0 2 0 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 5 space separated intergers : <clock_number> <lower_bound> <open/close> <upper_bound> <open/close>
clock_number : clock(x) for which there is a check in this transition
lower bound : x >= lower_bound is the lower bound constraint
open/close: 0 if the bound is close and 1 if the bound is open
upper bound : x <= upper_bound is the upper bound constraint
open/close: 0 if the bound is closed and 1 if the bound is open
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 7 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 five space separated integers : <stack_symbol> <lower_bound> <open/close> <upper_bound> <open/close>
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
<open/close>: openness and closed ness of the bound
<upper_bound> : lower bound on the age of the stack symbol currently popped in this transition
<open/close>: openness and close ness of the bound.
<stack_symbol_2> : stack symbol number pushed in this transition
6 5 2 3 0
1
6
1 2 1 1 1
2 5 0 -1 0
2
0
2 3 0 1 0
1 0 0 4 0
0
5 4 1 1 0
1 0 0 4 0
0
1 5 0 1 1
1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 1 0
1 10 0 18 0
0
8 9 0 0 1
1
0
9 10 0 0 0
2 1 0 0 9 0
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 )
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 0 12 0
0
8 9 0 0 1
3
0
9 10 0 0 0
2 1 0 0 6 0
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)
4 4 1 2 1
4
1
1 2 1 1 0
1 1 0 1 0
0
2 3 2 0 1
1
2 1 1 0 -1 0
3 4 0 1 0
1 0 0 0 0
0
4 1 0 0 1
1
1 1
00 00
|X| = 1
|T| = 4
|M| = 1
6 8 2 3 2
1
5
1 2 0 1 0
1 1 0 -1 0
1 1
1 3 1 1 1
1 1 0 1 0
2
0
2 6 0 2 0
1 1 0 1 0
2 0 0 3 0
0
3 4 1 0 2
2 1
0
3 5 0 1 0
1 0 0 0 0
0
4 5 2 2 0
1 1 0 1 0
2 0 0 0 0
0
6 3 3 1 0
1 1 0 1 0
0
6 5 0 2 0
1 0 0 1 0
2 1 0 -1 0
2 1 1 0 1 0
00 00
5 6 1 0 1
1
4
1 2 0 1 0
1 0 0 0 0
0
2 3 0 0 0
1 1
3 4 0 0 0
0
4 1 0 1 1
1 0 0 2 0
1
2 1 0 0 -1 0
3 5 0 0 1
1
0
5 4 0 1 0
1 0 0 0 0
2 1 0 0 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 0 -1 0
0
2 3 0 1 0
1 1 0 -1 0
0
3 4 0 1 0
1 3 0 100 0
0
3 5 0 1 0
1 0 0 2 0
0
4 5 0 0 0
2 1 2 0 3 0
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 0 2 0
2 2 6 0 8 0
2 1 0 0 0
0
2 2 0 1 1
1 1 0 1 0
1
1 1
2 3 0 1 0
1 0 0 1 1
0
3 4 0 0 0
0
4 2 0 1 0
1 0 0 2 0
0
4 4 0 0 0
2 1 1 0 2 0
CC := g++ CC := g++
CFLAG := -lm -std=c++14 CFLAG := -lm -fopenmp -std=c++14
SRC := ./src SRC := ./src
OBJ := ./obj OBJ := ./obj
INC := ./include INC := ./include
......
...@@ -19,6 +19,10 @@ ...@@ -19,6 +19,10 @@
</df> </df>
<df name="input"> <df name="input">
</df> </df>
<df name="input1">
<df name="timeconsuming">
</df>
</df>
<df name="obj"> <df name="obj">
</df> </df>
<df name="output"> <df name="output">
......
...@@ -56,11 +56,11 @@ bool2 CircuitFinder::circuit(int V) ...@@ -56,11 +56,11 @@ bool2 CircuitFinder::circuit(int V)
bool CircuitFinder::cycleCheck() //here we need to check if there exists any cycle bool CircuitFinder::cycleCheck() //here we need to check if there exists any cycle
{ // with <+<=* regex. return 1 if there is a cycle and return 0 if not. { // with <+<=* regex. return 1 if there is a cycle and return 0 if not.
cout << "circuit: "; //cout << "circuit: ";
int countles=0; int countles=0;
for (auto I = Stack.begin(), E = Stack.end(); I != E; ++I) { for (auto I = Stack.begin(), E = Stack.end(); I != E; ++I) {
//checking of if the cycle have a < along with other <= //checking of if the cycle have a < along with other <=
cout << *I << " -> "; //cout << *I << " -> ";
if(I+1 != E) if(I+1 != E)
{ {
...@@ -90,7 +90,7 @@ bool CircuitFinder::cycleCheck() //here we need to check if there exists any cyc ...@@ -90,7 +90,7 @@ bool CircuitFinder::cycleCheck() //here we need to check if there exists any cyc
return false; return false;
} }
cout << *Stack.begin() << std::endl; //cout << *Stack.begin() << std::endl;
} }
......
...@@ -24,8 +24,8 @@ short T; // number of transitions in the timed system ...@@ -24,8 +24,8 @@ short T; // number of transitions in the timed system
char X; // number of clocks 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 A; // number of events or actions in the timed system
char AS; // number of stack symbols in the timed system char AS; // number of stack symbols in the timed system
char **recent_matrix; //char **recent_matrix;
char* clock_reset; //char* clock_reset;
transition *transitions; // transitions of the timed system transition *transitions; // transitions of the timed system
vector<vector<short int> > prevtrans; // prevtrans[i] : list of previous transitions for state i vector<vector<short int> > prevtrans; // prevtrans[i] : list of previous transitions for state i
vector<vector<short int> > nexttrans; // nexttrans[i] : list of next transitions for state i vector<vector<short int> > nexttrans; // nexttrans[i] : list of next transitions for state i
...@@ -136,22 +136,22 @@ void inputSystem() { ...@@ -136,22 +136,22 @@ void inputSystem() {
tiimeinfile >> x; // #clocks tiimeinfile >> x; // #clocks
X = x; X = x;
//
clock_reset = new char[X]; // clock_reset = new char[X];
for(int i = 0; i < X; i++) // for(int i = 0; i < X; i++)
{ // {
clock_reset[i] = 0; // the first reset points of every clocks is 0th transition. // clock_reset[i] = 0; // the first reset points of every clocks is 0th transition.
} // }
recent_matrix = new char*[T+1]; //allocate rows to the matrix which is the total number of transitions. // recent_matrix = new char*[T+1]; //allocate rows to the matrix which is the total number of transitions.
for(int i = 0; i < T+1 ; i++) // for(int i = 0; i < T+1 ; i++)
{ // {
recent_matrix[i] = new char[X]; //for every row we have columns with the number of clocks // recent_matrix[i] = new char[X]; //for every row we have columns with the number of clocks
//
} // }
for(int i = 0; i <X; i++) // for(int i = 0; i <X; i++)
{ // {
recent_matrix[0][i] = clock_reset[i]; // recent_matrix[0][i] = clock_reset[i];
} // }
tiimeinfile >> x; // #actions tiimeinfile >> x; // #actions
A = x; A = x;
...@@ -263,7 +263,7 @@ void inputSystem() { ...@@ -263,7 +263,7 @@ void inputSystem() {
exit(1); exit(1);
} }
reset |= a32[x]; // set x-th bit of 'reset' to '1' reset |= a32[x]; // set x-th bit of 'reset' to '1'
clock_reset[x] = i; // the latest transition which resets the clocks x is i. //clock_reset[x] = i; // the latest transition which resets the clocks x is i.
} }
// read stack operation number, 0 : nop, 1 : push, 2 : pop, 3 : pop & push // read stack operation number, 0 : nop, 1 : push, 2 : pop, 3 : pop & push
...@@ -388,12 +388,12 @@ void inputSystem() { ...@@ -388,12 +388,12 @@ void inputSystem() {
if(reset & a32[j]) // if j-th clock has been reset at i-th transitions // forget this if(reset & a32[j]) // if j-th clock has been reset at i-th transitions // forget this
resettrans[j].push_back(i); resettrans[j].push_back(i);
} }
for(int m = 0; m <X; m++) // for(int m = 0; m <X; m++)
{ // {
recent_matrix[i][m] = clock_reset[m]; //Updating the matrix // recent_matrix[i][m] = clock_reset[m]; //Updating the matrix
} // }
} }
delete clock_reset; //delete clock_reset;
prevtrans.resize(S+1); // #rows = S+1 in the 2D vector prevtrans and nexttrans // forget this prevtrans.resize(S+1); // #rows = S+1 in the 2D vector prevtrans and nexttrans // forget this
nexttrans.resize(S+1); // forget this nexttrans.resize(S+1); // forget this
......
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