230 likes | 436 Views
The Handbook of DACE in Tomlab. E-Fan Li , Department of Mathematics, National Taiwan University 2009/09/18. Contribution. Lien-Chi Lai - made a revision. Outline. Setup Function and Parameter Experiment. Setup. Pre-Procedure. Go to your own directory and start the Matlab. Pre-Procedure.
E N D
The Handbook of DACE in Tomlab E-Fan Li, Department of Mathematics, National Taiwan University2009/09/18
Contribution • Lien-Chi Lai - made a revision The Handbook of DACE in Tomlab
Outline • Setup • Function and Parameter • Experiment
Setup The Handbook of DACE in Tomlab
Pre-Procedure • Go to your own directory and start the Matlab. The Handbook of DACE in Tomlab
Pre-Procedure • Go to /opt/tomlab/ directory and start the Tomlab. • >> cd /opt/tomlab • >> startup The Handbook of DACE in Tomlab
Pre-Procedure • Back to work in your own directory. The Handbook of DACE in Tomlab
Pre-Procedure • Back to work in your own directory. The Handbook of DACE in Tomlab
Function and Parameter The Handbook of DACE in Tomlab
Function and Parameter 10 The Handbook of DACE in Tomlab • The Fundamental Setting of Experience Function >> Prob = glcAssign(ft_Name, LowerBound, UpperBound, ft_Name, [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []); >> Prob.MIP.nLocal = []; >> Prob.MIP.nGlobal = []; >> Prob.WarmStart = 1; • Get initial points from cgoSave.mat >> Prob.XGrid = OXgrid; % size(OXgrid) = dim-by-N • To construct surrogate surface • size(OXgrid)=dim-by-N, N = • OXgridis the coordinate in unitspace The Handbook of DACE in Tomlab Function and Parameter
Function and Parameter 11 The Handbook of DACE in Tomlab • Save the information of initial points as cgoSave.mat >> cul_initial(O, F, X, ft_Name); • O: the coordinate of initial point in original space • F:the function value of initial point • X: the coordinate of initial point in unitspace • ExecuterbfSolve_test >> Result = rbfSolve_test(Prob); • Surrogate surface will be saved as Result.surrogate_surface The Handbook of DACE in Tomlab Function and Parameter
Experiment The Handbook of DACE in Tomlab
Experiment 13 The Handbook of DACE in Tomlab >> ft_name = 'Ackley'; >> x_L = [-1.5; -1.5]; >> x_U = [ 1.5; 1.5]; >> Prob = glcAssign(ft_name, x_L, x_U, ft_name, [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []); >> Prob.MIP.nLocal = []; >> Prob.MIP.nGlobal = []; >> Prob.WarmStart = 1; >> Xgrid = gridsamp([x_L';x_U'], 25); >> OXgrid = (Xgrid -repmat(x_L', size(Xgrid, 1), 1)) ./ repmat((x_U -x_L)‘ ,size(Xgrid,1),1); >> Prob.XGrid = OXgrid'; The Handbook of DACE in Tomlab Experiment
Experiment 14 The Handbook of DACE in Tomlab >> init_pts = [-1.5000 -1.1250 15.2662;-1.3750 1.2500 15.4227;-1.2500 0.5000 14.0989; -1.1250 -0.1250 11.6858;-1.0000 1.3750 14.4187;-0.8750 0.6250 12.7996; -0.7500 0.2500 11.9174;-0.6250 1.5000 15.1234;-0.5000 -0.2500 11.6650; -0.3750 1.0000 12.5803;-0.2500 -1.0000 11.8531;-0.1250 -1.3750 13.7073; 0 -0.7500 10.9778; 0.1250 0.8750 10.9253; 0.2500 1.1250 12.5025; 0.3750 -0.8750 12.4219; 0.5000 -1.5000 15.0723; 0.6250 0 11.1906; 0.7500 -0.5000 12.7568; 0.8750 0.3750 12.4219; 1.0000 -0.6250 12.9159; 1.1250 -1.2500 14.0343; 1.2500 -0.3750 13.8584; 1.3750 0.7500 14.6122; 1.5000 0.1250 14.2366]; >> O = init_pts(:,1:2); >> F = init_pts(:,3); >> X = (O - repmat(x_L', size(init_pts,1),1)) ./ repmat((x_U-x_L)', size(init_pts,1),1); >> cul_initial(O, F, X, ft_name); >> Result = rbfSolve_test(Prob,0); >> sur_vec = Result.surrogate_surface; The Handbook of DACE in Tomlab Experiment
Experiment 15 The Handbook of DACE in Tomlab >> [x_grid, y_grid] = meshgrid(-1.5:3/24:1.5, -1.5:3/24:1.5); >> surf(x_grid, y_grid, reshape(sur_vec, 25, 25)); The Handbook of DACE in Tomlab Experiment
Reference • http://tomopt.com/tomlab/ • http://tomopt.com/docs/TOMLAB_CGO.pdf The Handbook of DACE in Tomlab
Appendix The Handbook of DACE in Tomlab
Appendix – Ackley.m function [f,error,icount] = Ackely(X, Prob) global FT_EVAL FT_EVAL = FT_EVAL + 1; error=0; icount=1; a = 20; b = 0.2; c = 2*pi; d = 5.7;z = 0.8;n = 2; if size(X, 1) == 2 x=X(1); y=X(2); f = (1./z).*( -a .* exp(-b.*sqrt((1./n).*(x.^2 + y.^2))) -... exp((1./n).*(cos(c.*x) + cos(c.*y))) + a + exp(1) + d ); else x = X(:,1); y = X(:,2); f = (1./z).*( -a .* exp(-b.*sqrt((1./n).*(x.^2 + y.^2))) -... exp((1./n).*(cos(c.*x) + cos(c.*y))) + a + exp(1) + d ); end The Handbook of DACE in Tomlab
Appendix – cul_initial.m function cul_initial(O,F,X,Name) O = O'; X = X'; F_m = min(median(F),F); Fpen = F; F00 = F; Cc = []; nCon = 0; nInit = length(F); nFunc = length(F); n = length(F); nSample = length(F); ExDText = 'initial points is design by myself'; rngState = rand('state'); fMinIdx = []; save cgoSave.mat The Handbook of DACE in Tomlab
Appendix – gridsamp.m(1/3) function S = gridsamp(range, q) %GRIDSAMP n-dimensional grid over given range % Call: S = gridsamp(range, q) % % range : 2*n matrix with lower and upper limits % q : n-vector, q(j) is the number of points % in the j'th direction. % If q is a scalar, then all q(j) = q % S : m*n array with points, m = prod(q) % hbn@imm.dtu.dk % Last update June 25, 2002 [mr n] = size(range); dr = diff(range); if mr ~= 2 | any(dr < 0) error(‘range must be an array with two rows andrange(1,:) <= range(2,:)') end The Handbook of DACE in Tomlab
Appendix – gridsamp.m(2/3) sq = size(q); if min(sq) > 1 | any(q <= 0) error('q must be a vector with non-negative elements') end p = length(q); if p == 1, q = repmat(q,1,n); elseif p ~= n error(sprintf('length of q must be either 1 or %d',n)) end % Check for degenerate intervals i = find(dr == 0); if ~isempty(i), q(i) = 0*q(i); end The Handbook of DACE in Tomlab
Appendix – gridsamp.m(3/3) % Recursive computation if n > 1 A = gridsamp(range(:,2:end), q(2:end)); % Recursive call [m p] = size(A); q = q(1); S = [zeros(m*q,1) repmat(A,q,1)]; y = linspace(range(1,1),range(2,1), q); k = 1:m; for i = 1 : q S(k,1) = repmat(y(i),m,1); k = k + m; end else S = linspace(range(1,1),range(2,1), q).'; end The Handbook of DACE in Tomlab
Appendix – All m-files The Handbook of DACE in Tomlab