Matlab';s MultiStart运行良好,但GlobalSearch出现故障

Matlab';s MultiStart运行良好,但GlobalSearch出现故障,matlab,Matlab,我正在尝试使用全局优化工具箱在Matlab中运行全局优化。我使用fmincon本地优化器作为输入。我能够成功地运行fmincon本地优化器,以及multistat全局优化器来解决这个问题。但是,当我尝试将其设置为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

我正在尝试使用全局优化工具箱在Matlab中运行全局优化。我使用
fmincon
本地优化器作为输入。我能够成功地运行
fmincon
本地优化器,以及
multistat
全局优化器来解决这个问题。但是,当我尝试将其设置为
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] = ...

任何提示都非常感谢。如果您有任何问题,请告诉我。

两个想法。如果您返回输出:
[x,f]=run(gs,problem)
,它会改变什么吗?而且,您的变量
wstart
是一个列向量-如果您转置它(有些函数可以优雅地处理这两个函数,有些函数则不能)?@horchler:感谢您的快速响应!我尝试添加
[x,f]=run(gs,problem)
,但错误仍然存在。我尝试转置
wstart
变量,但也没有解决错误。您能给我们“返回值中的差异”吗?如果它是一个复杂的函数,你能给我们一个最小的例子来重现这个错误吗?@Sevenless:“Difference_in_Return”是一个非常复杂的函数,它依赖于大量的数据;我很难提供它。似乎无论我对
wstart
使用什么,我都会得到错误。