-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
29 lines (25 loc) · 546 Bytes
/
main.c
File metadata and controls
29 lines (25 loc) · 546 Bytes
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
#include "ga.h"
#include "rnd.h"
#include "terminal_gui.h"
#include "zz_costfunction.h"
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
// debug level
int rdebug = 5;
int main(int n, char **arg) {
long g = 1;
Genome a;
// get number of generations from command
if (n > 1)
g = atol(arg[1]);
rndseed();
ga_init(100, 50);
ga_params(1000, 5, 2, .1, .01);
ga_run(g, costfunction1);
a = bestgenomesofar();
terminal_draw(a);
printf(">>> g=%ld ", g);
ga_printbests(1);
return 0;
}