-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathneatmain.cpp
75 lines (53 loc) · 1.53 KB
/
neatmain.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include <iostream>
#include <vector>
#include <io.h>
#include <cstring>
#include "neat.h"
#include "population.h"
#include "experiments.h"
using namespace std;
int main(int argc, char **argv) {
char mazename[100]="../../input_files/hard_maze.txt";
char outputdir[100]="../../output_files/";
char settingsname[100]="../../input_files/maze.ne";
NEAT::Population *p;
//***********RANDOM SETUP***************//
/* Seed the random-number generator with current time so that
the numbers will be different every time we run. */
srand((unsigned)time(NULL));// +getpid());
//Load in the params
if(argc>1)
strcpy_s(settingsname,argv[1]);
NEAT::load_neat_params(settingsname,true);
cout<<"loaded :"<<endl;
//args : maze.ne maze.txt choice#(1=fitness, 2=novelty) param
int choice=(-1);
if(argc>4)
choice=atoi(argv[4]);
int param=(-1);
if(argc>5)
param=atoi(argv[5]);
if (argc>3)
strcpy_s(mazename,argv[3]);
if (argc>2)
strcpy_s(outputdir,argv[2]);
cout << "(.ne) " << settingsname << " (outputdir) " << outputdir << " (.txt) " << mazename << endl;
cout<<"Please choose an experiment: "<<endl;
cout<<"1 - Maze Fitness Run" <<endl;
cout<<"2 - Maze Novelty Run" <<endl;
cout<<"Number: ";
if(choice==-1)
cin>>choice;
switch ( choice )
{
case 1:
p = maze_fitness_realtime(outputdir,mazename,param);
break;
case 2:
p = maze_novelty_realtime(outputdir,mazename,param);
break;
default:
cout<<"Not an available option."<<endl;
}
return(0);
}