<?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: Mathematical Programming in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/Mathematical-Programming/m-p/281896#M1402</link>
    <description>##- Please type your reply above this line. Simple formatting, no&lt;BR /&gt;attachments. -##&lt;BR /&gt;&lt;BR /&gt;I am using SAS on demand for academic s.</description>
    <pubDate>Sun, 03 Jul 2016 09:42:02 GMT</pubDate>
    <dc:creator>KafeelBasha</dc:creator>
    <dc:date>2016-07-03T09:42:02Z</dc:date>
    <item>
      <title>Mathematical Programming</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Mathematical-Programming/m-p/281633#M1393</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was trying to solve a linear programming problem with SAS and R but got different results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Linear Programming Problem with SAS&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;proc optmodel;&lt;BR /&gt;var x {1..3} &amp;gt;=0;&lt;BR /&gt;max z =11*x[1]+16*x[2]+15*x[3];&lt;BR /&gt;con c1: x[1]+2*x[2]+1.5*x[3] &amp;lt;=12000;&lt;BR /&gt;con c2: 0.66*x[1]+0.66*x[2]+x[3] &amp;lt;= 4600;&lt;BR /&gt;con c3: 0.5*x[1]+0.3333*x[2]+0.5*x[3] &amp;lt;=2400;&lt;BR /&gt;solve with lp;print x[1] x[2] x[3];&lt;BR /&gt;quit;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;SAS output: Objective Value=100311.708 x1=490.31 x2=5044.7 x3=946.93&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;With R&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&amp;gt; library(lpSolve)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;&amp;gt; obj=c(11,16,15)&lt;BR /&gt;&amp;gt; con=matrix(c(1,2,3/2,2/3,2/3,1,1/2,1/3,1/2),nrow=3,byrow=TRUE)&lt;BR /&gt;&amp;gt; dir=c("&amp;lt;=","&amp;lt;=","&amp;lt;=")&lt;BR /&gt;&amp;gt; rhs=c(12000,4600,2400)&lt;BR /&gt;&amp;gt; lp("max",obj,con,dir,rhs)&lt;BR /&gt;Success: the objective function is 100200 &lt;BR /&gt;&amp;gt; lp("max",obj,con,dir,rhs)$solution&lt;BR /&gt;[1] 600 5100 800&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Please help me with this.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 06:47:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Mathematical-Programming/m-p/281633#M1393</guid>
      <dc:creator>KafeelBasha</dc:creator>
      <dc:date>2016-07-01T06:47:24Z</dc:date>
    </item>
    <item>
      <title>Re: Mathematical Programming</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Mathematical-Programming/m-p/281648#M1394</link>
      <description>&lt;P&gt;R is right. Maybe you should use 1/3 to replace 0.333 , maybe that is reason.&lt;/P&gt;
&lt;P&gt;I runned it again by GA . I am astonishing that I can't use CALL LPSOLVE() . it said out of memory.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That is really weird.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
start func(x) global(coef,b);
if any(coef*x`&amp;gt;b) then v=0;
 else v=11#x[1]+16#x[2]+15#x[3];
 return (v);
finish;

coef = {3   6   4.5,  
        2   2   3,
        1.5 1   1.5}/3;
b = { 12000,4600,2400 };


id=gasetup(1,3,123456789);
call gasetobj(id,1,"func");
call gasetsel(id,100,1,0.95);
call gasetcro(id,0.05,4);
call gasetmut(id,0.05);

call gainit(id,10000,{0 0 0,10000 10000 10000});
niter = 10000;
do i = 1 to niter;
 call garegen(id);
 call gagetval(value, id);
end;
call gagetmem(mem, value, id, 1);
print mem[ l="best member:"],
      "Max Value: " value[l = ""] ;
call gaend(id);
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/3878iDB686B4983FB9B6D/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="x.png" title="x.png" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 08:03:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Mathematical-Programming/m-p/281648#M1394</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-07-01T08:03:02Z</dc:date>
    </item>
    <item>
      <title>Re: Mathematical Programming</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Mathematical-Programming/m-p/281680#M1395</link>
      <description>&lt;P&gt;I got the same answer by chaning 0.33 to 1/3.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 11:13:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Mathematical-Programming/m-p/281680#M1395</guid>
      <dc:creator>KafeelBasha</dc:creator>
      <dc:date>2016-07-01T11:13:02Z</dc:date>
    </item>
    <item>
      <title>Re: Mathematical Programming</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Mathematical-Programming/m-p/281732#M1396</link>
      <description>&lt;P&gt;And also change 0.66 to 2/3.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 14:22:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Mathematical-Programming/m-p/281732#M1396</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2016-07-01T14:22:53Z</dc:date>
    </item>
    <item>
      <title>Re: Mathematical Programming</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Mathematical-Programming/m-p/281734#M1397</link>
      <description>&lt;P&gt;Can you please post the IML code for which LPSOLVE yielded out of memory?&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 14:27:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Mathematical-Programming/m-p/281734#M1397</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2016-07-01T14:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: Mathematical Programming</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Mathematical-Programming/m-p/281825#M1398</link>
      <description>&lt;PRE&gt;
Here is right code :


proc optmodel;
var x {1..3} &amp;gt;=0;
max z =11*x[1]+16*x[2]+15*x[3];
con c1: x[1]+2*x[2]+1.5*x[3] &amp;lt;=12000;
con c2: 2/3*x[1]+2/3*x[2]+x[3] &amp;lt;= 4600;
con c3: 0.5*x[1]+1/3*x[2]+0.5*x[3] &amp;lt;=2400;
solve with lp;print x[1] x[2] x[3];
quit;





&lt;/PRE&gt;</description>
      <pubDate>Sat, 02 Jul 2016 03:16:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Mathematical-Programming/m-p/281825#M1398</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-07-02T03:16:50Z</dc:date>
    </item>
    <item>
      <title>Re: Mathematical Programming</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Mathematical-Programming/m-p/281827#M1399</link>
      <description>&lt;PRE&gt;
Rob,
Here is :


proc iml;

object = { 11 16 15 };
coef = {3   6   4.5,  
        2   2   3,
        1.5 1   1.5}/3;
b = { 12000,4600,2400 };

rowsense = {'L','L','L'};
cntl= {-1,1};
call lpsolve (rc,objv,x,dual,rd,object,coef,b,cntl,rowsense);
print objv, x, dual, rd,rc;

quit;




NOTICE: in output , RC=5 , which means lpsolve() can't get enough memory.



1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 51         
 52         proc iml;
 NOTE: IML Ready
 53         
 54         object = { 11 16 15 };
 55         coef = {3   6   4.5,
 56                 2   2   3,
 57                 1.5 1   1.5}/3;
 58         b = { 12000,4600,2400 };
 59         
 60         rowsense = {'L','L','L'};
 61         cntl= {-1,1};
 62         call lpsolve (rc,objv,x,dual,rd,object,coef,b,cntl,rowsense);
 ERROR: Out of memory.
 NOTE: Number of iterations = 0.
 NOTE: Time used (secs) = 0.00.
 63         print objv, x, dual, rd,rc;
 64         
 65         quit;
 NOTE: Exiting IML.
 NOTE: PROCEDURE IML used (Total process time):
       real time           0.34 seconds
       cpu time            0.08 seconds






&lt;/PRE&gt;</description>
      <pubDate>Sat, 02 Jul 2016 03:30:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Mathematical-Programming/m-p/281827#M1399</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-07-02T03:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: Mathematical Programming</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Mathematical-Programming/m-p/281841#M1400</link>
      <description>&lt;P&gt;Hmm, that is strange. &amp;nbsp;Here's what I get with SAS/IML 14.1 on my Windows laptop:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1 option fullstimer;&lt;BR /&gt;2&lt;BR /&gt;3 proc iml;&lt;BR /&gt;NOTE: Writing HTML Body file: sashtml.htm&lt;BR /&gt;NOTE: IML Ready&lt;BR /&gt;4&lt;BR /&gt;5 object = { 11 16 15 };&lt;BR /&gt;6 coef = {3 6 4.5,&lt;BR /&gt;7 2 2 3,&lt;BR /&gt;8 1.5 1 1.5}/3;&lt;BR /&gt;9 b = { 12000,4600,2400 };&lt;BR /&gt;10&lt;BR /&gt;11 rowsense = {'L','L','L'};&lt;BR /&gt;12 cntl= {-1,1};&lt;BR /&gt;13 call lpsolve (rc,objv,x,dual,rd,object,coef,b,cntl,rowsense);&lt;BR /&gt;NOTE: The LP solver is called.&lt;BR /&gt;NOTE: The Dual Simplex algorithm is used.&lt;BR /&gt;NOTE: Optimal.&lt;BR /&gt;NOTE: Objective value = -100200.&lt;BR /&gt;NOTE: Number of iterations = 5.&lt;BR /&gt;NOTE: Time used (secs) = 0.00.&lt;BR /&gt;14 print objv, x, dual, rd,rc;&lt;BR /&gt;15&lt;BR /&gt;16 quit;&lt;BR /&gt;NOTE: Exiting IML.&lt;BR /&gt;NOTE: PROCEDURE IML used (Total process time):&lt;BR /&gt; real time 0.73 seconds&lt;BR /&gt; user cpu time 0.39 seconds&lt;BR /&gt; system cpu time 0.21 seconds&lt;BR /&gt; memory 14412.64k&lt;BR /&gt; OS Memory 23248.00k&lt;BR /&gt; Timestamp 07/02/2016 09:37:55 AM&lt;BR /&gt; Step Count 1 Switch Count 0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What release are you running?&lt;/P&gt;</description>
      <pubDate>Sat, 02 Jul 2016 13:40:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Mathematical-Programming/m-p/281841#M1400</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2016-07-02T13:40:40Z</dc:date>
    </item>
    <item>
      <title>Re: Mathematical Programming</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Mathematical-Programming/m-p/281872#M1401</link>
      <description>I am using SAS University Edition.</description>
      <pubDate>Sun, 03 Jul 2016 02:31:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Mathematical-Programming/m-p/281872#M1401</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-07-03T02:31:20Z</dc:date>
    </item>
    <item>
      <title>Re: Mathematical Programming</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Mathematical-Programming/m-p/281896#M1402</link>
      <description>##- Please type your reply above this line. Simple formatting, no&lt;BR /&gt;attachments. -##&lt;BR /&gt;&lt;BR /&gt;I am using SAS on demand for academic s.</description>
      <pubDate>Sun, 03 Jul 2016 09:42:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Mathematical-Programming/m-p/281896#M1402</guid>
      <dc:creator>KafeelBasha</dc:creator>
      <dc:date>2016-07-03T09:42:02Z</dc:date>
    </item>
  </channel>
</rss>

