Skip to content

Commit

Permalink
Fixes to outdated code
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulKlint committed Sep 30, 2024
1 parent f4d842c commit e090bdb
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions test/org/rascalmpl/benchmark/CompareShortestPath.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ private map[int, int] distance =();
private map[int, int] pred = ();
private set[int] settled = {};
//private set[int] Q = {};
private PriorityQueue Q = priorityQueue();
private PriorityQueue Q = priorityQueue([], -1);
private int MAXDISTANCE = 10000;

@doc{Shortest path between pair of nodes}
Expand All @@ -37,7 +37,7 @@ public list[int] shortestPathPair1(rel[int,int] G, int From, int To)
pred = ();
settled = {};
// Q = {From};
Q = priorityQueue(0, From);
Q = priorityQueue([], From);

// while (Q != {}){
while(!isEmpty(Q)){
Expand Down Expand Up @@ -75,7 +75,6 @@ private int extractMinimum()
min = q;
}
}
Q = Q - min;
return min;
}

Expand Down Expand Up @@ -105,19 +104,19 @@ public rel[int,int] Graph1 = {<5,8>,<1,2>,<3,4>,<3,3>,<2,3>,<2,2>,<6,7>,<6,6>,<7

public rel[int,int] randomGraph(int N, list[int] interval)
{
return {<getOneFrom(interval), getOneFrom(interval)> | int n <- [1 .. N]};
return {<getOneFrom(interval), getOneFrom(interval)> | int _ <- [1 .. N]};
}

public void measure1(rel[int,int] Graph1){

G = Graph1;
/* warm up for JVM */
for(int i <- [1 .. 50])
for(int _ <- [1 .. 50])
shortestPathPair(G, 1, 0);

jtime = 0.0; jmin = 10000.0; jmax = 0.0;
rtime = 0.0; rmin = 10000.0; rmax = 0.0;
for(int i <- [1 .. 20]){
for(int _ <- [1 .. 20]){
time1 = getMilliTime(); P1 = shortestPathPair(G, 1, 0); time2 = getMilliTime();
P2 = shortestPathPair1(G, 1, 0); time3 = getMilliTime();

Expand All @@ -133,7 +132,7 @@ public void measure1(rel[int,int] Graph1){
public void measure2(rel[int,int] Graph2)
{
for(int i <- [1 .. 2000])
for(int _ <- [1 .. 2000])
shortestPathPair1(Graph2, 1, 0);
}
Expand Down

0 comments on commit e090bdb

Please sign in to comment.