23#include <gsl/gsl_rng.h>
29int main(
int argc,
char **argv) {
32 int max_iter, pop_size, i;
36 fprintf(stderr,
"Usage: %s <file name> <pop size> <max iter>\n", argv[0]);
41 rng = gsl_rng_alloc(gsl_rng_mt19937);
42 gsl_rng_set(rng, time(0));
45 pop_size = atoi(argv[2]);
46 max_iter = atoi(argv[3]);
49 p = newProblem(argv[1]);
51 ss = newSolver(p, pop_size);
55 setRecombinationRate(ss, 0.);
56 setMutationRate(ss, (1.-1./getSelectivePressure(ss))*.8);
60 mincost = getObjectiveValue(getSolverSolution(ss));
61 printf(
"iter = 0, obj = %.0f\n", mincost);
62 for (i = 0; i < max_iter; i++) {
64 cost = getObjectiveValue(getSolverSolution(ss));
67 printf(
"iter = %d, obj = %.0f\n", i+1, mincost);
72 printSolution(getSolverSolution(ss));