<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/239628</link>
    <title>MATLAB Central Newsreader - correct objective function for fmincon</title>
    <description>Feed for thread: correct objective function for fmincon</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Thu, 20 Nov 2008 21:55:04 -0500</pubDate>
      <title>correct objective function for fmincon</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/239628#612237</link>
      <author>Dmytro Vasylenko</author>
      <description>After the first iteration in fmincon I receive a gradient=0 and the answer:&lt;br&gt;
&amp;nbsp;&quot;Optimization terminated: first-order optimality measure less&lt;br&gt;
&amp;nbsp;than options.TolFun and maximum constraint violation is less&lt;br&gt;
&amp;nbsp;than options.TolCon.&lt;br&gt;
No active inequalities.&quot;&lt;br&gt;
&lt;br&gt;
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.&lt;br&gt;
&lt;br&gt;
For example the optimum solution is [34.04	  9.86	23.98	29.11	43.46	54.88	50.8	30.31]&lt;br&gt;
&lt;br&gt;
By varying the first variable in the range 34.01-34.05 the objective function supply&lt;br&gt;
[0.230	 0.1816 	0.141	0.1287 	0.1529]&lt;br&gt;
that is the objective function is not highly extremal&lt;br&gt;
&lt;br&gt;
What can be wrong in the objective function?&lt;br&gt;
&lt;br&gt;
Thanks for your help in advance</description>
    </item>
    <item>
      <pubDate>Fri, 21 Nov 2008 21:11:32 -0500</pubDate>
      <title>Re: correct objective function for fmincon</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/239628#612487</link>
      <author>Marcelo Marazzi</author>
      <description>If you're not providing the gradients, fmincon will estimate them &lt;br&gt;
internally via finite differences. You mention that the solver&lt;br&gt;
returns with a zero gradient. There is a chance that the function&lt;br&gt;
is flat around the initial point and therefore has zero gradient.&lt;br&gt;
Assuming the constraints are satisfied, then it's a stationary&lt;br&gt;
point and the solver may very well return that point (which is&lt;br&gt;
a local solution as far as fmincon is concerned).&lt;br&gt;
&lt;br&gt;
You might want to test the value of the gradient yourself (via finite &lt;br&gt;
differences) at the initial point and check it's value. If the function &lt;br&gt;
is noisy, you may need to choose and appropriate stepsize.&lt;br&gt;
&lt;br&gt;
-Marcelo&lt;br&gt;
&lt;br&gt;
Dmytro Vasylenko wrote:&lt;br&gt;
&amp;gt; After the first iteration in fmincon I receive a gradient=0 and the answer:&lt;br&gt;
&amp;gt;  &quot;Optimization terminated: first-order optimality measure less&lt;br&gt;
&amp;gt;  than options.TolFun and maximum constraint violation is less&lt;br&gt;
&amp;gt;  than options.TolCon.&lt;br&gt;
&amp;gt; No active inequalities.&quot;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 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.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; For example the optimum solution is [34.04	  9.86	23.98	29.11	43.46	54.88	50.8	30.31]&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; By varying the first variable in the range 34.01-34.05 the objective function supply&lt;br&gt;
&amp;gt; [0.230	 0.1816 	0.141	0.1287 	0.1529]&lt;br&gt;
&amp;gt; that is the objective function is not highly extremal&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; What can be wrong in the objective function?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks for your help in advance&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; </description>
    </item>
    <item>
      <pubDate>Fri, 21 Nov 2008 21:21:02 -0500</pubDate>
      <title>Re: correct objective function for fmincon</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/239628#612489</link>
      <author>loic paccard</author>
      <description>&quot;Dmytro Vasylenko&quot; &amp;lt;dmytre@mathworks.com&amp;gt; wrote in message &amp;lt;gg4mbo$rpr$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; After the first iteration in fmincon I receive a gradient=0 and the answer:&lt;br&gt;
&amp;gt;  &quot;Optimization terminated: first-order optimality measure less&lt;br&gt;
&amp;gt;  than options.TolFun and maximum constraint violation is less&lt;br&gt;
&amp;gt;  than options.TolCon.&lt;br&gt;
&amp;gt; No active inequalities.&quot;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 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.&lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Hi Dmytro,&lt;br&gt;
&lt;br&gt;
I am pretty interesting in how you 'feeds&quot; results to the optimizer.&lt;br&gt;
I do not know how to use fmincon with discrete values because I have no model and analytical expression inm ycase.&lt;br&gt;
Are you in the same situation?&lt;br&gt;
Could you explain ,me how you deal with fmincon without using an analytical expression?&lt;br&gt;
&lt;br&gt;
Loic</description>
    </item>
    <item>
      <pubDate>Sat, 22 Nov 2008 22:47:02 -0500</pubDate>
      <title>Re: correct objective function for fmincon</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/239628#612627</link>
      <author>Dmytro Vasylenko</author>
      <description>Thanks a lot&lt;br&gt;
&lt;br&gt;
I've missed the option &quot;DiffMinChange&quot; of the fmincon. By adjusting this option I've fixed my problem&lt;br&gt;
-&lt;br&gt;
Dmytro &lt;br&gt;
Marcelo Marazzi &amp;lt;mREMOVEmaALLraCAPITALSzzi@mathworks.com&amp;gt; wrote in message &amp;lt;gg7864$l68$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; If you're not providing the gradients, fmincon will estimate them &lt;br&gt;
&amp;gt; internally via finite differences. You mention that the solver&lt;br&gt;
&amp;gt; returns with a zero gradient. There is a chance that the function&lt;br&gt;
&amp;gt; is flat around the initial point and therefore has zero gradient.&lt;br&gt;
&amp;gt; Assuming the constraints are satisfied, then it's a stationary&lt;br&gt;
&amp;gt; point and the solver may very well return that point (which is&lt;br&gt;
&amp;gt; a local solution as far as fmincon is concerned).&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; You might want to test the value of the gradient yourself (via finite &lt;br&gt;
&amp;gt; differences) at the initial point and check it's value. If the function &lt;br&gt;
&amp;gt; is noisy, you may need to choose and appropriate stepsize.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; -Marcelo&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Dmytro Vasylenko wrote:&lt;br&gt;
&amp;gt; &amp;gt; After the first iteration in fmincon I receive a gradient=0 and the answer:&lt;br&gt;
&amp;gt; &amp;gt;  &quot;Optimization terminated: first-order optimality measure less&lt;br&gt;
&amp;gt; &amp;gt;  than options.TolFun and maximum constraint violation is less&lt;br&gt;
&amp;gt; &amp;gt;  than options.TolCon.&lt;br&gt;
&amp;gt; &amp;gt; No active inequalities.&quot;&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; 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.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; For example the optimum solution is [34.04	  9.86	23.98	29.11	43.46	54.88	50.8	30.31]&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; By varying the first variable in the range 34.01-34.05 the objective function supply&lt;br&gt;
&amp;gt; &amp;gt; [0.230	 0.1816 	0.141	0.1287 	0.1529]&lt;br&gt;
&amp;gt; &amp;gt; that is the objective function is not highly extremal&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; What can be wrong in the objective function?&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Thanks for your help in advance&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; </description>
    </item>
    <item>
      <pubDate>Sat, 22 Nov 2008 23:00:21 -0500</pubDate>
      <title>Re: correct objective function for fmincon</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/239628#612629</link>
      <author>Dmytro Vasylenko</author>
      <description>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.&lt;br&gt;
&lt;br&gt;
I have changed the option &quot;DiffMinChange&quot; of the fmincon and I am able to work with my objective function now.&lt;br&gt;
-&lt;br&gt;
Dmytro&lt;br&gt;
&lt;br&gt;
&quot;loic paccard&quot; &amp;lt;loic.paccard@ecam.fr&amp;gt; wrote in message &amp;lt;gg78nu$k0$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Dmytro Vasylenko&quot; &amp;lt;dmytre@mathworks.com&amp;gt; wrote in message &amp;lt;gg4mbo$rpr$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; After the first iteration in fmincon I receive a gradient=0 and the answer:&lt;br&gt;
&amp;gt; &amp;gt;  &quot;Optimization terminated: first-order optimality measure less&lt;br&gt;
&amp;gt; &amp;gt;  than options.TolFun and maximum constraint violation is less&lt;br&gt;
&amp;gt; &amp;gt;  than options.TolCon.&lt;br&gt;
&amp;gt; &amp;gt; No active inequalities.&quot;&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; 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.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Hi Dmytro,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I am pretty interesting in how you 'feeds&quot; results to the optimizer.&lt;br&gt;
&amp;gt; I do not know how to use fmincon with discrete values because I have no model and analytical expression inm ycase.&lt;br&gt;
&amp;gt; Are you in the same situation?&lt;br&gt;
&amp;gt; Could you explain ,me how you deal with fmincon without using an analytical expression?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Loic</description>
    </item>
  </channel>
</rss>

