Compare commits
2 Commits
f538278232
...
f536ca37fe
| Author | SHA1 | Date | |
|---|---|---|---|
| f536ca37fe | |||
| e6d4434e69 |
12
main.cpp
12
main.cpp
@ -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
7
run.sh
Executable 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
2
sa.hpp
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user