필터 지우기
필터 지우기

how to use transformation with fminunc

조회 수: 1 (최근 30일)
Saad
Saad 2013년 3월 30일
Dear all,
I am replicating a paper who recommends using fminunc to do a "constrained" optimization through a transformation. I have tried to use directly fmincon (with different algorithms) but the function doesnt optimize, thats the reason I would like to follow the paper advice and use a transformation as follows:
C_bar = lamda*(exp(C)/1+ exp(C))
where lamda is a constant, C is the unconstrained variable and C_bar is the constrained variable. I would really appreciate if you could show me how I could use the transformation in matlab. Do I have to create a seperate function? How can I link it to the optimizer please?
Here is my code
C=[1; 1; 1 ; 1; 1; 1; 1; 1; 1];
options=optimset('Diagnostics','on','Display','iter','TolX',0.001,'TolFun',0.001,'LargeScale','off','HessUpdate','bfgs');
[beta,fval,exitflag,output,grad,hessian] =fminunc(@mll,C,options)
Thanks a lot for your help
Best Regards
SB
  댓글 수: 2
Matt J
Matt J 2013년 3월 31일
편집: Matt J 2013년 3월 31일
Do you really mean
C_bar = lamda*exp(C)/(1+ exp(C))
Saad
Saad 2013년 3월 31일
Sorry I did miss a parenthese, it is actually
C=lamda* (exp(C)/(1+ exp(C)));

댓글을 달려면 로그인하십시오.

채택된 답변

Matt J
Matt J 2013년 3월 31일
Cbar=@(C) lamda*exp(C)/(1+ exp(C));
fminunc(@(C) mll(Cbar(C)) ,C,options)
  댓글 수: 3
Matt J
Matt J 2013년 3월 31일
Probably because of
'TolX',0.001,'TolFun',0.001
These look like very generous tolerances.
Saad
Saad 2013년 3월 31일
thats true. I will tighten the tolerances a bit and see if it helps the optimizer. Thanks Matt

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Problem-Based Optimization Setup에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by