Commit 17277298 authored by SPARSA ROYCHOWDHURY's avatar SPARSA ROYCHOWDHURY

15/7/2017:

1. Completed the reduceShuffle.cpp code vs->f variable still undone
2. have to use free properly to reduce the memory leak
3. have to work on the total program.

Sparsa Roychowdhury
parent fce2eeb0
No preview for this file type
...@@ -10,12 +10,7 @@ ...@@ -10,12 +10,7 @@
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/> <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2"> <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group> <group>
<file>file:/home/sparsa/Programming/mtp/src/tpdaZone.cpp</file> <file>file:/home/sparsa/NetBeansProjects/mtp/src/tpdaZone.cpp</file>
<file>file:/home/sparsa/Programming/mtp/include/timePushDown.h</file>
<file>file:/home/sparsa/Programming/mtp/src/timePushDown.cpp</file>
<file>file:/home/sparsa/Programming/mtp/main.cpp</file>
<file>file:/home/sparsa/Programming/mtp/src/tpdaCGPP.cpp</file>
<file>file:/home/sparsa/Programming/mtp/include/tpdaZone.h</file>
</group> </group>
</open-files> </open-files>
</project-private> </project-private>
...@@ -223,7 +223,7 @@ stateZone* stateZone::reduceShuffle(stateZone* s2) { ...@@ -223,7 +223,7 @@ stateZone* stateZone::reduceShuffle(stateZone* s2) {
//Now before reducing the state we want to check if the state is at all feasible.. //Now before reducing the state we want to check if the state is at all feasible..
// so we run the APSP algo. // so we run the APSP algo.
allPairSP(count+1); //this is the Floyd–Warshall algorithm implementation allPairSP(count); //this is the Floyd–Warshall algorithm implementation
...@@ -290,16 +290,16 @@ stateZone* stateZone::reduceShuffle(stateZone* s2) { ...@@ -290,16 +290,16 @@ stateZone* stateZone::reduceShuffle(stateZone* s2) {
} }
stateZone *vs = new stateZone(); // new TA state stateZone *vs1 = new stateZone(); // new TA state
vs->del = new char[newcount]; // allocate memory vs1->del = new char[newcount]; // allocate memory
vs->w = new short[newcount*newcount - newcount]; vs1->w = new short[newcount*newcount - newcount];
vs->f = f; // **** must edit this for tpda vs1->f = f; // **** must edit this for tpda
vs->P = newcount; vs1->P = newcount;
for(int i=0; i < newcount; i++) { for(int i=0; i < newcount; i++) {
vs->del[i]= del[newToOldRef[i]]; vs1->del[i]= vs->del[newToOldRef[i]];
} }
//vs->del[count-1] = dn; //vs->del[count-1] = dn;
...@@ -311,16 +311,16 @@ stateZone* stateZone::reduceShuffle(stateZone* s2) { ...@@ -311,16 +311,16 @@ stateZone* stateZone::reduceShuffle(stateZone* s2) {
for(int i=0;i < newcount; i++){ for(int i=0;i < newcount; i++){
for(int j=0; j < newcount; j++){ for(int j=0; j < newcount; j++){
if(i < j) { if(i < j) {
vs->w[index(i, j, count)] = WT[ newToOldRef[i] ][ newToOldRef[j] ]; vs1->w[index(i, j, newcount)] = WT[ newToOldRef[i] ][ newToOldRef[j] ];
//cout << int(newToOldRef[i]) << "," << int(newToOldRef[j]) << endl; //cout << int(newToOldRef[i]) << "," << int(newToOldRef[j]) << endl;
if( open[ newToOldRef[i] ][ newToOldRef[j] ] ) if( open[ newToOldRef[i] ][ newToOldRef[j] ] )
vs->w[index(i, j, count)] |= a32[15]; vs1->w[index(i, j, newcount)] |= a32[15];
} }
else if(i > j) { else if(i > j) {
vs->w[index(i, j, count)] = - WT[ newToOldRef[i] ][ newToOldRef[j] ]; vs1->w[index(i, j, newcount)] = - WT[ newToOldRef[i] ][ newToOldRef[j] ];
//cout << int(newToOldRef[i]) << "," << int(newToOldRef[j]) << endl; //cout << int(newToOldRef[i]) << "," << int(newToOldRef[j]) << endl;
if( open[ newToOldRef[i] ][ newToOldRef[j] ] ) if( open[ newToOldRef[i] ][ newToOldRef[j] ] )
vs->w[index(i, j, count)] |= a32[15]; vs1->w[index(i, j, newcount)] |= a32[15];
} }
} }
} }
...@@ -379,8 +379,8 @@ stateZone* stateZone::reduceShuffle(stateZone* s2) { ...@@ -379,8 +379,8 @@ stateZone* stateZone::reduceShuffle(stateZone* s2) {
*/ */
//vs->P = count; // #points in new state //vs->P = count; // #points in new state
free(vs);
return vs; return vs1;
} }
// reduce the #points after shuffle by using forget operation if possible and return the new state // reduce the #points after shuffle by using forget operation if possible and return the new state
......
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