Contents
MultiStartDemo
Date Reference: Parameter estimation in nonlinear algebraic models via global optimization. Computers & Chemical Engineering, Volume 22, Supplement 1, 15 March 1998, Pages S213-S220 William R. Esposito, Christodoulos A. Floudas
% Copyright (c) 2010, The MathWorks, Inc. % All rights reserved. close all, clear all, clc
Pharmacokinetic Data
t = [ 3.92, 7.93, 11.89, 23.90, 47.87, 71.91, 93.85, 117.84 ] %#ok<*NOPTS> c = [0.163, 0.679, 0.679, 0.388, 0.183, 0.125, 0.086, 0.0624 ] plot(t,c,'o'), xlabel('t'), ylabel('c')
t = 3.9200 7.9300 11.8900 23.9000 47.8700 71.9100 93.8500 117.8400 c = 0.1630 0.6790 0.6790 0.3880 0.1830 0.1250 0.0860 0.0624

3 Compartment Model
model = @(b,t) b(1)*exp(-b(4)*t) + b(2)*exp(-b(5)*t) + b(3)*exp(-b(6)*t)
model = @(b,t)b(1)*exp(-b(4)*t)+b(2)*exp(-b(5)*t)+b(3)*exp(-b(6)*t)
Define Optimization Problem
problem = createOptimProblem('lsqcurvefit', ... 'objective', model, ... 'xdata', t, 'ydata', c, ... 'x0',ones(1,6),... 'lb', [-10 -10 -10 0 0 0 ],... 'ub', [ 10 10 10 0.5 0.5 0.5], ... 'options',optimset('OutputFcn',... @curvefittingPlotIterates))
problem = objective: @(b,t)b(1)*exp(-b(4)*t)+b(2)*exp(-b(5)*t)+b(3)*exp(-b(6)*t) x0: [1 1 1 1 1 1] xdata: [3.9200 7.9300 11.8900 23.9000 47.8700 71.9100 93.8500 117.8400] ydata: [0.1630 0.6790 0.6790 0.3880 0.1830 0.1250 0.0860 0.0624] lb: [-10 -10 -10 0 0 0] ub: [10 10 10 0.5000 0.5000 0.5000] solver: 'lsqcurvefit' options: [1x1 struct]
solve
b = lsqcurvefit(problem)
b = 0.1835 0.1852 0.1832 0.0171 0.0171 0.0171

Multistart
ms = MultiStart
[b,fval,exitflag,output,solutions] = run(ms, problem, 50) %#ok<*NASGU,*ASGLU>
ms = MultiStart Properties: UseParallel: 'never' Display: 'final' TolFun: 1.0000e-006 TolX: 1.0000e-006 MaxTime: Inf StartPointsToRun: 'all' MultiStart completed some of the runs from the start points. 49 out of 50 local solver runs converged with a positive local solver exit flag. b = 0.3451 1.7251 -4.3064 0.0146 0.1030 0.3026 fval = 1.4540e-005 exitflag = 2 output = funcCount: 13258 localSolverTotal: 50 localSolverSuccess: 49 localSolverIncomplete: 1 localSolverNoSolution: 0 message: [1x142 char] solutions = 1x49 GlobalOptimSolution Properties: X Fval Exitflag Output X0

curvefittingPlotIterates(solutions)

problem.options.OutputFcn = {}; tic, [b,fval,exitflag,output,solutions] = run(ms, problem, 100), toc
MultiStart completed the runs from all start points. All 100 local solver runs converged with a positive local solver exit flag. b = 1.7266 -4.3072 0.3452 0.1031 0.3025 0.0146 fval = 1.4540e-005 exitflag = 1 output = funcCount: 23975 localSolverTotal: 100 localSolverSuccess: 100 localSolverIncomplete: 0 localSolverNoSolution: 0 message: [1x129 char] solutions = 1x100 GlobalOptimSolution Properties: X Fval Exitflag Output X0 Elapsed time is 7.914171 seconds.
Parallel Version
matlabpool open speedy-optim 16 ms.UseParallel = 'always' tic, [bp,fvalp,exitflagp,outputp,solutionsp] = run(ms, problem, 100); toc matlabpool close
Starting matlabpool using the 'speedy-optim' configuration ... connected to 16 labs. ms = MultiStart Properties: UseParallel: 'always' Display: 'final' TolFun: 1.0000e-006 TolX: 1.0000e-006 MaxTime: Inf StartPointsToRun: 'all' MultiStart completed the runs from all start points. All 100 local solver runs converged with a positive local solver exit flag. Elapsed time is 2.546513 seconds. Sending a stop signal to all the labs ... stopped.