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

1 Ansicht (letzte 30 Tage)
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

Akzeptierte Antwort

Eric
Eric am 15 Apr. 2011
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 Kommentare
Ben Wang
Ben Wang am 16 Apr. 2011
Thanks Eric for the fast response! It works.
Cheers
Ben
Feng Qiu
Feng Qiu am 1 Apr. 2014
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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by