<?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 Changing &amp;quot;Con&amp;quot; to &amp;quot;Fix&amp;quot; with Proc Optmodel in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/Changing-quot-Con-quot-to-quot-Fix-quot-with-Proc-Optmodel/m-p/210428#M1060</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I translate a set of constraints into a "loop of variable fixations"? This is, in the example below I am trying to shift the Loop-constraint to a set of Fix-statements:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* simple transportation model .. ;&lt;BR /&gt;%Let Sources=10;&lt;BR /&gt;%Let Plants=%Eval(&amp;amp;Sources.*2);&lt;/P&gt;&lt;P&gt;Data Costs;&lt;BR /&gt;&amp;nbsp; Do Source=1 To &amp;amp;Sources.;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Do Plant=1 To &amp;amp;Plants.;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Costs=Ranuni(1)*4+19; Output;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End;&lt;BR /&gt;&amp;nbsp; End;&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;Data Demand;&lt;BR /&gt;&amp;nbsp; Do Plant=1 To &amp;amp;Plants.;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Qty=Ranuni(1)*20+200; Output;&lt;BR /&gt;&amp;nbsp; End;&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;Data Supply;&lt;BR /&gt;&amp;nbsp; Do Source=1 To &amp;amp;Sources.;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Qty=Ranuni(1)*15+600; Output;&lt;BR /&gt;&amp;nbsp; End;&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;Data Fixed;&lt;BR /&gt;&amp;nbsp; Source=1; Plant=7; Fixed=50; Output;&lt;BR /&gt;&amp;nbsp; Source=1; Plant=8; Fixed=50; Output;&lt;BR /&gt;&amp;nbsp; Source=1; Plant=9; Fixed=50; Output;&lt;BR /&gt;&amp;nbsp; Source=1; Plant=10; Fixed=50; Output;&lt;BR /&gt;&amp;nbsp; Source=2; Plant=9; Fixed=50; Output;&lt;BR /&gt;&amp;nbsp; Source=2; Plant=10; Fixed=50; Output;&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;Data Costs;&lt;BR /&gt;&amp;nbsp; Merge Costs (in=inC) Fixed;&lt;BR /&gt;&amp;nbsp; By Source Plant;&lt;BR /&gt;&amp;nbsp; If inC;&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;Proc Optmodel;&lt;BR /&gt;&amp;nbsp; Set &amp;lt;Num,Num&amp;gt; q_w;&lt;BR /&gt;&amp;nbsp; Num Costs{q_w};&lt;BR /&gt;&amp;nbsp; Num Fixed_F{q_w};&lt;BR /&gt;&amp;nbsp; Read Data Costs Into q_w=[Source Plant] Costs=Costs Fixed_F=Fixed;&lt;BR /&gt;&amp;nbsp; Set Sources=Setof{&amp;lt;q,w&amp;gt; in q_w} q;&lt;BR /&gt;&amp;nbsp; Set Plants=Setof{&amp;lt;q,w&amp;gt; in q_w} w;&lt;BR /&gt;&amp;nbsp; Num Demand{Plants};&lt;BR /&gt;&amp;nbsp; Num Supply{Sources};&lt;BR /&gt;&amp;nbsp; Read Data Demand Into [Plants=Plant] Demand=Qty;&lt;BR /&gt;&amp;nbsp; Read Data Supply Into [Sources=Source] Supply=Qty;&lt;BR /&gt;&amp;nbsp; Var X{Sources,Plants}&amp;gt;=0;&lt;BR /&gt;&amp;nbsp; Con Cns1{q in Sources}:Sum{w in Plants}X[q,w]&amp;lt;=Supply&lt;Q&gt;;&lt;BR /&gt;&amp;nbsp; Con Cns2{w in Plants}:Sum{q in Sources}X[q,w]&amp;gt;=Demand&lt;W&gt;;&lt;/W&gt;&lt;/Q&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="color: #0000ff;"&gt;Con Loop{q in Sources, w in Plants:Fixed_F[q,w] ne .}:X[q,w]=Fixed_F[q,w]; * &amp;lt;-- equivalent "Fix"-Loop?;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; *Fix X[1,6]=40;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Min Obj=Sum{q in Sources,w in Plants}X[q,w]*Costs[q,w];&lt;BR /&gt;&amp;nbsp; Expand;&lt;BR /&gt;&amp;nbsp; Solve;&lt;BR /&gt;&amp;nbsp; Create Data Result From [Tail Head]={q in Sources, w in Plants} X; &lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; kind regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 31 Aug 2015 07:02:59 GMT</pubDate>
    <dc:creator>user24feb</dc:creator>
    <dc:date>2015-08-31T07:02:59Z</dc:date>
    <item>
      <title>Changing "Con" to "Fix" with Proc Optmodel</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Changing-quot-Con-quot-to-quot-Fix-quot-with-Proc-Optmodel/m-p/210428#M1060</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I translate a set of constraints into a "loop of variable fixations"? This is, in the example below I am trying to shift the Loop-constraint to a set of Fix-statements:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* simple transportation model .. ;&lt;BR /&gt;%Let Sources=10;&lt;BR /&gt;%Let Plants=%Eval(&amp;amp;Sources.*2);&lt;/P&gt;&lt;P&gt;Data Costs;&lt;BR /&gt;&amp;nbsp; Do Source=1 To &amp;amp;Sources.;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Do Plant=1 To &amp;amp;Plants.;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Costs=Ranuni(1)*4+19; Output;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End;&lt;BR /&gt;&amp;nbsp; End;&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;Data Demand;&lt;BR /&gt;&amp;nbsp; Do Plant=1 To &amp;amp;Plants.;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Qty=Ranuni(1)*20+200; Output;&lt;BR /&gt;&amp;nbsp; End;&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;Data Supply;&lt;BR /&gt;&amp;nbsp; Do Source=1 To &amp;amp;Sources.;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Qty=Ranuni(1)*15+600; Output;&lt;BR /&gt;&amp;nbsp; End;&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;Data Fixed;&lt;BR /&gt;&amp;nbsp; Source=1; Plant=7; Fixed=50; Output;&lt;BR /&gt;&amp;nbsp; Source=1; Plant=8; Fixed=50; Output;&lt;BR /&gt;&amp;nbsp; Source=1; Plant=9; Fixed=50; Output;&lt;BR /&gt;&amp;nbsp; Source=1; Plant=10; Fixed=50; Output;&lt;BR /&gt;&amp;nbsp; Source=2; Plant=9; Fixed=50; Output;&lt;BR /&gt;&amp;nbsp; Source=2; Plant=10; Fixed=50; Output;&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;Data Costs;&lt;BR /&gt;&amp;nbsp; Merge Costs (in=inC) Fixed;&lt;BR /&gt;&amp;nbsp; By Source Plant;&lt;BR /&gt;&amp;nbsp; If inC;&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;Proc Optmodel;&lt;BR /&gt;&amp;nbsp; Set &amp;lt;Num,Num&amp;gt; q_w;&lt;BR /&gt;&amp;nbsp; Num Costs{q_w};&lt;BR /&gt;&amp;nbsp; Num Fixed_F{q_w};&lt;BR /&gt;&amp;nbsp; Read Data Costs Into q_w=[Source Plant] Costs=Costs Fixed_F=Fixed;&lt;BR /&gt;&amp;nbsp; Set Sources=Setof{&amp;lt;q,w&amp;gt; in q_w} q;&lt;BR /&gt;&amp;nbsp; Set Plants=Setof{&amp;lt;q,w&amp;gt; in q_w} w;&lt;BR /&gt;&amp;nbsp; Num Demand{Plants};&lt;BR /&gt;&amp;nbsp; Num Supply{Sources};&lt;BR /&gt;&amp;nbsp; Read Data Demand Into [Plants=Plant] Demand=Qty;&lt;BR /&gt;&amp;nbsp; Read Data Supply Into [Sources=Source] Supply=Qty;&lt;BR /&gt;&amp;nbsp; Var X{Sources,Plants}&amp;gt;=0;&lt;BR /&gt;&amp;nbsp; Con Cns1{q in Sources}:Sum{w in Plants}X[q,w]&amp;lt;=Supply&lt;Q&gt;;&lt;BR /&gt;&amp;nbsp; Con Cns2{w in Plants}:Sum{q in Sources}X[q,w]&amp;gt;=Demand&lt;W&gt;;&lt;/W&gt;&lt;/Q&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="color: #0000ff;"&gt;Con Loop{q in Sources, w in Plants:Fixed_F[q,w] ne .}:X[q,w]=Fixed_F[q,w]; * &amp;lt;-- equivalent "Fix"-Loop?;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; *Fix X[1,6]=40;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Min Obj=Sum{q in Sources,w in Plants}X[q,w]*Costs[q,w];&lt;BR /&gt;&amp;nbsp; Expand;&lt;BR /&gt;&amp;nbsp; Solve;&lt;BR /&gt;&amp;nbsp; Create Data Result From [Tail Head]={q in Sources, w in Plants} X; &lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; kind regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Aug 2015 07:02:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Changing-quot-Con-quot-to-quot-Fix-quot-with-Proc-Optmodel/m-p/210428#M1060</guid>
      <dc:creator>user24feb</dc:creator>
      <dc:date>2015-08-31T07:02:59Z</dc:date>
    </item>
    <item>
      <title>Re: Changing "Con" to "Fix" with Proc Optmodel</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Changing-quot-Con-quot-to-quot-Fix-quot-with-Proc-Optmodel/m-p/224399#M1094</link>
      <description>&lt;P&gt;Sorry for the delay while SAS Communities was down in preparation for&amp;nbsp;the relaunch.&amp;nbsp; I hope this reply is still useful for you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;for{q in Sources, w in Plants:Fixed_F[q,w] ne .} fix X[q,w]=Fixed_F[q,w];&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Sep 2015 14:36:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Changing-quot-Con-quot-to-quot-Fix-quot-with-Proc-Optmodel/m-p/224399#M1094</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2015-09-08T14:36:24Z</dc:date>
    </item>
    <item>
      <title>Re: Changing "Con" to "Fix" with Proc Optmodel</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Changing-quot-Con-quot-to-quot-Fix-quot-with-Proc-Optmodel/m-p/224906#M1098</link>
      <description>&lt;P&gt;Thanks Rob Pratt&amp;nbsp;for helping on countless occasions. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2015 06:24:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Changing-quot-Con-quot-to-quot-Fix-quot-with-Proc-Optmodel/m-p/224906#M1098</guid>
      <dc:creator>user24feb</dc:creator>
      <dc:date>2015-09-10T06:24:27Z</dc:date>
    </item>
  </channel>
</rss>

