<?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: Name tuple field in OPTMODEL in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/Name-tuple-field-in-OPTMODEL/m-p/314884#M1535</link>
    <description>&lt;P&gt;In the mean time, please let me know if you would like any suggestions for converting your existing code.&lt;/P&gt;</description>
    <pubDate>Mon, 28 Nov 2016 16:33:43 GMT</pubDate>
    <dc:creator>RobPratt</dc:creator>
    <dc:date>2016-11-28T16:33:43Z</dc:date>
    <item>
      <title>Name tuple field in OPTMODEL</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Name-tuple-field-in-OPTMODEL/m-p/271143#M1334</link>
      <description>&lt;P&gt;In OPL, it's possible to name the different field of a tuple (like record in a database table):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;tuple Point {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int x;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int y;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; };&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It’s also possible to index field:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;tuple nurse {&lt;/P&gt;
&lt;P&gt;&amp;nbsp; key string name;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; int seniority;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; int qualification;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; int payRate;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This way, we don’t have to redefine pattern all the time.&lt;/P&gt;
&lt;P&gt;We can access field by using point notation:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;int x = p.x;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can access an array by the index:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NurseWorkTime[&amp;lt;"Isabelle"&amp;gt;]&amp;lt;=20;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We can use pattern like in OPTMODEL but it’s an option:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; forall(&amp;lt;a,b,c&amp;gt; in t) y[&amp;lt;a,b,c&amp;gt;]==...; };&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The question is : Is this possible to name tuple field and index tupleset in OPTMODEL?&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2016 00:42:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Name-tuple-field-in-OPTMODEL/m-p/271143#M1334</guid>
      <dc:creator>BLAIS</dc:creator>
      <dc:date>2016-05-18T00:42:27Z</dc:date>
    </item>
    <item>
      <title>Re: Name tuple field in OPTMODEL</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Name-tuple-field-in-OPTMODEL/m-p/271147#M1335</link>
      <description>&lt;P&gt;No, you cannot declare a tuple in OPTMODEL, but you can declare a set of tuples and then use&amp;nbsp;arrays indexed over that set. &amp;nbsp;For example, a tuple of length 1:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;set &amp;lt;str&amp;gt; NURSES;
num seniority {NURSES};
num qualification {NURSES};
num payRate {NURSES};
&amp;nbsp;
NurseWorkTime["Isabelle"]&amp;lt;=20;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Or a tuple of length 2 (say &amp;lt;firstname, lastname&amp;gt;):&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;set &amp;lt;str,str&amp;gt; NURSES;
num seniority {NURSES};
num qualification {NURSES};
num payRate {NURSES};
&amp;nbsp;
NurseWorkTime["Isabelle","Smith"]&amp;lt;=20;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In general, the tuples can be arbitrary combinations of num and str.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ormpug/68156/HTML/default/viewer.htm#ormpug_optmodel_details03.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/ormpug/68156/HTML/default/viewer.htm#ormpug_optmodel_details03.htm&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2016 01:05:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Name-tuple-field-in-OPTMODEL/m-p/271147#M1335</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2016-05-18T01:05:14Z</dc:date>
    </item>
    <item>
      <title>Re: Name tuple field in OPTMODEL</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Name-tuple-field-in-OPTMODEL/m-p/271158#M1336</link>
      <description>&lt;P&gt;You can approximate the key and dot notation from OPL with arrays&amp;nbsp;of sets,&amp;nbsp;like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;    proc optmodel;
        set NAMES init /Betty Houlihan/;
        set NURSE{NAMES} init [ 
            /* Seniority, Qualification, Pay Rate */
            /&amp;lt;        20,            73,   140000 &amp;gt;/ 
          , /&amp;lt;         2,            88,    40000 &amp;gt;/ 
        ];

        for {ni in NAMES, &amp;lt;seniority,qualification,pay_rate&amp;gt; in NURSE[ni]}
            put "Nurse " ni " has " seniority " years of experience.";
    quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The downside is that you have the onus of keeping the order of the dummy variables consistent. The upside is that this notation is more like the algebra you might find in a textbook.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2016 02:58:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Name-tuple-field-in-OPTMODEL/m-p/271158#M1336</guid>
      <dc:creator>LeoLopes</dc:creator>
      <dc:date>2016-05-18T02:58:38Z</dc:date>
    </item>
    <item>
      <title>Re: Name tuple field in OPTMODEL</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Name-tuple-field-in-OPTMODEL/m-p/271775#M1346</link>
      <description>&lt;P&gt;Thank you for your answer. I think it can be a good feature to implement in your next version. This way it would be easier to convert OPL code to OPTMODEL.&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2016 16:58:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Name-tuple-field-in-OPTMODEL/m-p/271775#M1346</guid>
      <dc:creator>BLAIS</dc:creator>
      <dc:date>2016-05-19T16:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: Name tuple field in OPTMODEL</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Name-tuple-field-in-OPTMODEL/m-p/271777#M1347</link>
      <description>&lt;P&gt;Thank you for your answer. As you mention, we have to keep an order list of variable and this can be error prone.&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2016 17:00:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Name-tuple-field-in-OPTMODEL/m-p/271777#M1347</guid>
      <dc:creator>BLAIS</dc:creator>
      <dc:date>2016-05-19T17:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: Name tuple field in OPTMODEL</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Name-tuple-field-in-OPTMODEL/m-p/312415#M1515</link>
      <description>&lt;P&gt;Did you expect to add&amp;nbsp;tuple or record type in a near future? This feature (name tuple field) is really useful when you build real life model and also help when you want to convert a model from another algebraic model to OPTMODEL.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2016 18:15:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Name-tuple-field-in-OPTMODEL/m-p/312415#M1515</guid>
      <dc:creator>BLAIS</dc:creator>
      <dc:date>2016-11-17T18:15:32Z</dc:date>
    </item>
    <item>
      <title>Re: Name tuple field in OPTMODEL</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Name-tuple-field-in-OPTMODEL/m-p/314832#M1531</link>
      <description>&lt;P&gt;This feature is not currently in our road map, but we'll keep it in mind for a future release.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2016 15:08:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Name-tuple-field-in-OPTMODEL/m-p/314832#M1531</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2016-11-28T15:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: Name tuple field in OPTMODEL</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Name-tuple-field-in-OPTMODEL/m-p/314845#M1533</link>
      <description>&lt;P&gt;Using notation that we&amp;nbsp;find in a textbook is good advantage for student. It’s not useful for practitioner.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your answer.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2016 15:27:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Name-tuple-field-in-OPTMODEL/m-p/314845#M1533</guid>
      <dc:creator>BLAIS</dc:creator>
      <dc:date>2016-11-28T15:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: Name tuple field in OPTMODEL</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Name-tuple-field-in-OPTMODEL/m-p/314877#M1534</link>
      <description>Thank you for your answer. I will wait for this feature.&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Nov 2016 16:20:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Name-tuple-field-in-OPTMODEL/m-p/314877#M1534</guid>
      <dc:creator>BLAIS</dc:creator>
      <dc:date>2016-11-28T16:20:50Z</dc:date>
    </item>
    <item>
      <title>Re: Name tuple field in OPTMODEL</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Name-tuple-field-in-OPTMODEL/m-p/314884#M1535</link>
      <description>&lt;P&gt;In the mean time, please let me know if you would like any suggestions for converting your existing code.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2016 16:33:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Name-tuple-field-in-OPTMODEL/m-p/314884#M1535</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2016-11-28T16:33:43Z</dc:date>
    </item>
  </channel>
</rss>

