On 3/18/2013 10:19 PM, Haemish wrote:
> I have got it and sorry for my mistake.
>
> That is finding x^2+y^2+z^2+75 is not the object and x^2y^2z^2+75
> is the object as in the code.
> Thus the object function is concave and fmincon cannot find a global
> minimum in the case of concave and minimization is deeply influenced
> byt the initial point. Is that right?
>
> Sincerely yours, thank you.
> 
> Alan_Weiss <aweiss@mathworks.com> wrote in message
> <ki79nf$f5q$1@newscl01ah.mathworks.com>...
>> On 3/18/2013 10:08 AM, Haemish wrote:
>> > Dear sir,
>> >
>> > I have some questions on fmincon initial value problem.
>> >
>> > The code belows are very simple one which find the minimum value.
>> >
>> > That is finding x^2+y^2+z^2+75 when lb=[0 0 0] and ub=[5 5 5]
>> > with constraint of x+y+z=8
>> >
>> > I think that even such a simple problem depends on the initial
>> value > strongly.
>> >
>> > Initial point [0 0 0] gives the answer [2.667 2.667 2.667] but
>> initial > point [0 1 1] gives the answer [0 4 4]. However I know that
>> the answer > is [0 3 5] (irrespective the [x y z] sequence).
>> >
>> > I think that this is convex quadratic problem but fmincon
>> minimization > answer should be found uniquely.
>> > Are there any problems on my probelm definition? And are there any
>> > tips to overcome fmincon initial value problem except for random >
>> initial value startings?
>> >
>> > Sincerely yours
>> >
>> > Thank you.
>> >
>> >  code >
>> 
>> > %main.m
>> > optNLP = optimset( 'UseParallel','always','Algorithm', >
>> 'activeset','Display','iterdetailed','TolX',1e10,'TolFun',1e15,'TolCon',1e20,'MaxFunEval',10000,'MaxIter',1000000,'DiffMinChange',1e15
>> > );
>> > pCOM0 = [0 5 5]';
>> > lb = [0*ones(3,1)]; ub = > [5*ones(3,1)]; [popt, Jopt, >
>> exitflag,output,labda,grad,hessian] = fmincon( @(p)obj(p), pCOM0,[],
>> > [], [], [], lb, ub, @(p)ctr(p), optNLP)
>> >
>> > %ctr.m
>> > function [c,ceq] = ctr(p)
>> > ceq=sum(p)8;
>> > c=[];
>> > end
>> >
>> > %obj.m
>> > function Y = obj(p)
>> > Y = p(1).^2p(2).^2p(3).^2+75;
>> > end
>>
>> You are finding a maximum, not a minimum, with your objective
>> function. That is the result when you take sum(p.^2) as the
>> objective instead of sum(p.^2). See
>> http://www.mathworks.com/help/optim/ug/writingobjectivefunctions.html#brhkghv5
>>
>>
>> Also, your options settings are not very good. In particular, setting
>> TolCon to 1e20 is the same as setting it to zero, which can cause
>> problems for fmincon. And setting DiffMinChange to 1e15 makes no
>> sense at all, leave it at the default value, and use centered finite
>> differences if you want more accuracy (set FinDiffType to
>> 'centered'). See
>> http://www.mathworks.com/help/optim/ug/tolerancesandstoppingcriteria.html
>>
>>
>> Good luck,
>>
>> Alan Weiss
>> MATLAB mathematical toolbox documentation
Yes, concave objective functions lead to solutions that depend on the
initial value. See, for example,
http://www.mathworks.com/help/optim/ug/whenthesolversucceeds.html#brhkghv65
Alan Weiss
MATLAB mathematical toolbox documentation
