MATLAB: I’m using a GlobalSearch (gs) function to find the global minimum for the function. But i get a errors like “PROBLEM structure should have a non-empty X0 field” and “Arguments must occur in name-value pairs”.

global search error

Here is my code what i'm using opts = optimoptions(@fmincon,'Algorithm','sqp','TolFun',1e-16,'TolX',1e-16,'MaxFunEvals',100000,… 'MaxIter',100000,'Diagnostics','on','Display','iter');
X0 = [1 1 1 0.1593 14.8 1.75 1 0.12 1 0.0027 1.86 0.5]; LB = [1 1 1 0.1593 14.8 1.75 0 0.12 0 0.0027 1.86 0.5]; UB = [1 1 1 1 90 pi/2 1 0.05 0.5 0.05 10 1];
problem = createOptimProblem('fmincon','objective',@(K) Efficiency_new_normal_all(K,[sigmaef,AeffModef,PiTef,NredT,VGT,c,d,mred,etaTSef,… repmat([gamma,R,Din,Dout,Dnut,Dwheel,BladeH,FPosition(i),RendMean,beta,a0,a1],[length(PiTef),1]),z2angle,z3geom],,X0,LB,UB,opts));
gs = GlobalSearch; [xfinal2, f] = run(gs, problem);

Best Answer

It would have been much easier to read your question if you had marked your code with the {} Code button.
But in any case it is clear what the problem is. You need to include your arguments in the createOptimProblem function in parameter-value pairs. For example, you might want
problem = createOptimProblem('fmincon','objective',fun,'lb',LB,'ub',UB,'x0',X0)
Here I am supposing that you earlier set fun to be your objective function handle @(K)Efficiency...
For details, see Create Problem Structure.
Alan Weiss
MATLAB mathematical toolbox documentation