Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: fminunc + transformation
Replies: 5   Last Post: Apr 12, 2013 1:37 PM

 Messages: [ Previous | Next ]
 Alan Weiss Posts: 1,430 Registered: 11/27/08
Re: fminunc + transformation
Posted: Apr 4, 2013 8:12 AM

On 4/4/2013 3:47 AM, Saad wrote:
>
>
> Alan_Weiss <aweiss@mathworks.com> wrote in message
> <kjhqkj\$ioi\$1@newscl01ah.mathworks.com>...

>> On 3/30/2013 5:26 PM, Saad wrote:
>> > 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?

>> >
>> > 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');
>> >
>> >
>> > Thanks a lot for your help
>> >
>> > Best Regards
>> >
>> > S

>>
>> It looks to me as if C_bar is a multidimensional variable constrained
>> to be between 0 and 1. Is that right?
>>
>> You can certainly include this transformation in a MATLAB statement:
>>
>> C_bar = lamda.*(exp(C)./(1+exp(C));
>>
>> The ./ and .* statements mean componentwise division and multiplication.
>>
>> However, I think you could avoid this complicated and (it seems to
>> me) fragile transformation by simply setting bounds on fmincon and
>> using the interior-point or sqp algorithms, which respect bounds.
>> http://www.mathworks.com/help/optim/ug/writing-constraints.html#br9p_ry
>>
>> Good luck,
>>
>> Alan Weiss
>> MATLAB mathematical toolbox documentation

>
> Hi Alan
>
> Thank you for your reply. I did try fmincon with different
> algorithms (interior-point and sqp algorithms) but could not locate
> the minimum. I also tightened the tolerance but still could not
> minimize (for info i am working on a kalman filtering problem). I
> think the issue is that I am not able to find a good initial guess.
> Any thoughts on how to handle that? Thanks a lot
>
> Best
>
> S

Well, assuming that you have upper and lower bounds on all components,
why not try a lot of random initial points?

x0 = lb + rand(size(lb)).*(ub - lb);

There are more suggestions here (written for Global Optimization
Toolbox, but you can use the suggestions anyway):

Alan Weiss
MATLAB mathematical toolbox documentation

Date Subject Author