We got working implementations of genetic algorithms here. I can provide my M1 genetic optimizer framework with a simple example on how to use the optimizer for other tasks. One needs to declare the variables (e.g. compiler options) like that:
Code:
...
BITSTR(FMERGE_CONSTANTS, uint, 1, NO_FLAGS) MORE // a single bit
INTEGERL(FINLINE_LIMIT, uint, 0, 9999, NOLFAGS) MORE // values from 0 to 9999
...
I think a perl script could create a dump based on the gcc manual html. Together with the optimizer framework it'll create and assign the variables based on the currently evaluated individual of the population. You need to write a function, which mapps the (un)set variables to a given compiler settings string:
Code:
...
if (FMERGE_CONSTANTS) { arg += "-fmerge-constants "; }
arg += "-finline-limit=" + FINLINE_LIMIT;
...
In addition you need to "evaluate" the cost function and return its value (which is beeing minimized):
Code:
...
system("g++ " + args + ...); // compile
clock_t diff=clock();
system("a.out"); // run
diff = clock()-diff; // benchmark
...
BTW -O9 doesn't make any sense, -O3 is the max. level. Read the docs.