00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <stdio.h>
00025 #include <string.h>
00026 #include <time.h>
00027 #include <stdlib.h>
00028 #include "./bbob/bbobStructures.h"
00029 #include <ecf/ECF.h>
00030 #include "FunctionMinEvalOp.h"
00031
00032 extern int enableOutput;
00033
00034
00035 int main(int argc, char **argv)
00036 {
00037 unsigned int instances[15] = {1, 2, 3, 4, 5, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30};
00038 unsigned int ifun, idx_instances;
00039 int independent_restarts;
00040 double maxfunevals, minfunevals;
00041
00042 clock_t t0 = clock();
00043 time_t Tval;
00044
00045
00046
00047
00048
00049
00050
00051 for (ifun = 1; ifun <= 24; ifun++)
00052 {
00053
00054 for (idx_instances = 0; idx_instances < 15; idx_instances++)
00055 {
00056
00057 StateP state (new State);
00058
00059 FunctionMinEvalOp* evalOp = new FunctionMinEvalOp;
00060 state->setEvalOp(evalOp);
00061
00062
00063 evalOp->experimentMode_ = true;
00064 state->initialize(argc, argv);
00065 evalOp->experimentMode_ = false;
00066
00067
00068 enableOutput = 1;
00069
00070 state->getRegistry()->modifyEntry("coco.function", (voidP) (new uint(ifun)));
00071 state->getRegistry()->modifyEntry("coco.enableoutput", (voidP) (new uint(1)));
00072
00073
00074 state->getRegistry()->modifyEntry("coco.instance", (voidP) (new uint(instances[idx_instances])));
00075
00076
00077 state->getEvalOp()->initialize(state);
00078
00079
00080 maxfunevals = 10;
00081
00082 minfunevals = 10;
00083 independent_restarts = -1;
00084 while (fgeneric_evaluations() + minfunevals <= maxfunevals)
00085 {
00086 if (++independent_restarts > 0)
00087 fgeneric_restart("independent restart");
00088
00089
00090 state->run();
00091
00092 if (fgeneric_best() < fgeneric_ftarget())
00093 break;
00094 }
00095
00096 printf(" f%d in %d-D, instance %d: FEs=%.0f with %d restarts,", ifun, 10,
00097 instances[idx_instances], fgeneric_evaluations(), independent_restarts);
00098 printf(" fbest-ftarget=%.4e, elapsed time [h]: %.2f\n",
00099 fgeneric_best() - fgeneric_ftarget(), (double)(clock()-t0)/CLOCKS_PER_SEC/60./60.);
00100
00101 fgeneric_finalize();
00102 }
00103 Tval = time(NULL);
00104 printf(" date and time: %s", ctime(&Tval));
00105 }
00106
00107 return 0;
00108 }