グローバル最適化ツールボックスを使用して、Matlab でグローバル最適化を実行しようとしています。fmincon
ローカル オプティマイザを入力として使用しています。この問題で、fmincon
ローカル オプティマイザとグローバル オプティマイザを正常に実行できます。MultiStart
ただし、 として設定しようとするとGlobalSearch
、エラー メッセージが表示されます。
以下は、私が使用しようとしているコードですGlobalSearch
:
%the functions is f(w) rather than f(x)
%constraints:
A = [1,0,0; 0,1,0; 0,0,1];
b = [.80, .80, .80];
Aeq = [1 1 1];
beq = 1;
lb = .10 * [1 1 1];
ub = .8 * [1 1 1];
w = [weight1, weight2, weight3];
wstart = randn(3,1);
options = optimset('Algorithm','interior-point');
% function handle for the objective function (note that variables
% aa through hh are additional parameters that the solver does not modify):
h = @(w)Difference_in_Returns(w(1),w(2),w(3), aa, bb, cc, dd, ee, ff, gg, hh);
% problem structure:
problem = createOptimProblem('fmincon','x0',wstart,'objective',h,'Aineq',A,...'
'bineq',b,'Aeq',Aeq,'beq',beq,'options',options,'lb',lb,'ub',ub);
gs = GlobalSearch;
run(gs,problem)
これを実行しようとすると、Matlab がバグを出して出力します:
Error using -
Matrix dimensions must agree.
Error in C:\Program Files\MATLAB\R2012a\toolbox\globaloptim\globaloptim\private\
globalsearchnlp.p>i_calcConstrViolation (line 593)
Error in C:\Program Files\MATLAB\R2012a\toolbox\globaloptim\globaloptim\private\
globalsearchnlp.p>i_calcPenalty (line 627)
Error in C:\Program Files\MATLAB\R2012a\toolbox\globaloptim\globaloptim\private\
globalsearchnlp.p>globalsearchnlp (line 343)
Error in GlobalSearch/run (line 330)
[x,fval,exitflag,output] = ...
Error in Optimization_Setup (line 62)
run(gs,problem)
問題は次の行で概説されていると思います。
Error using -
Matrix dimensions must agree.
Error in GlobalSearch/run (line 330)
[x,fval,exitflag,output] = ...
どんなヒントでも大歓迎です。ご不明な点がございましたら、お知らせください。