clear all;
close all;

Nopt=50;%全試行回数
Nrand=10;%初期ランダム探査回数
AcquisitionFunction='expected-improvement';%獲得関数
%'expected-improvement-per-second-plus'
%'expected-improvement'
%'expected-improvement-plus'
%'expected-improvement-per-second'
%'lower-confidence-bound'
%'probability-of-improvement'

%%
%最適化したい変数の探索範囲
ranges(1,1:2)=[0,6.5];%x1
ranges(2,1:2)=[0,6.5];%x2

%%

D=size(ranges,1);

vars=[];
for i=1:D
    vars=[vars,optimizableVariable(strcat('x',num2str(i)),ranges(i,:));];
end

results = bayesopt(@fnc,vars,...
    'MaxObjectiveEvaluations',Nopt,...
    'NumSeedPoints',Nrand,...
    'AcquisitionFunctionName',AcquisitionFunction,...
    'OutputFcn',@assignInBase,...
    'SaveVariableName','BayesLog');
