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
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
>
>
"Dmytro Vasylenko" <dmytre@mathworks.com> wrote in message <gg4mbo$rpr$1@fred.mathworks.com>...
> 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.
>
Hi Dmytro,
I am pretty interesting in how you 'feeds" results to the optimizer.
I do not know how to use fmincon with discrete values because I have no model and analytical expression inm ycase.
Are you in the same situation?
Could you explain ,me how you deal with fmincon without using an analytical expression?
I've missed the option "DiffMinChange" of the fmincon. By adjusting this option I've fixed my problem
-
Dmytro
Marcelo Marazzi <mREMOVEmaALLraCAPITALSzzi@mathworks.com> wrote in message <gg7864$l68$1@fred.mathworks.com>...
> 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
> >
> >
In my case the variables are the geometry parameters of the RF device. After the tests it turned out that by default the gradient is calculated by varying the variables in the range 1e-6 or less. The device characteristics are not sensitive for such a small change in geometry.
I have changed the option "DiffMinChange" of the fmincon and I am able to work with my objective function now.
-
Dmytro
"loic paccard" <loic.paccard@ecam.fr> wrote in message <gg78nu$k0$1@fred.mathworks.com>...
> "Dmytro Vasylenko" <dmytre@mathworks.com> wrote in message <gg4mbo$rpr$1@fred.mathworks.com>...
> > 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.
> >
>
>
> Hi Dmytro,
>
> I am pretty interesting in how you 'feeds" results to the optimizer.
> I do not know how to use fmincon with discrete values because I have no model and analytical expression inm ycase.
> Are you in the same situation?
> Could you explain ,me how you deal with fmincon without using an analytical expression?
>
> Loic
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for
all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content.
Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available
via MATLAB Central.
Read the complete Terms prior to use.