<?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 quadratic programming problem with equality and inequality constraints in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/quadratic-programming-problem-with-equality-and-inequality/m-p/594880#M2887</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: 596px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/33018i148C5432189D9A5A/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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and I have written the following code:&lt;/P&gt;&lt;PRE&gt;proc optmodel;
var x{1..3};
minimize f = x[1] - 2*x[2] + 4*x[3] + x[1]**2 + 2*x[2]**2 + 3*x[3]**2 + x[1]*x[2];

con r1: 3*x[1] + 4*x[2] -2*x[3] &amp;lt;= 10;
con r2: -3*x[1] + 2*x[2] + x[3] &amp;gt;= 2;
con r3: 2*x[1] + 3*x[2] + 4*x[3] =5;
con r4: x[1] &amp;lt;=5;&lt;BR /&gt;con r5: x[2] &amp;lt;=5;&lt;BR /&gt;con r6: x[3] &amp;lt;=5;&lt;BR /&gt;con r7: x[1] &amp;gt;=0;&lt;BR /&gt;con r8: x[2] &amp;gt;=0;&lt;BR /&gt;con r9: x[3] &amp;gt;=0;
solve with qp;
print x;
save qps qpsdata;
quit;&lt;/PRE&gt;&lt;P&gt;Please tell me if I am doing it right.Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 08 Oct 2019 19:35:57 GMT</pubDate>
    <dc:creator>rohailk</dc:creator>
    <dc:date>2019-10-08T19:35:57Z</dc:date>
    <item>
      <title>quadratic programming problem with equality and inequality constraints</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/quadratic-programming-problem-with-equality-and-inequality/m-p/594880#M2887</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: 596px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/33018i148C5432189D9A5A/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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and I have written the following code:&lt;/P&gt;&lt;PRE&gt;proc optmodel;
var x{1..3};
minimize f = x[1] - 2*x[2] + 4*x[3] + x[1]**2 + 2*x[2]**2 + 3*x[3]**2 + x[1]*x[2];

con r1: 3*x[1] + 4*x[2] -2*x[3] &amp;lt;= 10;
con r2: -3*x[1] + 2*x[2] + x[3] &amp;gt;= 2;
con r3: 2*x[1] + 3*x[2] + 4*x[3] =5;
con r4: x[1] &amp;lt;=5;&lt;BR /&gt;con r5: x[2] &amp;lt;=5;&lt;BR /&gt;con r6: x[3] &amp;lt;=5;&lt;BR /&gt;con r7: x[1] &amp;gt;=0;&lt;BR /&gt;con r8: x[2] &amp;gt;=0;&lt;BR /&gt;con r9: x[3] &amp;gt;=0;
solve with qp;
print x;
save qps qpsdata;
quit;&lt;/PRE&gt;&lt;P&gt;Please tell me if I am doing it right.Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2019 19:35:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/quadratic-programming-problem-with-equality-and-inequality/m-p/594880#M2887</guid>
      <dc:creator>rohailk</dc:creator>
      <dc:date>2019-10-08T19:35:57Z</dc:date>
    </item>
    <item>
      <title>Re: quadratic programming problem with equality and inequality constraints</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/quadratic-programming-problem-with-equality-and-inequality/m-p/594892#M2888</link>
      <description>&lt;P&gt;Your code looks correct to me, but you can do it a little more simply by omitting the SAVE QPS statement and the WITH QP clause and by including the bounds in the VAR statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc optmodel;
   var x{1..3} &amp;gt;= 0 &amp;lt;= 5;
   minimize f = x[1] - 2*x[2] + 4*x[3] + x[1]**2 + 2*x[2]**2 + 3*x[3]**2 + x[1]*x[2];

   con r1: 3*x[1] + 4*x[2] -2*x[3] &amp;lt;= 10;
   con r2: -3*x[1] + 2*x[2] + x[3] &amp;gt;= 2;
   con r3: 2*x[1] + 3*x[2] + 4*x[3] =5;
   solve;
   print x;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;By using the EXPAND / SOLVE statement, you can see that both versions pass the same formulation to the solver.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2019 20:21:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/quadratic-programming-problem-with-equality-and-inequality/m-p/594892#M2888</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2019-10-08T20:21:14Z</dc:date>
    </item>
  </channel>
</rss>

