<?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: Need help with Proc Optmodel in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/Need-help-with-Proc-Optmodel/m-p/574379#M2829</link>
    <description>&lt;P&gt;The numeric parameters out, in, rf, and rm all require two arguments.&amp;nbsp; I suspect that you want the following:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   Min Npv = 
      sum {p in Property} (
         sum {k in 1..2} (
            (out[p,k]-in[p,k])/(prod {j in 1..k} (1+rf[p,j]+rm[p,j]*b+a))
         )
      )
   ;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also note that you can get by with one READ DATA statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Read Data Tst3 Into Property=[Prop]
   {o in ouf}&amp;lt;Out[Prop,o]=col("o"||o)&amp;gt;
   {i in inf}&amp;lt;In [Prop,i]=col("i"||i)&amp;gt;
   {f in inf}&amp;lt;Rf [Prop,f]=col("f"||f)&amp;gt;
   {m in inf}&amp;lt;Rm [Prop,m]=col("m"||m)&amp;gt;;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 17 Jul 2019 22:04:21 GMT</pubDate>
    <dc:creator>RobPratt</dc:creator>
    <dc:date>2019-07-17T22:04:21Z</dc:date>
    <item>
      <title>Need help with Proc Optmodel</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Need-help-with-Proc-Optmodel/m-p/574335#M2828</link>
      <description>&lt;P&gt;Hi, this is my first time using the proc optmodel function and I am wondering if anyone could kindly help me with it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to solve for a and b that minimize Npv = (&lt;FONT color="#0000FF"&gt;o1&lt;/FONT&gt;-&lt;FONT color="#FF0000"&gt;i1&lt;/FONT&gt;)/(1+&lt;FONT color="#339966"&gt;f1&lt;/FONT&gt;+&lt;FONT color="#993300"&gt;m1&lt;/FONT&gt;*b+a) +&amp;nbsp;(&lt;FONT color="#0000FF"&gt;o2&lt;/FONT&gt;-i2)/((1+&lt;FONT color="#339966"&gt;f1&lt;/FONT&gt;+&lt;FONT color="#993300"&gt;m1&lt;/FONT&gt;*b+a)*(1+&lt;FONT color="#339966"&gt;f2&lt;/FONT&gt;+&lt;FONT color="#993300"&gt;m2&lt;/FONT&gt;*b+a)).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;o1&lt;/FONT&gt; and &lt;FONT color="#0000FF"&gt;o2&lt;/FONT&gt; are the first two columns of &lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;out&lt;/FONT&gt;&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;i1&lt;/FONT&gt; and&lt;FONT color="#FF0000"&gt; i2&lt;/FONT&gt; are the first two columns of &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;in&lt;/FONT&gt;&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;FONT color="#339966"&gt;f1&lt;/FONT&gt; and &lt;FONT color="#339966"&gt;f2&lt;/FONT&gt; are the first two columns of &lt;FONT color="#339966"&gt;&lt;STRONG&gt;rf.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#993300"&gt;m1&lt;/FONT&gt; and &lt;FONT color="#993300"&gt;m2&lt;/FONT&gt; are the first two columns of &lt;STRONG&gt;&lt;FONT color="#993300"&gt;rm&lt;/FONT&gt;&lt;/STRONG&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;&lt;P&gt;Below is my code so far and I have no idea about the correct code for the minimization problem.&amp;nbsp;&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 Optmodel;
	Set&amp;lt;String&amp;gt; Property;
	Set Ouf = 1..5;
	Set Inf = 1..5;
	Set Rfr = 1..5;
	Set Mkt = 1..5;
	Number out {Property,ouf}; 
	Number in  {Property,inf};
	Number rf  {Property,rfr};
	Number rm  {Property,mkt};
 
	Read Data Tst3 Into Property=[Prop] {o in ouf}&amp;lt;Out[Prop,o]=col("o"||o)&amp;gt;;
	Read Data Tst3 Into Property=[Prop] {i in inf}&amp;lt;In [Prop,i]=col("i"||i)&amp;gt;;
	Read Data Tst3 Into Property=[Prop] {f in inf}&amp;lt;Rf [Prop,f]=col("f"||f)&amp;gt;;
	Read Data Tst3 Into Property=[Prop] {m in inf}&amp;lt;Rm [Prop,m]=col("m"||m)&amp;gt;;

	Var a,b;
Quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried the code below but that's apparently wrong. I would really appreciate your help.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; Min Npv = (Out[o]-In[i])/(1+rf[f]+rm[m]*b+a);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jul 2019 19:20:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Need-help-with-Proc-Optmodel/m-p/574335#M2828</guid>
      <dc:creator>abigailpai</dc:creator>
      <dc:date>2019-07-17T19:20:56Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with Proc Optmodel</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Need-help-with-Proc-Optmodel/m-p/574379#M2829</link>
      <description>&lt;P&gt;The numeric parameters out, in, rf, and rm all require two arguments.&amp;nbsp; I suspect that you want the following:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   Min Npv = 
      sum {p in Property} (
         sum {k in 1..2} (
            (out[p,k]-in[p,k])/(prod {j in 1..k} (1+rf[p,j]+rm[p,j]*b+a))
         )
      )
   ;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also note that you can get by with one READ DATA statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Read Data Tst3 Into Property=[Prop]
   {o in ouf}&amp;lt;Out[Prop,o]=col("o"||o)&amp;gt;
   {i in inf}&amp;lt;In [Prop,i]=col("i"||i)&amp;gt;
   {f in inf}&amp;lt;Rf [Prop,f]=col("f"||f)&amp;gt;
   {m in inf}&amp;lt;Rm [Prop,m]=col("m"||m)&amp;gt;;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Jul 2019 22:04:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Need-help-with-Proc-Optmodel/m-p/574379#M2829</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2019-07-17T22:04:21Z</dc:date>
    </item>
  </channel>
</rss>

