Volumentric Efficiency Maximization with GlobalSearch
Copyright (c) 2010, The MathWorks, Inc. All rights reserved.
Contents
Objective Function
We wish find the maximum volumetric efficiency
clear all, close all, clc load VEdata % Create Contour Plot [ve,RPM,Pratio,VE] = VEMap([0,0],RPM,Pratio,VE); VEPlot

Define Optimization Problem
problem = createOptimProblem('fmincon',... 'objective',@(x)-VEMap([x(1)*10000 x(2)],RPM,Pratio,VE),... 'x0',[2200/10000 0.3],... % try 2200, 2700 'lb',[1000/10000 0],... 'ub',[6000/10000 1],... 'options',optimset('Algorithm','SQP','OutputFcn',... @(x,o,s)VEPlot([x(1)*10000 x(2)],o,s)))
problem = objective: @(x)-VEMap([x(1)*10000,x(2)],RPM,Pratio,VE) x0: [0.2200 0.3000] Aineq: [] bineq: [] Aeq: [] beq: [] lb: [0.1000 0] ub: [0.6000 1] nonlcon: [] solver: 'fmincon' options: [1x1 struct]
Run the solver fmincon from the inital point
We can see the solution is not the global minimum
close all
[x,f] = fmincon(problem)
x = 0.2371 0.8863 f = -0.8591

Use GlobalSearch to Find the Global Minimum
Define the multistart solver
close all
gs = GlobalSearch
gs = GlobalSearch Properties: NumTrialPoints: 1000 BasinRadiusFactor: 0.2000 DistanceThresholdFactor: 0.7500 MaxWaitCycle: 20 NumStageOnePoints: 200 PenaltyThresholdFactor: 0.2000 Display: 'final' TolFun: 1.0000e-006 TolX: 1.0000e-006 MaxTime: Inf StartPointsToRun: 'all'
Run GlobalSearch
[x,f,exitflag,output,solutions] = run(gs, problem)
GlobalSearch stopped because it analyzed all the trial points. All 7 local solver runs converged with a positive local solver exit flag. x = 0.4244 0.6689 f = -0.9734 exitflag = 1 output = funcCount: 2904 localSolverTotal: 7 localSolverSuccess: 7 localSolverIncomplete: 0 localSolverNoSolution: 0 message: [1x137 char] solutions = 1x6 GlobalOptimSolution Properties: X Fval Exitflag Output X0
