|
@@ -133,13 +133,22 @@ long getNanos() {
|
|
|
return std::chrono::high_resolution_clock::now().time_since_epoch().count();
|
|
|
}
|
|
|
|
|
|
-int main() {
|
|
|
+int main(int argAmount, char** args) {
|
|
|
long start = -getNanos();
|
|
|
|
|
|
if(r.read("romaniaroads.pl")) {
|
|
|
return 0;
|
|
|
}
|
|
|
- findCenter();
|
|
|
+ if(argAmount >= 2) {
|
|
|
+ int c = atoi(args[1]);
|
|
|
+ if(c < 0 || c >= r.getSize()) {
|
|
|
+ std::cout << c << " is not a valid center\n";
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ center = c;
|
|
|
+ } else {
|
|
|
+ findCenter();
|
|
|
+ }
|
|
|
|
|
|
r.print();
|
|
|
|
|
@@ -149,7 +158,7 @@ int main() {
|
|
|
init();
|
|
|
sort();
|
|
|
|
|
|
- for(int gens = 0; gens < 250; gens++) {
|
|
|
+ for(int gens = 0; gens < 500; gens++) {
|
|
|
size_t half = population.size() / 2;
|
|
|
for(size_t i = half; i < population.size(); i++) {
|
|
|
int parent = rand() % half;
|