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

3 visualizaciones (últimos 30 días)
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

Respuesta aceptada

Eric
Eric el 15 de Abr. de 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 comentarios
Ben Wang
Ben Wang el 16 de Abr. de 2011
Thanks Eric for the fast response! It works.
Cheers
Ben
Feng Qiu
Feng Qiu el 1 de Abr. de 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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Variables en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by