# The Handbook of DACE in Tomlab E-Fan Li, Department of Mathematics, National Taiwan University 2009/09/18.

## Presentation on theme: "The Handbook of DACE in Tomlab E-Fan Li, Department of Mathematics, National Taiwan University 2009/09/18."— Presentation transcript:

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 ContributionThe Handbook of DACE in Tomlab2

Outline  Setup  Function and Parameter  Experiment

SetupThe Handbook of DACE in Tomlab4 Setup

Pre-Procedure The Handbook of DACE in Tomlab5  Go to your own directory and start the Matlab. Pre-Procedure

The Handbook of DACE in Tomlab6  Go to /opt/tomlab/ directory and start the Tomlab.  >> cd /opt/tomlab  >> startup Pre-Procedure

The Handbook of DACE in Tomlab7  Back to work in your own directory. Pre-Procedure

The Handbook of DACE in Tomlab8  Back to work in your own directory. Pre-Procedure

Function and ParameterThe Handbook of DACE in Tomlab9 Function and Parameter

The Handbook of DACE in Tomlab10  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 =  OXgrid is the coordinate in unit space 10The Handbook of DACE in Tomlab

Function and Parameter The Handbook of DACE in Tomlab11  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 unit space  Execute rbfSolve_test >> Result = rbfSolve_test(Prob);  Surrogate surface will be saved as Result.surrogate_surface 11The Handbook of DACE in Tomlab

ExperimentThe Handbook of DACE in Tomlab12 Experiment

The Handbook of DACE in Tomlab13 >> 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'; 13The Handbook of DACE in TomlabExperiment

The Handbook of DACE in Tomlab14 >> 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; 14The Handbook of DACE in TomlabExperiment

The Handbook of DACE in Tomlab15 >> [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)); 15The Handbook of DACE in TomlabExperiment

Reference The Handbook of DACE in Tomlab16  http://tomopt.com/tomlab/ http://tomopt.com/tomlab/  http://tomopt.com/docs/TOMLAB_CGO.pdf http://tomopt.com/docs/TOMLAB_CGO.pdf Reference

AppendixThe Handbook of DACE in Tomlab17 Appendix

Appendix – Ackley.m The Handbook of DACE in Tomlab18 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 Appendix

Appendix – cul_initial.m The Handbook of DACE in Tomlab19 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 Appendix

Appendix – gridsamp.m (1/3) The Handbook of DACE in Tomlab20 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 and range(1,:) <= range(2,:)') end Appendix

Appendix – gridsamp.m (2/3) The Handbook of DACE in Tomlab21 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 Appendix

Appendix – gridsamp.m (3/3) The Handbook of DACE in Tomlab22 % 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 Appendix

Appendix – All m-files The Handbook of DACE in Tomlab23Appendix

Download ppt "The Handbook of DACE in Tomlab E-Fan Li, Department of Mathematics, National Taiwan University 2009/09/18."

Similar presentations