Finish the test script

This commit is contained in:
Segcolt 2024-10-12 17:56:35 -03:00
parent b791a80128
commit e6d4434e69
3 changed files with 18 additions and 3 deletions

View File

@ -3,7 +3,15 @@
#include "sa.hpp"
int main()
#ifndef TEMP
#define TEMP 1000
#endif
#ifndef ALPHA
#define ALPHA 0.99
#endif
int main(int argc, char *argv[])
{
int number_of_items = 0;
int capacity = 0;
@ -15,7 +23,7 @@ int main()
}
sa::solution act = sa::solution::simulated_annealing(capacity, items,
1000, 0.99);
TEMP, ALPHA);
act.print_sol();
}

7
run.sh Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
IFS=$'\n'
for file in $(find test -type f); do
build/main.out < $file
done

2
sa.hpp
View File

@ -80,7 +80,6 @@ class solution {
for (auto i : items) {
if (now + i > capacity) {
print_box(box_now, items_stored);
std::cout << '\n';
box_now++;
now = i;
} else {
@ -90,6 +89,7 @@ class solution {
}
print_box(box_now, items_stored);
std::cout << '\n';
}
static auto simulated_annealing(int capacity, const std::vector<long long> &items,