Skip to content

Commit

Permalink
fixed memory bug
Browse files Browse the repository at this point in the history
  • Loading branch information
HiromuOhtsuka committed May 24, 2017
1 parent 15993ca commit ae259fc
Showing 1 changed file with 5 additions and 36 deletions.
41 changes: 5 additions & 36 deletions tw/heuristic/CutDecomposer.java
Expand Up @@ -11,6 +11,7 @@ public class CutDecomposer{
public static final int LN = 2000;
public static final int HN = 100000;
public static final int HM = 1000000;
public static final int ONET = 400000;
public static final int STEP = 1000;
public static final long DEFAULTMAXSTEP = 500000;
public static int now;
Expand Down Expand Up @@ -51,6 +52,10 @@ public void decompose(){
public boolean decompose(long timeMS){
abort = false;
count = 0;
if(whole.graph.n > ONET){
return true;
}

decomposeWithOneCuts();
if(getTimeMS() > timeMS){
whole.flatten();
Expand Down Expand Up @@ -426,43 +431,7 @@ public boolean isAborted(){
return abort;
}

static private void printTreeWidth(Bag b){
endTime = System.currentTimeMillis();
System.out.print("," + b.width + "," + ((endTime-startTime)));
}

static long startTime;
static long endTime;

public static void main(String[] args){
Graph graph = Graph.readGraph(System.in);

Bag whole = new Bag(graph);

if(true){
startTime = System.currentTimeMillis();
}

CutDecomposer mtd = new CutDecomposer(whole);
mtd.decompose(1000000);

System.out.println(whole.width);
if(true){
printTreeWidth(whole);
System.out.println();
}

System.out.println(mtd.getTimeMS());

/*
for(Bag b : whole.nestedBags){
if(b.graph.n > 100){
System.out.println(b.graph.n);
for(int i=0;i<b.graph.n;i++){
System.out.println(b.graph.degree[i]);
}
}
}
*/
}
}

0 comments on commit ae259fc

Please sign in to comment.