<?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: PROC OPTMODEL - constraints for chosing a specific node in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/PROC-OPTMODEL-constraints-for-chosing-a-specific-node/m-p/631003#M3029</link>
    <description>&lt;P&gt;THanks Rob. It worked.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 10 Mar 2020 16:38:23 GMT</pubDate>
    <dc:creator>Santha</dc:creator>
    <dc:date>2020-03-10T16:38:23Z</dc:date>
    <item>
      <title>PROC OPTMODEL - constraints for chosing a specific node</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/PROC-OPTMODEL-constraints-for-chosing-a-specific-node/m-p/630917#M3024</link>
      <description>&lt;P&gt;Rob. - This is still a MILP.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This should be straight forward but I am not getting it correct.&amp;nbsp; I am trying to have a constraint called "LSP_DC" and an associated "LSP_DCLink" . What I am trying to enforce is that a given LSP should go to "x" number of DCs . I define what x is. This does not seem to do what I want.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc optmodel;&lt;/P&gt;&lt;P&gt;set&amp;lt;str&amp;gt; Ports=/'SHA' 'YAN'/;&lt;BR /&gt;set&amp;lt;str&amp;gt; DC=/'AL1' 'FU1'/;&lt;BR /&gt;set&amp;lt;str&amp;gt; LSP=/'MAEU' 'ONEY' 'COSC'/;&lt;BR /&gt;set &amp;lt;str&amp;gt; Transit=/'West','East', 'Gulf'/;&lt;BR /&gt;&lt;BR /&gt;num Containers {Ports,DC}= [2000,3000,1000,4000];&lt;BR /&gt;print containers;&lt;/P&gt;&lt;P&gt;var Is_LSP {LSP} binary;&lt;BR /&gt;var IsLSPDC {LSP,DC} binary;&lt;BR /&gt;var IsPortsLSPDC {Ports,LSP,DC} binary;&lt;BR /&gt;var IsPortsTransitLSPDC {Ports,Transit,LSP,DC} binary;&lt;/P&gt;&lt;P&gt;/* declare Constants*/&lt;BR /&gt;num Min_Qty_LSP=200;&lt;/P&gt;&lt;P&gt;/*RATES*/&lt;BR /&gt;num InboundLinehaul {Ports,Transit,LSP,DC}= [40,10,30,5,20,10,&lt;BR /&gt;20,6,30,7,3,5,&lt;BR /&gt;2,6,2,60,18,4,&lt;BR /&gt;32,70,2,30,18,40,&lt;BR /&gt;19,10,2,29,3,9,&lt;BR /&gt;42,36,79,10,5,14&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* DECISON VARIABLE */&lt;/P&gt;&lt;P&gt;var ContainersfromPortstoLSPtoDC {Ports,Transit,LSP,DC}&amp;gt;=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* IMPLIED VARIABLE */&lt;BR /&gt;impvar Inbound_Linehaul_Costs= sum {p in Ports, t in Transit,c in LSP, d in DC} InboundLinehaul [p,t,c,d] *ContainersfromPortstoLSPtoDC [p,t,c,d];&lt;BR /&gt;impvar ContainersatLSP{c in LSP}=sum{p in Ports,t in Transit,d in DC} ContainersfromPortstoLSPtoDC [p,t,c,d];&lt;BR /&gt;impvar ContainersatTransitLSP{t in Transit, c in LSP}=sum{p in Ports,d in DC} ContainersfromPortstoLSPtoDC [p,t,c,d];&lt;/P&gt;&lt;P&gt;/* declare Objective Function*/&lt;BR /&gt;Min TotalCost = Inbound_Linehaul_Costs;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* GENERAL CONSTRAINTS */&lt;BR /&gt;con Min_Qty_at_LSP_is_Respected {c in LSP} :&lt;BR /&gt;sum{p in Ports,t in Transit,d in DC} ContainersfromPortstoLSPtoDC [p,t,c,d]&amp;gt;=Min_Qty_LSP*Is_LSP[c];&lt;/P&gt;&lt;P&gt;con ModelOutput_Same_As_ModelInput {p in Ports, d in DC}:&lt;BR /&gt;sum {t in Transit,c in LSP} ContainersfromPortstoLSPtoDC[p,t,c, d] = Containers [p,d];&lt;/P&gt;&lt;P&gt;con CheckLSP {c in LSP}: ContainersatLSP[c] &amp;lt;= 10000*Is_LSP[c];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*Constraint for retricting LSP-DC: given LSP can go to only "x" number of DC* - in this case x=2/&lt;BR /&gt;num MAEU_DCs=2;&lt;/P&gt;&lt;P&gt;fix Is_LSP ['MAEU']=1;&lt;BR /&gt;con LSP_DC: sum{d in DC} IsLSPDC['MAEU',d] = MAEU_DCs;&lt;BR /&gt;con LSP_DC_Link{p in Ports, t in Transit,c in LSP, d in DC}:&lt;BR /&gt;ContainersfromPortstoLSPtoDC[p,t,'MAEU',d] &amp;lt;= 10000 * IsLSPDC['MAEU',d];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;expand;&lt;/P&gt;&lt;P&gt;solve with milp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 13:46:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/PROC-OPTMODEL-constraints-for-chosing-a-specific-node/m-p/630917#M3024</guid>
      <dc:creator>Santha</dc:creator>
      <dc:date>2020-03-10T13:46:08Z</dc:date>
    </item>
    <item>
      <title>Re: PROC OPTMODEL - constraints for chosing a specific node</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/PROC-OPTMODEL-constraints-for-chosing-a-specific-node/m-p/630924#M3025</link>
      <description>&lt;P&gt;I changed the constraint to but with no luck yet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;con LSP_DC_Link{p in Ports, t in Transit,c in {"MAEU"}, d in DC}:&lt;BR /&gt;ContainersfromPortstoLSPtoDC[p,t,'MAEU',d] &amp;lt;= 10000 * IsLSPDC['MAEU',d];&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 14:02:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/PROC-OPTMODEL-constraints-for-chosing-a-specific-node/m-p/630924#M3025</guid>
      <dc:creator>Santha</dc:creator>
      <dc:date>2020-03-10T14:02:59Z</dc:date>
    </item>
    <item>
      <title>Re: PROC OPTMODEL - constraints for chosing a specific node</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/PROC-OPTMODEL-constraints-for-chosing-a-specific-node/m-p/630950#M3026</link>
      <description>&lt;P&gt;Sorry, I don't quite follow.&amp;nbsp; Can you please describe what is wrong with the resulting solution?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 15:09:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/PROC-OPTMODEL-constraints-for-chosing-a-specific-node/m-p/630950#M3026</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2020-03-10T15:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: PROC OPTMODEL - constraints for chosing a specific node</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/PROC-OPTMODEL-constraints-for-chosing-a-specific-node/m-p/630957#M3027</link>
      <description>&lt;P&gt;Sure. Sorry for not articulating it .&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this LSP called "MAEU" . I want this LSP to serve 2 DCs (that is AL1 and FU1). However the model does not allocate MAEU to 2 DCs. It does allocate to only 1 DC. I want any given LSP to serve any number of DCs. That is my objective.&lt;/P&gt;&lt;P&gt;Here is the output:&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Ports&lt;/TD&gt;&lt;TD&gt;Transit&lt;/TD&gt;&lt;TD&gt;LSP&lt;/TD&gt;&lt;TD&gt;Destination&lt;/TD&gt;&lt;TD&gt;ScenarioName&lt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gt;East&lt;/TD&gt;&lt;TD&gt;COSC&lt;/TD&gt;&lt;TD&gt;FU1&lt;/TD&gt;&lt;TD&gt;PN3158-Alt4&lt;/TD&gt;&lt;TD&gt;4000&lt;/TD&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;TD&gt;36000&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Please let me know.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 15:26:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/PROC-OPTMODEL-constraints-for-chosing-a-specific-node/m-p/630957#M3027</guid>
      <dc:creator>Santha</dc:creator>
      <dc:date>2020-03-10T15:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: PROC OPTMODEL - constraints for chosing a specific node</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/PROC-OPTMODEL-constraints-for-chosing-a-specific-node/m-p/630969#M3028</link>
      <description>&lt;P&gt;OK, thanks for the clarification.&amp;nbsp; Your constraints enforce only that&amp;nbsp;ContainersfromPortstoLSPtoDC[p,t,c,d] &amp;gt; 0 for some p and t implies IsLSPDC[c,d] = 1, but you need additional constraints to enforce the converse:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;con LSP_DC_Link2{c in LSP, d in DC}:
   sum {p in Ports, t in Transit} ContainersfromPortstoLSPtoDC[p,t,c,d] &amp;gt;= IsLSPDC[c,d];&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 15:46:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/PROC-OPTMODEL-constraints-for-chosing-a-specific-node/m-p/630969#M3028</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2020-03-10T15:46:36Z</dc:date>
    </item>
    <item>
      <title>Re: PROC OPTMODEL - constraints for chosing a specific node</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/PROC-OPTMODEL-constraints-for-chosing-a-specific-node/m-p/631003#M3029</link>
      <description>&lt;P&gt;THanks Rob. It worked.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 16:38:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/PROC-OPTMODEL-constraints-for-chosing-a-specific-node/m-p/631003#M3029</guid>
      <dc:creator>Santha</dc:creator>
      <dc:date>2020-03-10T16:38:23Z</dc:date>
    </item>
  </channel>
</rss>

