<?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: how can i read parameters value automatically? in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/how-can-i-read-parameters-value-automatically/m-p/416149#M2079</link>
    <description>&lt;P&gt;if it will be possible to read coeficientes that multiplies x too?&amp;nbsp;&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;</description>
    <pubDate>Sat, 25 Nov 2017 19:39:07 GMT</pubDate>
    <dc:creator>dali74</dc:creator>
    <dc:date>2017-11-25T19:39:07Z</dc:date>
    <item>
      <title>how can i read parameters value automatically?</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/how-can-i-read-parameters-value-automatically/m-p/416066#M2077</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this problem and its works ok, but it´s possible read paramerts in data statement?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc optmodel;
   var x {1..3};
   max z1 = (2*x[1]-3*x[2]+5*x[3])**3/(x[1]+5*x[2]+x[3]**2);
   con c1: -1&amp;lt;=x[1]&amp;lt;= 3;
   con c2: 1.5&amp;lt;=x[2]&amp;lt;= 2;
   con c3: 1.2&amp;lt;=x[3]&amp;lt;= 2.2;
   solve with nlp/multistart ;
   print x;
quit;



&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Edit: I want to put in data statement:&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;-1&amp;lt;=x[1]&amp;lt;= 3;...&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Nov 2017 18:34:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/how-can-i-read-parameters-value-automatically/m-p/416066#M2077</guid>
      <dc:creator>dali74</dc:creator>
      <dc:date>2017-11-24T18:34:11Z</dc:date>
    </item>
    <item>
      <title>Re: how can i read parameters value automatically?</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/how-can-i-read-parameters-value-automatically/m-p/416084#M2078</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data bounds;
   input lb ub;
   datalines;
-1   3
 1.5 2
 1.2 2.2
;

proc optmodel;
   var x {1..3};
   max z1 = (2*x[1]-3*x[2]+5*x[3])**3/(x[1]+5*x[2]+x[3]**2);
   read data bounds into [_N_] x.lb=lb x.ub=ub;
   solve with nlp/multistart ;
   print x;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Nov 2017 20:47:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/how-can-i-read-parameters-value-automatically/m-p/416084#M2078</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2017-11-24T20:47:14Z</dc:date>
    </item>
    <item>
      <title>Re: how can i read parameters value automatically?</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/how-can-i-read-parameters-value-automatically/m-p/416149#M2079</link>
      <description>&lt;P&gt;if it will be possible to read coeficientes that multiplies x too?&amp;nbsp;&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;</description>
      <pubDate>Sat, 25 Nov 2017 19:39:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/how-can-i-read-parameters-value-automatically/m-p/416149#M2079</guid>
      <dc:creator>dali74</dc:creator>
      <dc:date>2017-11-25T19:39:07Z</dc:date>
    </item>
    <item>
      <title>Re: how can i read parameters value automatically?</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/how-can-i-read-parameters-value-automatically/m-p/416209#M2080</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data bounds;
   input lb ub a b;
   datalines;
-1   3    2 1
 1.5 2   -3 5
 1.2 2.2  5 1
;

proc optmodel;
   var x {1..3};
   num a {1..3};
   num b {1..3};
   max z1 = (sum {j in 1..3} a[j]*x[j])**3/(b[1]*x[1]+b[2]*x[2]+b[3]*x[3]**2);
   read data bounds into [_N_] x.lb=lb x.ub=ub a b;
   solve with nlp/multistart ;
   print x;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 26 Nov 2017 20:02:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/how-can-i-read-parameters-value-automatically/m-p/416209#M2080</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2017-11-26T20:02:52Z</dc:date>
    </item>
    <item>
      <title>Re: how can i read parameters value automatically?</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/how-can-i-read-parameters-value-automatically/m-p/416212#M2081</link>
      <description>&lt;P&gt;edit: it works too&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks rob!&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;

data bounds;
   input lb ub a b;
   datalines;
-1   3    2 1
 1.5 2   -3 5
 1.2 2.2  5 1
;

proc optmodel;
   var x {1..3};
   num a {1..3};
   num b {1..3};
   max z1 = (sum {j in 1..3} a[j]*x[j])**3/ (sum {j in 1..3} b[j]*x[j]);
   read data bounds into [_N_] x.lb=lb x.ub=ub a b;
   solve with nlp/multistart ;
   print x;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 26 Nov 2017 20:41:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/how-can-i-read-parameters-value-automatically/m-p/416212#M2081</guid>
      <dc:creator>dali74</dc:creator>
      <dc:date>2017-11-26T20:41:34Z</dc:date>
    </item>
    <item>
      <title>Re: how can i read parameters value automatically?</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/how-can-i-read-parameters-value-automatically/m-p/416462#M2082</link>
      <description>&lt;P&gt;Note that your original objective function had x[3]**2 in the denominator.&amp;nbsp; With your latest change, it is now just x[3].&amp;nbsp; If that is what you want, here's a way to make the code more data-driven (without hard-coding 1..3):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc optmodel;
   set OBS;
   var x {OBS};
   num a {OBS};
   num b {OBS};
   max z1 = (sum {j in OBS} a[j]*x[j])**3/ (sum {j in OBS} b[j]*x[j]);
   read data bounds into OBS=[_N_] x.lb=lb x.ub=ub a b;
   solve with nlp/multistart ;
   print x;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This way, you can run again with different data without changing the PROC OPTMODEL code.&amp;nbsp; Such separation of model and data is&amp;nbsp;a best practice&amp;nbsp;enabled by the use of an algebraic modeling language.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Nov 2017 15:51:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/how-can-i-read-parameters-value-automatically/m-p/416462#M2082</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2017-11-28T15:51:25Z</dc:date>
    </item>
  </channel>
</rss>

