<?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: Please help in below facility location code in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/Please-help-in-below-facility-location-code/m-p/326300#M1632</link>
    <description>&lt;P&gt;To force DC 1 and DC 2 to be open, you can declare a constraint:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;con FixOpen {c in {'DC 1','DC 2'}}:
   Y[c] = 1;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or use the FIX 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;for {c in {'DC 1','DC 2'}}
   fix Y[c] = 1;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To force exactly one potential DC to be open:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;con ExactlyOnePotentialOpen:
   sum {c in {'Potential DC 3','Potential DC 4','Potential DC 5'}} Y[c] = 1;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Alternatively, you can scan for 'Potential' as the first word in the name:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;con ExactlyOnePotentialOpen:
   sum {c in CentralWH: scan(c,1) = 'Potential'} Y[c] = 1;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For the other constraints you want, can you please write out the mathematical expressions? &amp;nbsp;The benefit of an optimization modeling language is that the corresponding constraint declarations will look very similar to the mathematics.&lt;/P&gt;</description>
    <pubDate>Fri, 20 Jan 2017 15:12:42 GMT</pubDate>
    <dc:creator>RobPratt</dc:creator>
    <dc:date>2017-01-20T15:12:42Z</dc:date>
    <item>
      <title>Please help in below facility location code</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Please-help-in-below-facility-location-code/m-p/315424#M1541</link>
      <description>&lt;P&gt;Dear SAS community members,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need some help in below code. i wrote below code to solve a facility location problem but the result differs from the one i get from Excel solver. Could you please help explaining what is the wrong in the below code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc optmodel;&lt;/P&gt;&lt;P&gt;set DC = {'BO','NA','PR','SP','WO'};&lt;BR /&gt;set City = {'BO','BR','CO','HA','MN','NA','NH','NL','PO','PR','SP','WO'};&lt;/P&gt;&lt;P&gt;number transoprtationcost {DC,City} = [&lt;BR /&gt;0 37 42 82 34&lt;BR /&gt;93 65 106 59 68&lt;BR /&gt;69 33 105 101 72&lt;BR /&gt;98 103 73 27 66&lt;BR /&gt;55 20 92 93 60&lt;BR /&gt;37 0 72 79 41&lt;BR /&gt;128 137 94 63 98&lt;BR /&gt;95 113 57 57 71&lt;BR /&gt;62 48 104 127 85&lt;BR /&gt;42 72 0 68 38&lt;BR /&gt;82 79 68 0 47&lt;BR /&gt;34 41 38 47 0&lt;BR /&gt;];&lt;BR /&gt;number fixedcost {DC}=[10000 10000 10000 10000 10000];&lt;BR /&gt;number demand {City}=[425 12 43 125 110 86 129 28 66 320 220 182];&lt;BR /&gt;number supply {DC}=[2000 2000 2000 2000 2000];&lt;BR /&gt;number M= 1000000000;&lt;/P&gt;&lt;P&gt;var X{DC,City} integer &amp;gt;=0;&lt;BR /&gt;var Y{DC} binary;&lt;/P&gt;&lt;P&gt;min totalcost = sum {d in DC, c in City}&lt;BR /&gt;X[d,c]*transoprtationcost[d,c]+sum{d in DC}Y[d]*fixedcost[d];&lt;/P&gt;&lt;P&gt;con supplycons {d in DC}:sum{c in City} X[d,c]&amp;lt;=supply[d];&lt;BR /&gt;con demandcons {c in City}:sum{d in DC} X[d,c]&amp;gt;=demand[c];&lt;BR /&gt;con conserv {d in DC, c in City}:X[d,c]-M*Y[d]&amp;lt;=0;&lt;BR /&gt;con numberofDC:sum {d in DC} Y[d]=1;&lt;/P&gt;&lt;P&gt;solve;&lt;/P&gt;&lt;P&gt;print X Y totalcost;&lt;/P&gt;&lt;P&gt;Quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ahmed Taher;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2016 06:43:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Please-help-in-below-facility-location-code/m-p/315424#M1541</guid>
      <dc:creator>ahmedtaher900</dc:creator>
      <dc:date>2016-11-30T06:43:20Z</dc:date>
    </item>
    <item>
      <title>Re: Please help in below facility location code</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Please-help-in-below-facility-location-code/m-p/315467#M1542</link>
      <description>&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;after a lot of tries finally i got the right soultion for this problem which will be as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc optmodel;&lt;/P&gt;&lt;P&gt;set DC = {'BO','NA','PR','SP','WO'};&lt;BR /&gt;set City = {'BO','BR','CO','HA','MN','NA','NH','NL','PO','PR','SP','WO'};&lt;/P&gt;&lt;P&gt;number transoprtationcost {DC,City} = [&lt;BR /&gt;0 93 69 98 55 37 128 95 62 42 82 34&lt;BR /&gt;37 65 33 103 20 0 137 113 48 72 79 41&lt;BR /&gt;42 106 105 73 92 72 94 57 104 0 68 38&lt;BR /&gt;82 59 101 27 93 79 63 57 127 68 0 47&lt;BR /&gt;34 68 72 66 60 41 98 71 85 38 47 0&lt;BR /&gt;];&lt;BR /&gt;number fixedcost {DC}=[10000 10000 10000 10000 10000];&lt;BR /&gt;number demand {City}=[425 12 43 125 110 86 129 28 66 320 220 182];&lt;BR /&gt;number supply {DC}=[1746 1746 1746 1746 1746];&lt;BR /&gt;number M= 100000;&lt;/P&gt;&lt;P&gt;var X{DC,City} integer &amp;gt;=0;&lt;BR /&gt;var Y{DC} binary;&lt;/P&gt;&lt;P&gt;minimize totalcost = sum {d in DC}sum{c in City}&lt;BR /&gt;X[d,c]*transoprtationcost[d,c]+sum{n in DC}fixedcost[n]*Y[n];&lt;/P&gt;&lt;P&gt;con supplycons {d in DC}:sum{c in City} X[d,c]&amp;lt;=supply[d];&lt;BR /&gt;con demandcons {c in City}:sum{d in DC} X[d,c]&amp;gt;=demand[c];&lt;BR /&gt;con conserv {d in DC, c in City}:X[d,c]-M*Y[d]&amp;lt;=0;&lt;BR /&gt;/*con numberofDC:sum {d in DC} Y[d]=1;*/&lt;/P&gt;&lt;P&gt;solve;&lt;/P&gt;&lt;P&gt;print X totalcost;&lt;/P&gt;&lt;P&gt;Quit;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2016 10:58:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Please-help-in-below-facility-location-code/m-p/315467#M1542</guid>
      <dc:creator>ahmedtaher900</dc:creator>
      <dc:date>2016-11-30T10:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: Please help in below facility location code</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Please-help-in-below-facility-location-code/m-p/315637#M1543</link>
      <description>&lt;P&gt;I have a couple of suggestions for improvement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. An arbitrarily large value like 100000 for M can cause numerical difficulties for optimization solvers. &amp;nbsp;In this case, the supplycons constraint implies&amp;nbsp;that X[d,c] &amp;lt;= supply[d], so you can instead use the following tighter constraint:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;con conserv {d in DC, c in City}:X[d,c]-supply[d]*Y[d]&amp;lt;=0;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;2. You can in fact avoid the conserv constraint altogether if you tighten the supplycons constraint as follows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;con supplycons {d in DC}:sum{c in City} X[d,c]&amp;lt;=supply[d]*Y[d];
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The resulting model (without conserv and with the new supplycons) is tighter, smaller, and more numerically stable. &amp;nbsp;For your small instance, even the original model solves quickly. &amp;nbsp;But these best practices can make a big difference for larger instances.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2016 18:53:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Please-help-in-below-facility-location-code/m-p/315637#M1543</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2016-11-30T18:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: Please help in below facility location code</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Please-help-in-below-facility-location-code/m-p/322466#M1617</link>
      <description>&lt;P&gt;Dear Rob,&lt;/P&gt;&lt;P&gt;First of all happy new year.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a question regarding the above code I was asking how to add a constraints or a logical link to this code that force the source to ship only quantities that are divided by 5.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 19:42:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Please-help-in-below-facility-location-code/m-p/322466#M1617</guid>
      <dc:creator>ahmedtaher900</dc:creator>
      <dc:date>2017-01-04T19:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: Please help in below facility location code</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Please-help-in-below-facility-location-code/m-p/322472#M1618</link>
      <description>&lt;P&gt;Do you want each X[d,c] to be a multiple of 5, or sum{c in City} X[d,c] to be a multiple of 5 for each d, or something else?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In any case, you can introduce a family of integer variables Z[] and constraints that force&amp;nbsp;the expression to equal&amp;nbsp;5*Z[].&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 20:13:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Please-help-in-below-facility-location-code/m-p/322472#M1618</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2017-01-04T20:13:11Z</dc:date>
    </item>
    <item>
      <title>Re: Please help in below facility location code</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Please-help-in-below-facility-location-code/m-p/322484#M1619</link>
      <description>Thanks a lot for your quick reply, however I didn't get the point. Would you please give me more explanation? For your question to be more clear in my question I want each X[d,c] to be a multiple of 5&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Ahmed Taher</description>
      <pubDate>Wed, 04 Jan 2017 20:30:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Please-help-in-below-facility-location-code/m-p/322484#M1619</guid>
      <dc:creator>ahmedtaher900</dc:creator>
      <dc:date>2017-01-04T20:30:16Z</dc:date>
    </item>
    <item>
      <title>Re: Please help in below facility location code</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Please-help-in-below-facility-location-code/m-p/322491#M1620</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;var Z{DC,City} integer &amp;gt;= 0;
con Five {d in DC, c in City}:
   X[d,c] = 5*Z[d,c];
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Jan 2017 20:39:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Please-help-in-below-facility-location-code/m-p/322491#M1620</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2017-01-04T20:39:53Z</dc:date>
    </item>
    <item>
      <title>Re: Please help in below facility location code</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Please-help-in-below-facility-location-code/m-p/322592#M1621</link>
      <description>&lt;P&gt;Thanks a lot Man. You are the hero of these communities.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2017 06:36:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Please-help-in-below-facility-location-code/m-p/322592#M1621</guid>
      <dc:creator>ahmedtaher900</dc:creator>
      <dc:date>2017-01-05T06:36:35Z</dc:date>
    </item>
    <item>
      <title>Re: Please help in below facility location code</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Please-help-in-below-facility-location-code/m-p/322671#M1622</link>
      <description>&lt;P&gt;Glad to help. &amp;nbsp;By the way, here is an alternative approach that declares X as an implicit variable instead:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*var X{DC,City} integer &amp;gt;=0;*/
var Z{DC,City} integer &amp;gt;= 0;
/*con Five {d in DC, c in City}:*/
/*   X[d,c] = 5*Z[d,c];*/
impvar X {d in DC, c in City} = 5*Z[d,c];
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Jan 2017 14:55:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Please-help-in-below-facility-location-code/m-p/322671#M1622</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2017-01-05T14:55:41Z</dc:date>
    </item>
    <item>
      <title>Re: Please help in below facility location code</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Please-help-in-below-facility-location-code/m-p/325258#M1630</link>
      <description>&lt;P&gt;Dear Boss &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/1636"&gt;@RobPratt&lt;/a&gt;&amp;nbsp;&lt;SPAN class=""&gt;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/1636" target="_self"&gt;RobPratt&lt;/A&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;I need your help again in the below code. my issue is that i know the logical thinking of how to solve the issue so I know the how to solve it mathematically but since I'm not that godd in SAS programming I am asking for you kind help in programming. in the below code &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;I want to add constraint that says that I need &lt;U&gt;&lt;STRONG&gt;DC 1 and DC 2 are open by default&lt;/STRONG&gt;&lt;/U&gt;&amp;nbsp;, and I need the optimization to choose the best DC from&lt;U&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/U&gt;&lt;SPAN&gt;&lt;U&gt;&lt;STRONG&gt;'Potential DC 3', 'Potential DC 4', 'Potential DC 5' &amp;nbsp;&lt;/STRONG&gt;&lt;/U&gt;in addition to DC 1 and 2 which are forced to be open as mentioned before.&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;also I want to add a level of service constraint that says&amp;nbsp;&lt;SPAN&gt;75% of demand should be within 50 miles of a DC and the max average distance from a DC is &amp;lt;= 60 mile.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;Your help is always appreciated.&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Proc optmodel;

set Plants = {'Plant 1','Contractor'};
set CentralWH = {'DC 1',	'DC 2',	'Potential DC 3',	'Potential DC 4',	'Potential DC 5'};
set RegionalWH = {'SO 1','SO 2','SO 3','SO 4','SO 5','SO 6','SO 7','SO 8'};

number outbounddist {Plants,CentralWH} = [
77	48	41	57	94
54	33	21	94	44
];

number inbounddist {CentralWH,RegionalWH} = [
62	55	114	106	51	76	122	80
63	92	90	50	88	47	136	47
76	85	56	65	129	40	89	100
42	128	74	70	45	56	81	131
77	135	118	59	124	93	41	94
];
number fixedcostWH {CentralWH} = [100 100 80 70 60];
number varcostWH {CentralWH} = [10 10 25 30 50];
number varcostplant {Plants} = [10 50];
number Demand {RegionalWH} = [121	96	166	175	210	130	180	160];
number Supply {Plants} = [1250 200];

var X {Plants,CentralWH} integer &amp;gt;=0;
var Z {CentralWH,RegionalWH} integer &amp;gt;=0;
var Y {CentralWH} binary;

min totalcost = sum {p in Plants,c in CentralWH} X[p,c]*1.5*outbounddist[p,c]+
                sum {p in Plants,c in CentralWH} X[p,c]*varcostplant[p]+
				sum {c in CentralWH,r in RegionalWH} Z[c,r]*1*inbounddist[c,r]+
				sum {c in CentralWH,r in RegionalWH} Z[c,r]*varcostWH[c]+
				sum {c in CentralWH} Y[c]*fixedcostWH[c];

 con supplycons {p in Plants}: sum {c in CentralWH} X[p,c]&amp;lt;=Supply[p];
 /*con supplycons1{p in Plants}: sum {c in CentralWH} X[p,'DC 1']&amp;gt;=1;*/
 /*con supplycons2{p in Plants}: sum {c in CentralWH} X[p,'DC 2']&amp;gt;=1;*/
 con demandcons {r in RegionalWH}: sum {c in CentralWH} Z[c,r]&amp;gt;=Demand[r];
 con nonstock   {c in CentralWH}: sum {p in Plants}X[p,c]-sum {r in RegionalWH}Z[c,r]=0;
 con conserva   {p in Plants,c in CentralWH}:X[p,c]-Y[c]*Supply[p]&amp;lt;=0;
 con numberofDC : sum {c in CentralWH} Y[c]&amp;gt;=1;

 solve;

 print X Y Z totalcost;

 quit;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 12:47:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Please-help-in-below-facility-location-code/m-p/325258#M1630</guid>
      <dc:creator>ahmedtaher900</dc:creator>
      <dc:date>2017-01-17T12:47:21Z</dc:date>
    </item>
    <item>
      <title>Re: Please help in below facility location code</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Please-help-in-below-facility-location-code/m-p/325278#M1631</link>
      <description>&lt;P&gt;Sorry man for a lot of question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also i want to ask what if i want to add a constraint says that in case of demand shortage there will be a penality of X$ will be charged to the plants for each item shortage.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 14:15:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Please-help-in-below-facility-location-code/m-p/325278#M1631</guid>
      <dc:creator>ahmedtaher900</dc:creator>
      <dc:date>2017-01-17T14:15:12Z</dc:date>
    </item>
    <item>
      <title>Re: Please help in below facility location code</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Please-help-in-below-facility-location-code/m-p/326300#M1632</link>
      <description>&lt;P&gt;To force DC 1 and DC 2 to be open, you can declare a constraint:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;con FixOpen {c in {'DC 1','DC 2'}}:
   Y[c] = 1;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or use the FIX 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;for {c in {'DC 1','DC 2'}}
   fix Y[c] = 1;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To force exactly one potential DC to be open:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;con ExactlyOnePotentialOpen:
   sum {c in {'Potential DC 3','Potential DC 4','Potential DC 5'}} Y[c] = 1;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Alternatively, you can scan for 'Potential' as the first word in the name:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;con ExactlyOnePotentialOpen:
   sum {c in CentralWH: scan(c,1) = 'Potential'} Y[c] = 1;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For the other constraints you want, can you please write out the mathematical expressions? &amp;nbsp;The benefit of an optimization modeling language is that the corresponding constraint declarations will look very similar to the mathematics.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 15:12:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Please-help-in-below-facility-location-code/m-p/326300#M1632</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2017-01-20T15:12:42Z</dc:date>
    </item>
  </channel>
</rss>

