<?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 Looking for help converting some simple PROC NLP code to PROC OPTMODEL in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/Looking-for-help-converting-some-simple-PROC-NLP-code-to-PROC/m-p/902403#M4050</link>
    <description>&lt;P&gt;Hi All.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We have some old code that is now running into memory issues.&amp;nbsp; I need to move it to PROC OPTMODEL in SAS 9.4 for Windows&amp;nbsp; ... something I have wanted to do for ages.&amp;nbsp; &amp;nbsp;Now, I am thankfully being forced.&amp;nbsp; The code is pretty simple:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc nlp data=singlerow&lt;BR /&gt;tech=QUANEW update=DDFP lis=5 maxfu=5000 maxit=50000&lt;BR /&gt;out=solution noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;array s[&amp;amp;n] s1-s&amp;amp;n;&lt;BR /&gt;array r[&amp;amp;n] r1-r&amp;amp;n;&lt;BR /&gt;array c[&amp;amp;n] c1-c&amp;amp;n;&lt;BR /&gt;array x[&amp;amp;n] x1-x&amp;amp;n;&lt;BR /&gt;array y[&amp;amp;n] y1-y&amp;amp;n;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;max ty;&lt;/P&gt;&lt;P&gt;parms c1-c&amp;amp;n=1;&lt;BR /&gt;bounds 0.8&amp;lt;=c1-c&amp;amp;n&amp;lt;=1.2;&lt;BR /&gt;nlincon tx=10000;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;do i=1 to &amp;amp;n;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;x[i]=s[i]*c[i];&lt;BR /&gt;y[i]=x[i]*r[i];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ts=sum(of s1-s&amp;amp;n);&lt;BR /&gt;tx=sum(of x1-x&amp;amp;n);&lt;BR /&gt;ty=sum(of y1-y&amp;amp;n);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically, we are shift the allocation "s" spend for a number of different investments based on their "r" immediate rate of return.&amp;nbsp;&amp;nbsp;The input data "singlerow" is actually just one row of s1-s&amp;amp;n and r1-r&amp;amp;n.&amp;nbsp; The &amp;amp;n that is killing PROC NLP is currently 5000 different investments.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The goal is to get a "c"&amp;nbsp; change to each spend.&amp;nbsp; There is a change limit of +/-20% and the total "budget" must be $10,000.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anybody have a quick translation to PROC OPTMODEL that I can use to learn?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Will&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 09 Nov 2023 20:52:12 GMT</pubDate>
    <dc:creator>toddkirk</dc:creator>
    <dc:date>2023-11-09T20:52:12Z</dc:date>
    <item>
      <title>Looking for help converting some simple PROC NLP code to PROC OPTMODEL</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Looking-for-help-converting-some-simple-PROC-NLP-code-to-PROC/m-p/902403#M4050</link>
      <description>&lt;P&gt;Hi All.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We have some old code that is now running into memory issues.&amp;nbsp; I need to move it to PROC OPTMODEL in SAS 9.4 for Windows&amp;nbsp; ... something I have wanted to do for ages.&amp;nbsp; &amp;nbsp;Now, I am thankfully being forced.&amp;nbsp; The code is pretty simple:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc nlp data=singlerow&lt;BR /&gt;tech=QUANEW update=DDFP lis=5 maxfu=5000 maxit=50000&lt;BR /&gt;out=solution noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;array s[&amp;amp;n] s1-s&amp;amp;n;&lt;BR /&gt;array r[&amp;amp;n] r1-r&amp;amp;n;&lt;BR /&gt;array c[&amp;amp;n] c1-c&amp;amp;n;&lt;BR /&gt;array x[&amp;amp;n] x1-x&amp;amp;n;&lt;BR /&gt;array y[&amp;amp;n] y1-y&amp;amp;n;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;max ty;&lt;/P&gt;&lt;P&gt;parms c1-c&amp;amp;n=1;&lt;BR /&gt;bounds 0.8&amp;lt;=c1-c&amp;amp;n&amp;lt;=1.2;&lt;BR /&gt;nlincon tx=10000;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;do i=1 to &amp;amp;n;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;x[i]=s[i]*c[i];&lt;BR /&gt;y[i]=x[i]*r[i];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ts=sum(of s1-s&amp;amp;n);&lt;BR /&gt;tx=sum(of x1-x&amp;amp;n);&lt;BR /&gt;ty=sum(of y1-y&amp;amp;n);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically, we are shift the allocation "s" spend for a number of different investments based on their "r" immediate rate of return.&amp;nbsp;&amp;nbsp;The input data "singlerow" is actually just one row of s1-s&amp;amp;n and r1-r&amp;amp;n.&amp;nbsp; The &amp;amp;n that is killing PROC NLP is currently 5000 different investments.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The goal is to get a "c"&amp;nbsp; change to each spend.&amp;nbsp; There is a change limit of +/-20% and the total "budget" must be $10,000.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anybody have a quick translation to PROC OPTMODEL that I can use to learn?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Will&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2023 20:52:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Looking-for-help-converting-some-simple-PROC-NLP-code-to-PROC/m-p/902403#M4050</guid>
      <dc:creator>toddkirk</dc:creator>
      <dc:date>2023-11-09T20:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for help converting some simple PROC NLP code to PROC OPTMODEL</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Looking-for-help-converting-some-simple-PROC-NLP-code-to-PROC/m-p/902434#M4051</link>
      <description>&lt;P&gt;The following PROC OPTMODEL code should do what you want:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc optmodel;
   num s {1..&amp;amp;n};
   num r {1..&amp;amp;n};
   read data singlerow into
      {i in 1..&amp;amp;n} &amp;lt;s[i]=col('s'||i)&amp;gt;
      {i in 1..&amp;amp;n} &amp;lt;r[i]=col('r'||i)&amp;gt;
   ;

   var c {1..&amp;amp;n} init 1 &amp;gt;= 0.8 &amp;lt;= 1.2;
   impvar x {i in 1..&amp;amp;n} = s[i]*c[i];
   impvar y {i in 1..&amp;amp;n} = x[i]*r[i];

   max ty = sum {i in 1..&amp;amp;n} y[i];

   con Budget:
      sum {i in 1..&amp;amp;n} x[i] = 10000;

   solve;

   create data solution from [i] c;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You might also find the following links useful:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/documentation/cdl/en/ormplpug/64004/HTML/default/viewer.htm#ormplpug_nlp_sect054.htm" target="_blank"&gt;PROC NLP: Rewriting NLP Models for PROC OPTMODEL - 9.3 (sas.com)&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/kb/41/671.html" target="_blank"&gt;41671 - Migrating from PROC NLP to PROC OPTMODEL (sas.com)&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/resources/papers/proceedings10/242-2010.pdf" target="_blank"&gt;242-2010: Nonlinear Optimization in SAS/OR®: Migrating from PROC NLP to PROC OPTMODEL&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2023 03:21:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Looking-for-help-converting-some-simple-PROC-NLP-code-to-PROC/m-p/902434#M4051</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2023-11-10T03:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for help converting some simple PROC NLP code to PROC OPTMODEL</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Looking-for-help-converting-some-simple-PROC-NLP-code-to-PROC/m-p/902438#M4052</link>
      <description>&lt;P&gt;WONDERFUL!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much Rob.&amp;nbsp; This was perfect in two ways.&amp;nbsp; The first is that is absolutely works as expected.&amp;nbsp; The second that this is really easy for me to understand and think about how I update some of the other legacy PROC NLP code.&amp;nbsp; I really appreciate you sorting this out so fast.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Will&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2023 05:22:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Looking-for-help-converting-some-simple-PROC-NLP-code-to-PROC/m-p/902438#M4052</guid>
      <dc:creator>toddkirk</dc:creator>
      <dc:date>2023-11-10T05:22:48Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for help converting some simple PROC NLP code to PROC OPTMODEL</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Looking-for-help-converting-some-simple-PROC-NLP-code-to-PROC/m-p/902509#M4053</link>
      <description>&lt;P&gt;Glad to help.&amp;nbsp; Notice that the objective and constraint are both linear and the variables are continuous, so OPTMODEL will by default use the linear programming (LP) solver.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2023 14:28:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Looking-for-help-converting-some-simple-PROC-NLP-code-to-PROC/m-p/902509#M4053</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2023-11-10T14:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for help converting some simple PROC NLP code to PROC OPTMODEL</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Looking-for-help-converting-some-simple-PROC-NLP-code-to-PROC/m-p/902534#M4054</link>
      <description>&lt;P&gt;Great points!&amp;nbsp; Thanks Rob!&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2023 15:49:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Looking-for-help-converting-some-simple-PROC-NLP-code-to-PROC/m-p/902534#M4054</guid>
      <dc:creator>toddkirk</dc:creator>
      <dc:date>2023-11-10T15:49:51Z</dc:date>
    </item>
  </channel>
</rss>

