Skip to content
Snippets Groups Projects
Commit e6447de4 authored by ALFROY THOMAS's avatar ALFROY THOMAS
Browse files

ajout du worst sprint

parent b655a57d
No related merge requests found
......@@ -11,6 +11,12 @@ all : clean objects bellmanFork
crashTest : clean objects eval
worstSprint : $(OBJ) worstSprint.o
gcc $(FLAGS) -o $@ $^ $(LIBS)
worstSprint.o: worstSprint.c
gcc $(FLAGS) -Iinclude -o $@ -c $^ $(LIBS)
spread : $(OBJ) spread.o
gcc $(FLAGS) -o $@ $^ $(LIBS)
......@@ -52,6 +58,8 @@ clean:
rm -rf randomTopo
rm -rf spread
rm -rf spread.o
rm -rf worstSprint.o
rm -rf worstSprint
crashTestAll: crashTest
for i in 100 200 300 400 500 600 700 800 900 1000 ; do ./eval $$i 2 >> results.txt ; done;
......
#include <stdio.h>
#include "include/base.h"
#include "include/Llist.h"
#include "include/LabelTable.h"
#include "include/Topology.h"
#include "include/ScopeStack.h"
#include "include/SrGraph.h"
#include "include/Dict.h"
#include "include/BinHeap.h"
int main()
{
int spread[12] = {10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 500, 1000};
long int means[12];
SrGraph* sr = NULL;
Topology* topo = NULL;
Dict* dist = NULL;
struct timeval start, stop;
char filename[128];
long int mean = 0;
int dictSize = 0;
for (int i = 0 ; i < 12 ; i++) {
memset(filename, 0, 128);
sprintf(filename, "topos/sprint-modif%d.isp", spread[i]);
topo = Topology_load_from_file(filename, 1, 0);
sr = SrGraph_create_from_topology(topo);
mean = 0;
dictSize = MIN(spread[i] * SEG_MAX , 1000);
for (int j = 0 ; j < sr->nbNode ; j++) {
dist = NULL;
gettimeofday(&start, NULL);
bellmanFork(&dist, sr, j, 1000, INF, dictSize, spread[i], 0, NULL, 0);
gettimeofday(&stop, NULL);
mean += (stop.tv_sec - start.tv_sec) * 1000000 + stop.tv_usec - start.tv_usec;
for (int k = 0 ; k < sr->nbNode ; k++) {
Dict_free(&dist[k]);
}
free(dist);
}
mean /= sr->nbNode;
means[i] = mean;
Topology_free(topo);
SrGraph_free(sr);
}
int worstIndex = 0;
long int worst = means[0];
for (int i = 1 ; i < 12 ; i++) {
if (worst < means[i]) {
worst = means[i];
worstIndex = i;
}
}
printf("The worst sprint is with spread %d\n", spread[worstIndex]);
return 0;
}
\ No newline at end of file
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