<?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: Operations Research with IML, Example Quadratic Programming in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Operations-Research-with-IML-Example-Quadratic-Programming/m-p/332318#M3288</link>
    <description>Many thanks Rick for this excellent explication.&lt;BR /&gt;Your examples, posts and answers make me want to learn more and more IML.&lt;BR /&gt;It's fantastic and its usage seems unconstrained ☺</description>
    <pubDate>Mon, 13 Feb 2017 20:01:02 GMT</pubDate>
    <dc:creator>acordes</dc:creator>
    <dc:date>2017-02-13T20:01:02Z</dc:date>
    <item>
      <title>Operations Research with IML, Example Quadratic Programming</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Operations-Research-with-IML-Example-Quadratic-Programming/m-p/332282#M3286</link>
      <description>&lt;P&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt;In my autodidactic approach&amp;nbsp;towards&amp;nbsp;knowledge in SAS&amp;nbsp;IML&amp;nbsp;I read the interesting&amp;nbsp;article:&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt;Example 9.10 Quadratic Programming :: SAS/IML(R) 13.2 User's Guide&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt;This prompted me to apply this technique to a&amp;nbsp; different problem&amp;nbsp;exposed&amp;nbsp;in the recommendable book&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;"&lt;A href="https://www.amazon.com/Schaums-Outline-Operations-Research-Richard/dp/0070080208" target="_blank"&gt;Schaum's Outline of Operations Research&lt;/A&gt;".&lt;/P&gt;
&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt;In doing so I cash in on the following advantages:&amp;nbsp;to&lt;/FONT&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt; reassure myself of the correctness of the solution I get&amp;nbsp;by solving it with&amp;nbsp;IML and secondly&amp;nbsp;being guided&amp;nbsp;with te recipe to&amp;nbsp;state the problem and define the&amp;nbsp;objective function and the restrictions.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt;And it works! although I must confess that my higher mathematics university course lays far in the past and I don't succeed in understanding completely what's&amp;nbsp;the reasoning&amp;nbsp;with the eigenvalue...&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt;If someone wants to explain me that, I'm willing to put an effort in understanding it &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0cm 0cm 0pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt;And generally speaking about Operations Research in IML, can someone give me advice on how to define a Travelling Salesman Problem via IML (not OR)&amp;nbsp;which is &lt;U&gt;&lt;EM&gt;additionally subject&lt;/EM&gt;&lt;/U&gt; to some&amp;nbsp;restrictions? I&amp;nbsp;manage to formulate most of the restrictions but I&amp;nbsp;fail to force the&amp;nbsp;solution to being a round trip (once arriving at node B continue travelling from there ...).&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0cm 0cm 0pt;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt;Here comes the case description as an excerpt from the mentioned book. &lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt;&lt;IMG title="Capture+_2017-02-13-17-43-03.png" alt="Capture+_2017-02-13-17-43-03.png" src="https://communities.sas.com/t5/image/serverpage/image-id/7192iC6F517C7D54ADD81/image-size/original?v=1.0&amp;amp;px=-1" border="0" /&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt;&lt;IMG title="Capture+_2017-02-13-17-43-17.png" alt="Capture+_2017-02-13-17-43-17.png" src="https://communities.sas.com/t5/image/serverpage/image-id/7193i443863F8B24EBE00/image-size/original?v=1.0&amp;amp;px=-1" border="0" /&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt;&lt;IMG title="Capture+_2017-02-13-17-43-35.png" alt="Capture+_2017-02-13-17-43-35.png" src="https://communities.sas.com/t5/image/serverpage/image-id/7194i5D0817C11020D49F/image-size/original?v=1.0&amp;amp;px=-1" border="0" /&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;IMG title="Capture+_2017-02-13-17-43-52.png" alt="Capture+_2017-02-13-17-43-52.png" src="https://communities.sas.com/t5/image/serverpage/image-id/7199iA3E831046C307C29/image-size/original?v=1.0&amp;amp;px=-1" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG title="Capture+_2017-02-13-17-44-37.png" alt="Capture+_2017-02-13-17-44-37.png" src="https://communities.sas.com/t5/image/serverpage/image-id/7196i520386106AF66BAA/image-size/original?v=1.0&amp;amp;px=-1" border="0" /&gt;&lt;IMG title="Capture+_2017-02-13-17-54-52.png" alt="Capture+_2017-02-13-17-54-52.png" src="https://communities.sas.com/t5/image/serverpage/image-id/7197i4C9B9D52A0D13594/image-size/original?v=1.0&amp;amp;px=-1" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG title="Presentación1.png" alt="Presentación1.png" src="https://communities.sas.com/t5/image/serverpage/image-id/7200i1546E089AE745DEE/image-size/original?v=1.0&amp;amp;px=-1" border="0" /&gt;&lt;IMG title="Capture+_2017-02-13-17-55-27.png" alt="Capture+_2017-02-13-17-55-27.png" src="https://communities.sas.com/t5/image/serverpage/image-id/7198i598A6431EE378C61/image-size/original?v=1.0&amp;amp;px=-1" border="0" /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
start qp( names, c, H, G, rel, b, activity);
   if min(eigval(h))&amp;lt;0 then do;
      error={'The minimum eigenvalue of the H matrix is negative.',
             'Thus it is not positive semidefinite.',
             'QP is terminating.'};
      print error;
      stop;
   end;
   nr=nrow(G);
   nc=ncol(G);

   /* Put in canonical form */
   rev = (rel='&amp;lt;=');
   adj = (-1 * rev) + ^rev;
   g = adj# G;
   b = adj # b;
   eq = ( rel = '='  );
   if max(eq)=1 then do;
      g = g // -(diag(eq)*G)[loc(eq),];
      b = b // -(diag(eq)*b)[loc(eq)];
   end;
   m = (h || -g`) // (g || j(nrow(g),nrow(g),0));
   q = c // -b;

   /* Solve the problem */
   call lcp(rc,w,z,M,q);

   /* Report the solution */
   print ({'*************Solution is optimal***************',
           '*********No solution possible******************',
           ' ', ' ', ' ',
           '**********Solution is numerically unstable*****',
           '***********Not enough memory*******************',
           '**********Number of iterations exceeded********'}[rc+1]);
   activity = z[1:nc];
   objval = c`*activity + activity`*H*activity/2;
   print objval[L='Objective Value'],
         activity[r=names L= 'Decision Variables'];
finish qp;


c = { -7.6, -5, 1};
h = { 0.08 0 0 ,
		0 0.04 0,
		0 0 0};
g = {  0.2 0.2 0 ,
      0.8 0.3 0,
	  1 0 0,
	  0 1 0,
	0 0 1};

/* constraints: */
b = { 20 , 60, 30, 30, 673.5 };
rel = { '&amp;lt;=', '&amp;lt;=', '&amp;gt;', '&amp;gt;', '=' };
names = 'cheese1':'cheese3';
names [3]= 'dummy';
run qp(names, c, h, g, rel, b, activity);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2017 18:02:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Operations-Research-with-IML-Example-Quadratic-Programming/m-p/332282#M3286</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2017-02-13T18:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: Operations Research with IML, Example Quadratic Programming</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Operations-Research-with-IML-Example-Quadratic-Programming/m-p/332283#M3287</link>
      <description>&lt;P&gt;There is a class of matrices with nice properties that called &lt;A href="https://en.wikipedia.org/wiki/Positive-definite_matrix" target="_self"&gt;positive definite (PD) matrices&lt;/A&gt;. One of their defining properties is that all eigenvalues are positive.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In a QP problem,&amp;nbsp;if the H matrix is PD then the objective function is "bowl shaped." That means that there is a unique solution to the&amp;nbsp;unconstrained problem and a solution exists for a properly formed constrained&amp;nbsp;problem. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the H matrix is not PD, it might be that &lt;SPAN&gt;the graph of the objective function is an "upside down" bowl, which has no minimum. Or &lt;/SPAN&gt;&lt;SPAN&gt;the graph of the objective function might be a saddle-shaped surface,&amp;nbsp;which also has no minimum.&amp;nbsp;In either case, the program aborts the computation because&amp;nbsp;there is no global minimum, although there will be a local minimum if the constrained region is finite in extent.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2017 18:28:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Operations-Research-with-IML-Example-Quadratic-Programming/m-p/332283#M3287</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-02-13T18:28:02Z</dc:date>
    </item>
    <item>
      <title>Re: Operations Research with IML, Example Quadratic Programming</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Operations-Research-with-IML-Example-Quadratic-Programming/m-p/332318#M3288</link>
      <description>Many thanks Rick for this excellent explication.&lt;BR /&gt;Your examples, posts and answers make me want to learn more and more IML.&lt;BR /&gt;It's fantastic and its usage seems unconstrained ☺</description>
      <pubDate>Mon, 13 Feb 2017 20:01:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Operations-Research-with-IML-Example-Quadratic-Programming/m-p/332318#M3288</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2017-02-13T20:01:02Z</dc:date>
    </item>
    <item>
      <title>Re: Operations Research with IML, Example Quadratic Programming</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Operations-Research-with-IML-Example-Quadratic-Programming/m-p/332457#M3289</link>
      <description>&lt;PRE&gt;
"can someone give me advice on how to define a Travelling Salesman Problem via IML (not OR) "
Check Genetic Algorithm in IML documentation. There is already an example to solve it .
If you want use IML to solve OR problem, then you have to know GA. GA could be applied to any kind of OR problem and large scale OR problem,but it can't guarantee to get the solution.


&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Feb 2017 03:07:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Operations-Research-with-IML-Example-Quadratic-Programming/m-p/332457#M3289</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-02-14T03:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: Operations Research with IML, Example Quadratic Programming</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Operations-Research-with-IML-Example-Quadratic-Programming/m-p/349394#M3409</link>
      <description>&lt;P&gt;And for quadratic programs, you don't need to extend the system and use LP. You can use the NLPQUA subroutine to directly solve the quadratic program in a natural way. See &lt;A href="http://blogs.sas.com/content/iml/2017/04/12/quadratic-optimization-sas.html" target="_self"&gt;"Quadratic optimization in SAS."&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2017 12:04:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Operations-Research-with-IML-Example-Quadratic-Programming/m-p/349394#M3409</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-04-12T12:04:58Z</dc:date>
    </item>
  </channel>
</rss>

