필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
Ben Wang
Ben Wang 2011년 4월 15일
댓글: Feng Qiu 2014년 4월 1일
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
Ben Wang
Ben Wang 2011년 4월 16일
Thanks Eric for the fast response! It works.
Cheers
Ben
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