%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % MIDACO 7 benchmark - Brachistochrone with 500 variables % --------------------------------------------------------- % % Find the curve of fastest descent: a bead slides without friction % under gravity (g = 9.81) from the point (0,0) to the point (1,1), % the y axis points downwards (Johann Bernoulli, 1696). The curve is % a polygon with 501 segments over x(i) = i/501, the variables are % the heights y(1) to y(500). The travel time of a segment of length % L(i) is exact: t(i) = 2 L(i) / ( sqrt(2 g y(i-1)) + sqrt(2 g y(i)) ). % % Reference: https://en.wikipedia.org/wiki/Brachistochrone_curve % % Variables: 500 continuous variables % Constraints: none % Optimum: F(X) = 0.582962633737514 (optimum of this % discretization; the continuous cycloid gives % 0.582895463154743, about 1.2e-4 less) % % MIDACO setting: all parameters by default, start at the lower % bounds, the run stops when F(X) reaches the % optimum + 0.01 % (FSTOP). % % This benchmark needs a full MIDACO license: the limited version % solves problems with up to 8 variables and the default parameters. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function brachistochrone500 key = '************************************************************'; problem.func = @problem_function; problem.o = 1; % Number of objectives problem.n = 500; % Number of variables (in total) problem.ni = 0; % Number of integer variables (0 <= ni <= n) problem.m = 0; % Number of constraints (in total) problem.me = 0; % Number of equality constraints (0 <= me <= m) problem.xl = 1e-9 * ones(1,500); problem.xu = 2.0 * ones(1,500); problem.x = problem.xl; % Starting point: lower bounds option.maxeval = 10000000; option.maxtime = 60*60*24; option.printeval = 100000; option.save2file = 1; option.resumable = 0; option.param( 1) = 0; % ACCURACY option.param( 2) = 0; % SEED option.param( 3) = 0.582962633737514 + 1e-4*abs(0.582962633737514); % FSTOP option.param( 4) = 0; % ALGOSTOP option.param( 5) = 0; % EVALSTOP option.param( 6) = 0; % FOCUS option.param( 7) = 0; % ANTS option.param( 8) = 0; % KERNEL option.param( 9) = 0; % ORACLE option.param(10) = 0; % PARETOMAX option.param(11) = 0; % EPSILON option.param(12) = 0; % BALANCE option.param(13) = 0; % CHARACTER option.param(14) = 0; % SURROGATE option.param(15) = 0; % PMISQP option.parallel = 0; % Serial: 0 or 1, Parallel: 2,3,4,5,6,7,8... option.paradigm = 0; % Parallel mode: 0 = parfor, 1 = vectorized [F,G] = func(X) [ solution ] = midaco( problem, option, key ); end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [ f, g ] = problem_function( x ) % Travel time along the polygon through (0,0), (i/501, x(i)), (1,1) NS = 501; G = 9.81; dx = 1.0/NS; t = 0; yp = 0; vp = 0; for i = 1:NS if i < NS, y = x(i); else, y = 1.0; end v = sqrt(2*G*y); L = sqrt(dx*dx + (y-yp)*(y-yp)); t = t + 2*L/(vp+v); yp = y; vp = v; end f(1) = t; g = []; end