<?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: proc OPTMODEL taking too long in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/proc-OPTMODEL-taking-too-long/m-p/198527#M1009</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you please attach the ret data set?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that &amp;lt;&amp;gt; is the MAX operator, so your IMPVAR declaration is not doing what you want.&amp;nbsp; Instead, use ne or ~= or ^= for not equals.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I suspect that replacing the IMPVAR with explicit variables and constraints will reduce the solve time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 03 Jun 2015 13:43:50 GMT</pubDate>
    <dc:creator>RobPratt</dc:creator>
    <dc:date>2015-06-03T13:43:50Z</dc:date>
    <item>
      <title>proc OPTMODEL taking too long</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/proc-OPTMODEL-taking-too-long/m-p/198526#M1008</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to do an optimization and it's taking too long (around 150 mins), on the other hand implementation in R takes only 10 mins approx. Here is the SAS code; I guess there might be an efficient way of implementing it.&lt;/P&gt;&lt;P&gt;SAS Code:&lt;/P&gt;&lt;P&gt;*************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc optmodel;&lt;/P&gt;&lt;P&gt;num n = &amp;amp;n; number ysq = &amp;amp;mysq; number y{1..n};&lt;/P&gt;&lt;P&gt;read data ret into [_n_] y;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var omega init 3.442868e-07, alpha init -4.391689, beta init 9.766483e-01, theta init -3.954835e-03, &lt;/P&gt;&lt;P&gt;delta init 5.340570e-03, lambda0 init 2.626132e-02, rho init 9.763934e-01, gamma init 9.025426e-01,&lt;/P&gt;&lt;P&gt;alphaj init -6.635340e-04, alphan init -9.694536e+00, alphanj init&amp;nbsp; -1.194563e-01, mu init 2.360808e-04, v init 8.541275;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;impvar pars {i in 1..n, j in 1..27} =&lt;/P&gt;&lt;P&gt;(if (i =1 and j = 1) then lambda0 / (1-rho)&lt;/P&gt;&lt;P&gt;else if (i =1 and j = 2) then 0&lt;/P&gt;&lt;P&gt;else if (i =1 and j = 3) then ysq&lt;/P&gt;&lt;P&gt;else if (i=1 and 4 &amp;lt;= j &amp;lt;= 24) then (gamma(0.5*(v+1))) * (1/(gamma(0.5*v)*sqrt(3.141592653*v*(pars[i,3]+(j-4)*(delta)**2)))) * (1 + ((y&lt;I&gt;-(mu-theta*(pars[i,1]-(j-4))))**2)/(v*(pars[i,3]+(j-4)*(delta)**2)))**(-0.5*(v+1))&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else if (i=1 and j = 25) then sum{k in 1..21}(pars[i,(k+3)]* pars[i,1]**(k-1) * exp(-pars[i,1])/fact((k-1)) )&lt;/P&gt;&lt;P&gt;else if (i=1 and j = 26) then sum{k in 1..21}((k-1)*pars[i,(k+3)]* pars[i,1]**(k-1) * exp(-pars[i,1])/fact((k-1)) )&lt;/P&gt;&lt;P&gt;else if (i=1 and j = 27) then pars[i,26]/pars[i,25]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else if (i &amp;lt;&amp;gt; 1 and j = 1) then lambda0 + rho*pars[(i-1),1] + gamma * pars[(i-1),27]&lt;/P&gt;&lt;P&gt;else if (i &amp;lt;&amp;gt; 1 and j = 2 and (y[(i-1)]-mu &amp;lt; 0 )) then exp(alpha + (alphaj + alphanj)*pars[(i-1),26] + alphan) &lt;/P&gt;&lt;P&gt;else if (i &amp;lt;&amp;gt; 1 and j = 2 and (y[(i-1)]-mu &amp;gt;= 0 )) then exp(alpha + alphaj*pars[(i-1),26])&lt;/P&gt;&lt;P&gt;else if (i &amp;lt;&amp;gt; 1 and j = 3) then omega + pars[i,2]*(y[(i-1)]-mu)**2 + beta*pars[(i-1),3]&lt;/P&gt;&lt;P&gt;else if (i &amp;lt;&amp;gt; 1 and 4 &amp;lt;= j &amp;lt;= 24) then (gamma(0.5*(v+1))) * (1/(gamma(0.5*v)*sqrt(3.141592653*v*(pars[i,3]+(j-4)*(delta)**2)))) * (1 + ((y&lt;I&gt;-(mu-theta*(pars[i,1]-(j-4))))**2)/(v*(pars[i,3]+(j-4)*(delta)**2)))**(-0.5*(v+1))&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else if (i &amp;lt;&amp;gt; 1 and j = 25) then sum{k in 1..21}(pars[i,(k+3)]* pars[i,1]**(k-1) * exp(-pars[i,1])/fact((k-1)) )&lt;/P&gt;&lt;P&gt;else if (i &amp;lt;&amp;gt; 1 and j = 26) then sum{k in 1..21}((k-1)*pars[i,(k+3)]* pars[i,1]**(k-1) * exp(-pars[i,1])/fact((k-1)) )&lt;/P&gt;&lt;P&gt;else if (i &amp;lt;&amp;gt; 1 and j = 27) then pars[i,26]/pars[i,25] - pars[i,1] );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;max z = sum{k in 1..n}(log(pars[k,25]));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;omega.lb = 1e-12; alpha.lb = -100; beta.lb = -100; theta.lb=-100; delta.lb=1e-06; lambda0.lb=1e-06; rho.lb=0;&lt;/P&gt;&lt;P&gt;gamma.lb=0; alphaj.lb = -100; alphan.lb = -100; alphanj.lb = -100; mu.lb = -1; v.lb = 3+1e-06;&lt;/P&gt;&lt;P&gt;omega.ub = 1-1e-06; alpha.ub = 100; beta.ub = 100; theta.ub=100; delta.ub=100; lambda0.ub=30; rho.ub=1-1e-06;&lt;/P&gt;&lt;P&gt;gamma.ub=1-1e-06; alphaj.ub = 100; alphan.ub = 100; alphanj.ub = 100; mu.ub = 1; v.ub = 1800;&lt;/P&gt;&lt;P&gt;con c: rho &amp;gt;= gamma;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;solve with NLP / tech=IP ; print omega; print alpha; print beta; print mu; print v; print lambda0; print rho; &lt;/P&gt;&lt;P&gt;print gamma; print alphan; print alphaj; print alphanj; print theta; print delta; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Jun 2015 04:06:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/proc-OPTMODEL-taking-too-long/m-p/198526#M1008</guid>
      <dc:creator>sasuser2417</dc:creator>
      <dc:date>2015-06-03T04:06:00Z</dc:date>
    </item>
    <item>
      <title>Re: proc OPTMODEL taking too long</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/proc-OPTMODEL-taking-too-long/m-p/198527#M1009</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you please attach the ret data set?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that &amp;lt;&amp;gt; is the MAX operator, so your IMPVAR declaration is not doing what you want.&amp;nbsp; Instead, use ne or ~= or ^= for not equals.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I suspect that replacing the IMPVAR with explicit variables and constraints will reduce the solve time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Jun 2015 13:43:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/proc-OPTMODEL-taking-too-long/m-p/198527#M1009</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2015-06-03T13:43:50Z</dc:date>
    </item>
  </channel>
</rss>

