% runs an entire experiment for benchmarking MY_OPTIMIZER % on the noise-free testbed. fgeneric.m and benchmarks.m % must be in the path of Matlab/Octave % CAPITALIZATION indicates code adaptations to be made clear all; clc; %close all; global evl addpath('PUT_PATH_TO_BBOB/matlab'); % should point to fgeneric.m etc. datapath = 'PUT_MY_BBOB_DATA_PATH'; % different folder for each experiment % opt.inputFormat = 'row'; opt.algName = 'PUT ALGORITHM NAME'; opt.comments = 'PUT MORE DETAILED INFORMATION, PARAMETER SETTINGS ETC'; maxfunevals = '1e4 * dim'; % 10*dim is a short test-experiment taking a few minutes % INCREMENT maxfunevals successively to larger value(s) minfunevals = 'dim + 2'; % PUT MINIMAL SENSIBLE NUMBER OF EVALUATIONS for a restart maxrestarts = 1e4; % SET to zero for an entirely deterministic algorithm dimensions =20;% [2, 3, 5, 10, 20, 40]; % small dimensions first, for CPU reasons functions = benchmarks('FunctionIndices'); % or benchmarksnoisy(...) instances =[1:5, 41:50]; % 15 function instances more off; t0 = clock; rand('state', sum(100 * t0)); ii=1; for dim = dimensions for ifun = 2%functions for iinstance = 1%instances fgeneric('initialize', ifun, iinstance, datapath, opt); % independent restarts until maxfunevals or ftarget is reached tic evl1=0; for restarts =0% 0:10%maxrestarts if restarts > 0 % write additional restarted info fgeneric('restart', 'independent restart') end % % % % % % % % % % % % % % CMAES % % % % % % % % % % % % % % % % % % [xbest, fbest, evl] = cmaes('fgeneric', 10 * rand(dim, 1) - 5, 1.5); % % % % % % % % % % % % % % % END OF CMAES % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % COMBEO % % % % % % % % % % % % % % % % % % % % % % MY_OPTIMIZER('fgeneric', dim, fgeneric('ftarget'), ... eval(maxfunevals)); % % % % % % % % % % % % % % % % % % END OF COMBEO% % % % % % % % % % % % % % % % evl1=evl1+evl; stat_fval(restarts+1)=fgeneric('fbest'); end toc mean_fval=mean(stat_fval); % fgeneric('ftarget')-mean_fval tmp=sort(stat_fval); best_fval=tmp(1); worst_fval=tmp(end); median_fval=median(stat_fval); % % st_data(ii,:)=[fgeneric('fbest'), fgeneric('ftarget'), dim, ifun, iinstance, restarts, evl1]; st_data(ii,:)=[fgeneric('ftarget'), dim, ifun, iinstance, restarts, evl1]; stat_fun_est(ii,:)=[mean_fval, best_fval, worst_fval, median_fval]; ii=ii+1; fgeneric('finalize'); end disp('ifun') ifun disp('dim') dim disp([' date and time: ' num2str(clock, ' %.0f')]); end disp(sprintf('---- dimension %d-D done ----', dim)); end