diff options
author | Alexandre Jesus <adbjesus@gmail.com> | 2016-10-05 18:42:30 +0100 |
---|---|---|
committer | Alexandre Jesus <adbjesus@gmail.com> | 2016-10-05 18:42:30 +0100 |
commit | 73010dc96357a9715b87421534bebc19ecd5863d (patch) | |
tree | 3dc42a2467ba8d2ff78ac54f2c3e2377de438b5c /src/main | |
parent | ddb004a2cc4ee7906f2167493da8d43b652ecdc4 (diff) | |
download | libuknapsack-73010dc96357a9715b87421534bebc19ecd5863d.tar.gz libuknapsack-73010dc96357a9715b87421534bebc19ecd5863d.zip |
Fix issues that would lead to seg fault on the online method
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/online.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main/online.c b/src/main/online.c index ba8a94c..fb400ef 100644 --- a/src/main/online.c +++ b/src/main/online.c @@ -13,13 +13,13 @@ int main(int argc, char * argv[]){ struct front_item * front = NULL; struct online_return ret; - if(argc!=5){ + if(argc!=6){ printf("Wrong number of arguments!\n"); - printf("Example usage: %s algorithm1 algorithm2 sort_method data_file\n",argv[0]); + printf("Example usage: %s algorithm1 algorithm2 sort_method cut_pointa data_file\n", argv[0]); return 0; } - data = input(argv[4]); + data = input(argv[5]); /* Sort data */ srand(time(NULL)); @@ -29,10 +29,11 @@ int main(int argc, char * argv[]){ qsort(data->items, data->N, sizeof(struct item), cmp_items_ratio); } + printf("%d\n", atoi(argv[4])); clock_t t = clock(); /* Choose algorithm1 */ if(strcmp(argv[1], "dfs") == 0) { - ret = dfs_online(data, NULL, NULL, 20); + ret = dfs_online(data, NULL, NULL, atoi(argv[4])); } else if(strcmp(argv[1], "random_heuristic") == 0) { ret = random_heuristic_online(data, NULL, NULL); } |