How to pass in put values into objective functions using global search?

1 次查看(过去 30 天)
Dear all:
I have a complex minimisation problem described in function that has the form:
[ likelihood ] = likelihood(X0,param_fix, kalman_init, VarObs, X0_prior)
I can successfully find a minimum by using 'fmincon':
lb = [-1,0.0001,0.0001]';
ub = [1,1000,1000]';
options = optimset('Display','iter');
[param_est,~,~,~,~,grad,hessian] = fmincon('likelihood',X0,[],[],[],[],lb,ub,[],options,param_fix, kalman_init,VarObs);
However, when I try to run global search as in:
lb = [-1,0.0001,0.0001]';
ub = [1,1000,1000]';
options = optimset('Display','iter');
problem = createOptimProblem('fmincon','objective','likelihood','x0',X0, 'lb',lb,'ub',ub,'options',options,param_fix, kalman_init, VarObs);
param_est = run(GlobalSearch,problem);
Matlab complains about the arguments in createOptimProblem must be in pairs:
??? Error using ==> createOptimProblem at 92 Arguments must occur in name-value pairs.
So my question is, how to pass input values, in my case are 3 matrices 'param_fix, kalman_init, VarObs' into the objective function? The objective function it self is very complex as it is not an analytical expression. It calls other files to numerically evaluate the value to be minimised.
Thanks in advance for your reply.
Ben

采纳的回答

Eric
Eric 2011-4-15
I believe one way is to use function handles. Try the following
func = @(x)likelihood(x, param_fix, kalman_init, VarObs);
and then use func as the objective to be minimized. I've not used createOptimProblem before as I don't have the Global Optimization Toolbox, but its documentation says this argument can be a function handle.
Good luck, Eric
  2 个评论
Feng Qiu
Feng Qiu 2014-4-1
I tried the function handles as you say,but it didn't work. Matlab error: Error using createOptimProblem (line 93) Field name should be a string.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Variables 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by