Path: news.mathworks.com!not-for-mail
From: Marcelo Marazzi <mREMOVEmaALLraCAPITALSzzi@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: correct objective function for fmincon
Date: Fri, 21 Nov 2008 16:11:32 -0500
Organization: The MathWorks, Inc.
Lines: 34
Message-ID: <gg7864$l68$1@fred.mathworks.com>
References: <gg4mbo$rpr$1@fred.mathworks.com>
NNTP-Posting-Host: marazzim.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: fred.mathworks.com 1227301892 21704 172.31.57.176 (21 Nov 2008 21:11:32 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 21 Nov 2008 21:11:32 +0000 (UTC)
User-Agent: Thunderbird 2.0.0.18 (Windows/20081105)
In-Reply-To: <gg4mbo$rpr$1@fred.mathworks.com>
Xref: news.mathworks.com comp.soft-sys.matlab:502412


If you're not providing the gradients, fmincon will estimate them 
internally via finite differences. You mention that the solver
returns with a zero gradient. There is a chance that the function
is flat around the initial point and therefore has zero gradient.
Assuming the constraints are satisfied, then it's a stationary
point and the solver may very well return that point (which is
a local solution as far as fmincon is concerned).

You might want to test the value of the gradient yourself (via finite 
differences) at the initial point and check it's value. If the function 
is noisy, you may need to choose and appropriate stepsize.

-Marcelo

Dmytro Vasylenko wrote:
> After the first iteration in fmincon I receive a gradient=0 and the answer:
>  "Optimization terminated: first-order optimality measure less
>  than options.TolFun and maximum constraint violation is less
>  than options.TolCon.
> No active inequalities."
> 
> My objective function is not Matlab code , the Matlab code is simply calling an external executable and feeds the results to the optimizer. I knew already an optimum solution and try to set the starting guess near this value. But it doesn't help.
> 
> For example the optimum solution is [34.04	  9.86	23.98	29.11	43.46	54.88	50.8	30.31]
> 
> By varying the first variable in the range 34.01-34.05 the objective function supply
> [0.230	 0.1816 	0.141	0.1287 	0.1529]
> that is the objective function is not highly extremal
> 
> What can be wrong in the objective function?
> 
> Thanks for your help in advance
> 
>