<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Fix code to calculate minimizer value in non linear optimization problem in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/Fix-code-to-calculate-minimizer-value-in-non-linear-optimization/m-p/595855#M2895</link>
    <description>&lt;P&gt;You still need to correct the first error by adding a FIX statement.&lt;/P&gt;</description>
    <pubDate>Fri, 11 Oct 2019 19:37:32 GMT</pubDate>
    <dc:creator>RobPratt</dc:creator>
    <dc:date>2019-10-11T19:37:32Z</dc:date>
    <item>
      <title>Fix code to calculate minimizer value in non linear optimization problem</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Fix-code-to-calculate-minimizer-value-in-non-linear-optimization/m-p/595847#M2892</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;I am trying to solve the following problem&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/33086iA70371BD170ACF82/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The initial point is =(0 0 0)&lt;/P&gt;&lt;P&gt;My code is the following&lt;/P&gt;&lt;PRE&gt;proc optmodel;
var x{1..3};
min f = x[1]^2  + 2*x[2]^2 + 5*x[3]^2 - 4*x[1] - 20*x[2] - 20*x[3] ;

/* starting point */
   x[1]= 0;
   x[2]= 0;
   x[3]=0;
solve; 
print x x.dual;
quit;&lt;/PRE&gt;&lt;P&gt;This code works fine&lt;/P&gt;&lt;P&gt;Now if P is the descent direction of f at Xo then&lt;/P&gt;&lt;P&gt;I need to find the minimizer Aplha for this problem&lt;/P&gt;&lt;P&gt;I mean to say that I am trying to solve this question:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 384px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/33087i36974F4303CD95BB/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried the following code to calculate Alpha&lt;/P&gt;&lt;PRE&gt;proc optmodel;
   num n = 3;
   var x {1..n};
   min f = x[1]^2  + 2*x[2]^2 + 5*x[3]^2 - 4*x[1] - 20*x[2] - 20*x[3] ;
   
/* starting point */
   x[1]= 0;
   x[2]= 0;
   x[3]=0;
   solve; 
   print x x.dual;

   num p {1..n};
   for {j in 1..n} p[j] = -x[j].dual;
   var alpha &amp;gt;= 0;
   min g  = (x[1]+alpha*p[1])^2 + 2*(x[2]+alpha*p[1])^2 + 5*(x[3]+alpha*p[1])^2-4*(x[1]+alpha*p[1]) -20*(x[2]+alpha*p[1]) -20*(x[3]+alpha*p[1])
   solve;
   print alpha;
quit;&lt;/PRE&gt;&lt;P&gt;But this code is giving me wrong value of alpha...its showing alpha=0&lt;/P&gt;&lt;P&gt;Please help me to fix this code&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2019 18:59:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Fix-code-to-calculate-minimizer-value-in-non-linear-optimization/m-p/595847#M2892</guid>
      <dc:creator>rohailk</dc:creator>
      <dc:date>2019-10-11T18:59:02Z</dc:date>
    </item>
    <item>
      <title>Re: Fix code to calculate minimizer value in non linear optimization problem</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Fix-code-to-calculate-minimizer-value-in-non-linear-optimization/m-p/595850#M2893</link>
      <description>&lt;P&gt;There are three errors:&lt;/P&gt;
&lt;P&gt;1. You need to FIX x for the first solve, as in the previous examples.&lt;/P&gt;
&lt;P&gt;2. You need a semicolon at the end of the declaration of g.&lt;/P&gt;
&lt;P&gt;3. Some of the appearances of p[1] in g should instead be p[2] or p[3].&lt;/P&gt;
&lt;P&gt;The corrected statement is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;min g = (x[1]+alpha*p[1])^2 + 2*(x[2]+alpha*p[2])^2 + 5*(x[3]+alpha*p[3])^2-4*(x[1]+alpha*p[1]) -20*(x[2]+alpha*p[2]) -20*(x[3]+alpha*p[3]);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Oct 2019 19:12:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Fix-code-to-calculate-minimizer-value-in-non-linear-optimization/m-p/595850#M2893</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2019-10-11T19:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: Fix code to calculate minimizer value in non linear optimization problem</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Fix-code-to-calculate-minimizer-value-in-non-linear-optimization/m-p/595854#M2894</link>
      <description>&lt;P&gt;Thanks for the quick response.&lt;/P&gt;&lt;P&gt;I fixed the code now like this:&lt;/P&gt;&lt;PRE&gt;proc optmodel;
   num n = 3;
   var x {1..n};
   min f = x[1]^2  + 2*x[2]^2 + 5*x[3]^2 - 4*x[1] - 20*x[2] - 20*x[3] ;
   
/* starting point */
   x[1]= 0;
   x[2]= 0;
   x[3]=0;
   solve; 
   print x x.dual;

   num p {1..n};
   for {j in 1..n} p[j] = -x[j].dual;
   var alpha &amp;gt;= 0;
   min g = (x[1]+alpha*p[1])^2 + 2*(x[2]+alpha*p[2])^2 + 5*(x[3]+alpha*p[3])^2-4*(x[1]+alpha*p[1]) -20*(x[2]+alpha*p[2]) -20*(x[3]+alpha*p[3]);

   solve;
   print alpha;
quit;&lt;/PRE&gt;&lt;P&gt;but when I run it. I get the value of alpha=0. Is it ok or need some adjustment in the code please?&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2019 19:35:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Fix-code-to-calculate-minimizer-value-in-non-linear-optimization/m-p/595854#M2894</guid>
      <dc:creator>rohailk</dc:creator>
      <dc:date>2019-10-11T19:35:02Z</dc:date>
    </item>
    <item>
      <title>Re: Fix code to calculate minimizer value in non linear optimization problem</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Fix-code-to-calculate-minimizer-value-in-non-linear-optimization/m-p/595855#M2895</link>
      <description>&lt;P&gt;You still need to correct the first error by adding a FIX statement.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2019 19:37:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Fix-code-to-calculate-minimizer-value-in-non-linear-optimization/m-p/595855#M2895</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2019-10-11T19:37:32Z</dc:date>
    </item>
    <item>
      <title>Re: Fix code to calculate minimizer value in non linear optimization problem</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Fix-code-to-calculate-minimizer-value-in-non-linear-optimization/m-p/595857#M2896</link>
      <description>&lt;P&gt;thank you so much..i fixed it like this&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc optmodel;
   num n = 3;
   var x {1..n};
   min f = x[1]^2  + 2*x[2]^2 + 5*x[3]^2 - 4*x[1] - 20*x[2] - 20*x[3] ;
   
/* starting point */
   fix x[1] = 0;
   fix x[2] = 0;
   fix x[3] = 0;

   solve; 
   print x x.dual;

   num p {1..n};
   for {j in 1..n} p[j] = -x[j].dual;
   var alpha &amp;gt;= 0;
   min g = (x[1]+alpha*p[1])^2 + 2*(x[2]+alpha*p[2])^2 + 5*(x[3]+alpha*p[3])^2-4*(x[1]+alpha*p[1]) -20*(x[2]+alpha*p[2]) -20*(x[3]+alpha*p[3]);

   solve;
   print alpha;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Oct 2019 19:41:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Fix-code-to-calculate-minimizer-value-in-non-linear-optimization/m-p/595857#M2896</guid>
      <dc:creator>rohailk</dc:creator>
      <dc:date>2019-10-11T19:41:36Z</dc:date>
    </item>
  </channel>
</rss>

