필터 지우기
필터 지우기

Use simulannealbnd without specifying the Upper andd lower bound

조회 수: 2 (최근 30일)
Subrat Bastola
Subrat Bastola 2022년 9월 1일
답변: Sam Chak 2022년 9월 1일
Is it possible to use the simulannealbnd without actually specifying the lowerbound and upper bound, yet adding ither options to the functions?
For ex for: [x,fval,exitflag,output] = simulannealbnd(fun,x0,lb,ub,options), I specified lb=[],ub=[]
I got error saying LB must be a double.
What could've been the problem?

답변 (2개)

Walter Roberson
Walter Roberson 2022년 9월 1일
use -inf and +inf for the bounds

Sam Chak
Sam Chak 2022년 9월 1일
There is no issue in this example. Perhaps, try clearing lb and ub variables from the Workspace.
fun = @(x) x.^4 - 16*x.^2 + 5*x;
fplot(fun), grid on, xlabel('x'), ylabel('f(x)')
x0 = 0;
% lb = -5;
% ub = 5;
options = optimoptions(@simulannealbnd, 'MaxIterations', 150)
options =
simulannealbnd options: Set properties: MaxIterations: 150 Default properties: AcceptanceFcn: @acceptancesa AnnealingFcn: @annealingfast DataType: 'double' Display: 'final' FunctionTolerance: 1.0000e-06 HybridFcn: [] InitialTemperature: 100 MaxFunctionEvaluations: '3000*numberOfVariables' MaxStallIterations: '500*numberOfVariables' MaxTime: Inf ObjectiveLimit: -Inf OutputFcn: [] PlotFcn: [] ReannealInterval: 100 TemperatureFcn: @temperatureexp
% x = simulannealbnd(fun, x0, lb, ub, options)
x = simulannealbnd(fun, x0, [], [], options)
Maximum number of iterations exceeded: increase options.MaxIterations.
x = -2.9250

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by