<?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: Question on Matrix written or expression in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/Question-on-Matrix-written-or-expression/m-p/207357#M1054</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rob!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks! &lt;/P&gt;&lt;P&gt;I just wanna try the first way, like below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro cons1;&lt;/P&gt;&lt;P&gt;%do j = 1 %to 3;&lt;/P&gt;&lt;P&gt;con Mycon1&amp;amp;j {j in SUPPLIERS, m in RAW_MATERIALS}:&lt;/P&gt;&lt;P&gt;SUM {q in PRICE_INTERVALS} raw_quantity&amp;amp;j_1[m,q] = raw_quantity_1[&amp;amp;j,m];&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%mend cons1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%cons1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With the error message:&lt;/P&gt;&lt;P&gt; ! raw_quantity&amp;amp;j_1[m,q] = raw_quantity_1[&amp;amp;j,m];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 22&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 76&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference J_1 not resolved.&lt;/P&gt;&lt;P&gt;ERROR 22-322: Syntax error, expecting one of the following: !!, (, *, **, +, -, .., /, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;&amp;lt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;=, BY, CROSS, DIFF, ELSE, INTER, SYMDIFF, TO, UNION, [, ^, ||.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%cons1;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 26 Aug 2015 19:23:08 GMT</pubDate>
    <dc:creator>Crubal</dc:creator>
    <dc:date>2015-08-26T19:23:08Z</dc:date>
    <item>
      <title>Question on Matrix written or expression</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Question-on-Matrix-written-or-expression/m-p/207353#M1050</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On SAS proc optmodel, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I ahve already defined raw_quantity_1[j,m] and raw_quantity1_1[m,q], they are in different constraints. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The relationship between them is sum {q in Price_intervals} raw_quantity1_1[m,q] = raw_quantity_1[1,m]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and &lt;SPAN style="font-size: 13.3333330154419px;"&gt;sum {q in Price_intervals} raw_quantity2_1[m,q] = raw_quantity_1[2,m]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;sum {q in Price_intervals} raw_quantity3_1[m,q] = raw_quantity_1[3,m]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;But &lt;SPAN style="font-size: 13.3333330154419px;"&gt;raw_quantity_1[1,m], &lt;SPAN style="font-size: 13.3333330154419px;"&gt; raw_quantity_1[2,m] and &lt;SPAN style="font-size: 13.3333330154419px;"&gt; raw_quantity_1[3,m] should all be expressed as &lt;SPAN style="font-size: 13.3333330154419px;"&gt; raw_quantity_1[j,m] &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any constraint that I can define like that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and sorry I am not able to upload any file. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Aug 2015 02:54:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Question-on-Matrix-written-or-expression/m-p/207353#M1050</guid>
      <dc:creator>Crubal</dc:creator>
      <dc:date>2015-08-26T02:54:45Z</dc:date>
    </item>
    <item>
      <title>Re: Question on Matrix written or expression</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Question-on-Matrix-written-or-expression/m-p/207354#M1051</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would recommend not hard-coding the numbers into your variable names.&amp;nbsp; If you rename and reindex your variables, you can then express the desired constraints compactly as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; con Mycon {j in JSET, m in MSET}:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum {q in Price_intervals} raw_quantity_jmq[j,m,q] = raw_quantity_jm[j,m];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This approach provides better separation between model and data, shortens the code, and reduces the likelihood of copy-and-paste errors.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Aug 2015 03:56:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Question-on-Matrix-written-or-expression/m-p/207354#M1051</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2015-08-26T03:56:28Z</dc:date>
    </item>
    <item>
      <title>Re: Question on Matrix written or expression</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Question-on-Matrix-written-or-expression/m-p/207355#M1052</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Rob!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;May I ask you if not rename or reindex the variables, how could I write them?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Aug 2015 15:53:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Question-on-Matrix-written-or-expression/m-p/207355#M1052</guid>
      <dc:creator>Crubal</dc:creator>
      <dc:date>2015-08-26T15:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: Question on Matrix written or expression</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Question-on-Matrix-written-or-expression/m-p/207356#M1053</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want to keep the original variable names and indices, you could use the SAS macro language, like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%do j = 1 %to 3;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; con Mycon&amp;amp;j {m in MSET}:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum {q in Price_intervals} raw_quantity&amp;amp;j._1[m,q] = raw_quantity_1[&amp;amp;j,m];&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To use this approach, you would need to wrap at least this part in a macro (using %macro and %mend).&amp;nbsp; But my first recommendedation is simpler and more efficient, especially if you have a lot more than three values of j.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Aug 2015 18:28:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Question-on-Matrix-written-or-expression/m-p/207356#M1053</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2015-08-26T18:28:50Z</dc:date>
    </item>
    <item>
      <title>Re: Question on Matrix written or expression</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Question-on-Matrix-written-or-expression/m-p/207357#M1054</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rob!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks! &lt;/P&gt;&lt;P&gt;I just wanna try the first way, like below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro cons1;&lt;/P&gt;&lt;P&gt;%do j = 1 %to 3;&lt;/P&gt;&lt;P&gt;con Mycon1&amp;amp;j {j in SUPPLIERS, m in RAW_MATERIALS}:&lt;/P&gt;&lt;P&gt;SUM {q in PRICE_INTERVALS} raw_quantity&amp;amp;j_1[m,q] = raw_quantity_1[&amp;amp;j,m];&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%mend cons1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%cons1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With the error message:&lt;/P&gt;&lt;P&gt; ! raw_quantity&amp;amp;j_1[m,q] = raw_quantity_1[&amp;amp;j,m];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 22&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 76&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference J_1 not resolved.&lt;/P&gt;&lt;P&gt;ERROR 22-322: Syntax error, expecting one of the following: !!, (, *, **, +, -, .., /, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;&amp;lt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;=, BY, CROSS, DIFF, ELSE, INTER, SYMDIFF, TO, UNION, [, ^, ||.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%cons1;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Aug 2015 19:23:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Question-on-Matrix-written-or-expression/m-p/207357#M1054</guid>
      <dc:creator>Crubal</dc:creator>
      <dc:date>2015-08-26T19:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: Question on Matrix written or expression</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Question-on-Matrix-written-or-expression/m-p/207358#M1055</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need the dot after the &amp;amp;j (as in my code).&amp;nbsp; Also, you should not use j in SUPPLIERS as a constraint index if you are using the macro loop with j.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Aug 2015 19:27:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Question-on-Matrix-written-or-expression/m-p/207358#M1055</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2015-08-26T19:27:13Z</dc:date>
    </item>
    <item>
      <title>Re: Question on Matrix written or expression</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Question-on-Matrix-written-or-expression/m-p/207359#M1056</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;got it~!&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Aug 2015 19:38:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Question-on-Matrix-written-or-expression/m-p/207359#M1056</guid>
      <dc:creator>Crubal</dc:creator>
      <dc:date>2015-08-26T19:38:42Z</dc:date>
    </item>
  </channel>
</rss>

