<?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 Error in sum statement in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/Proc-Optmodel-Error-in-sum-statement/m-p/369295#M1892</link>
    <description>&lt;P&gt;Here, I have created 2 sets of fixed costs, and also 2 constraints with number M.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code runs OK, but is it correct?&lt;/P&gt;&lt;P&gt;Thanks for your input.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc optmodel;&lt;BR /&gt;&lt;BR /&gt;set Factories= {'Kansas','NorthCarolina','NewHampshire','SouthDakota'};&lt;BR /&gt;set DCs= {'Virginia','Missouri','California','Florida'};&lt;BR /&gt;set Crossdocks= {'Wisconsin','Minnesota', 'SouthCarolina'};&lt;BR /&gt;&lt;BR /&gt;number incost{Factories,Crossdocks}=[&lt;BR /&gt;36	26	31&lt;BR /&gt;43	28	48&lt;BR /&gt;37	44	42&lt;BR /&gt;32	28	30&lt;BR /&gt;];&lt;BR /&gt;&lt;BR /&gt;number outcost {Crossdocks,DCs}=[&lt;BR /&gt;37	29	15	26&lt;BR /&gt;30	42	40	20&lt;BR /&gt;16	27	46	42&lt;BR /&gt;];&lt;BR /&gt;&lt;BR /&gt;number capacity {Factories}=[&lt;BR /&gt;37	19	42	25];&lt;BR /&gt;&lt;BR /&gt;number demand {DCs}=[&lt;BR /&gt;3	12	15	15];&lt;BR /&gt;&lt;BR /&gt;number ProdCost {Factories} = [500 220 200 180];&lt;BR /&gt;number FixedCost {Crossdocks} = [650 950 800];&lt;BR /&gt;number MaxUse {Crossdocks} = [37 43	31];&lt;BR /&gt;number M=1000000;&lt;BR /&gt;&lt;BR /&gt;var inflow {Factories,Crossdocks} &amp;gt;= 0;&lt;BR /&gt;var outflow {Crossdocks,DCs} &amp;gt;= 0;&lt;BR /&gt;var T {Factories} binary;&lt;BR /&gt;var Y {Crossdocks} binary;&lt;BR /&gt;&lt;BR /&gt;minimize TotalCost =sum {j in Crossdocks} ( sum {i in Factories} ( inflow[i,j]*incost[i,j] + Y[j]*FixedCost[j]+T[i]*ProdCost[i] )+sum {k in DCs} outcost[j,k]*outflow[j,k]);&lt;BR /&gt;&lt;BR /&gt;con Max_Supply {i in Factories} : sum {j in Crossdocks} inflow[i,j] &amp;lt;=capacity[i];&lt;BR /&gt;con No_Stock {j in Crossdocks} : sum {i in Factories} inflow[i,j] = sum {k in DCs} outflow[j,k];&lt;BR /&gt;con Min_Demand {k in DCs} : sum {j in Crossdocks} outflow[j,k] &amp;gt;=demand[k];&lt;BR /&gt;con Max_Use{j in Crossdocks} : sum {i in Factories} inflow[i,j] &amp;lt;=MaxUse[j];&lt;BR /&gt;con Inspections {j in Crossdocks} : sum {i in Factories} inflow[i,j] &amp;lt;= M*Y[j];&lt;BR /&gt;con Facost {i in Factories}: sum {j in Crossdocks}inflow[i,j]&amp;lt;= M*T[i];&lt;BR /&gt;&lt;BR /&gt;solve;&lt;BR /&gt;print inflow outflow TotalCost;&lt;BR /&gt;quit;&lt;/PRE&gt;</description>
    <pubDate>Wed, 21 Jun 2017 19:44:26 GMT</pubDate>
    <dc:creator>jfm00</dc:creator>
    <dc:date>2017-06-21T19:44:26Z</dc:date>
    <item>
      <title>Proc Optmodel Error in sum statement</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Proc-Optmodel-Error-in-sum-statement/m-p/368107#M1879</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here, my Factories as well as my Crossdocks have a Fixed Cost.&lt;/P&gt;
&lt;P&gt;I keep getting an error. Where is the mistake in my program?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Proc optmodel;&lt;BR /&gt;&lt;BR /&gt;set Factories= {"Kansas","NorthCarolina","NewHampshire","SouthDakota"};&lt;BR /&gt;set DCs= {"Virginia","Missouri","California","Florida"};&lt;BR /&gt;set Crossdocks= {"Wisconsin","Minnesota","SouthCarolina"};&lt;BR /&gt;&lt;BR /&gt;number incost{Factories,Crossdocks}=[&lt;BR /&gt;36	26	31&lt;BR /&gt;43	28	48&lt;BR /&gt;37	44	42&lt;BR /&gt;32	28	30&lt;BR /&gt;];&lt;BR /&gt;&lt;BR /&gt;number outcost {Crossdocks,DCs}=[&lt;BR /&gt;37	29	15	26&lt;BR /&gt;30	42	40	20&lt;BR /&gt;16	27	46	42&lt;BR /&gt;];&lt;BR /&gt;&lt;BR /&gt;number capacity {Factories}=[&lt;BR /&gt;37	19	42	25];&lt;BR /&gt;&lt;BR /&gt;number demand {DCs}=[&lt;BR /&gt;3	12	15	15];&lt;BR /&gt;&lt;BR /&gt;number FixedCost {Factories, Crossdocks}= [&lt;BR /&gt;500 650&lt;BR /&gt;220 950&lt;BR /&gt;200 800&lt;BR /&gt;180&lt;BR /&gt;];&lt;BR /&gt;number M = 1000000;&lt;BR /&gt;number MaxUse {Crossdocks}=[37	43	31];&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;var inflow {Factories,Crossdocks} &amp;gt;= 0;&lt;BR /&gt;var outflow {Crossdocks,DCs} &amp;gt;= 0;&lt;BR /&gt;var Y {Factories,Crossdocks} binary;&lt;BR /&gt; &lt;BR /&gt;minimize Total_Cost= sum {j in Crossdocks}(sum{i in Factories}(inflow[i,j]*incost[i,j])+Y[i,j]*FixedCost[i,j])+sum{j in Crossdocks, k in DCs}outcost[j,k]*outflow[j,k];&lt;BR /&gt;&lt;BR /&gt;con Max_Supply {i in Factories} : sum {j in Crossdocks} inflow[i,j] &amp;lt;=capacity[i];&lt;BR /&gt;con No_Stock {j in Crossdocks} : sum {i in Factories} inflow[i,j] = sum {k in DCs} outflow[j,k];&lt;BR /&gt;con Min_Demand {k in DCs} : sum {j in Crossdocks} outflow[j,k] &amp;gt;=demand[k];&lt;BR /&gt;con Max_Use{j in Crossdocks}: sum{i in Factories}inflow[i,j]&amp;lt;=MaxUse[j];&lt;BR /&gt;con Inspections {j in Crossdocks}: sum{i in Factories}inflow[i,j]&amp;lt;=M*Y[j];&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;solve;&lt;BR /&gt;&lt;BR /&gt;print Total_Cost;&lt;BR /&gt;print inflow;&lt;BR /&gt;print outflow;&lt;BR /&gt;&lt;BR /&gt;quit;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Jun 2017 21:57:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Proc-Optmodel-Error-in-sum-statement/m-p/368107#M1879</guid>
      <dc:creator>jfm00</dc:creator>
      <dc:date>2017-06-18T21:57:59Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Optmodel Error in sum statement</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Proc-Optmodel-Error-in-sum-statement/m-p/368110#M1880</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/142779"&gt;@jfm00&lt;/a&gt;&amp;nbsp;please note that I've moved to the optimization forum which is more applicable in your question and edited the subject title to be more descriptive. And I've edited your question to separate the question from the code. Additionally, here is the log from your code that may help someone answer your question, so they don't have to run everything.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;BR /&gt; 59 &lt;BR /&gt; 60 Proc optmodel;&lt;BR /&gt; 61 &lt;BR /&gt; 62 set Factories= {"Kansas","NorthCarolina","NewHampshire","SouthDakota"};&lt;BR /&gt; 63 set DCs= {"Virginia","Missouri","California","Florida"};&lt;BR /&gt; 64 set Crossdocks= {"Wisconsin","Minnesota","SouthCarolina"};&lt;BR /&gt; 65 &lt;BR /&gt; 66 number incost{Factories,Crossdocks}=[&lt;BR /&gt; 67 362631&lt;BR /&gt; 68 432848&lt;BR /&gt; 69 374442&lt;BR /&gt; 70 322830&lt;BR /&gt; 71 ];&lt;BR /&gt; 72 &lt;BR /&gt; 73 number outcost {Crossdocks,DCs}=[&lt;BR /&gt; 74 37291526&lt;BR /&gt; 75 30424020&lt;BR /&gt; 76 16274642&lt;BR /&gt; 77 ];&lt;BR /&gt; 78 &lt;BR /&gt; 79 number capacity {Factories}=[&lt;BR /&gt; 80 37194225];&lt;BR /&gt; 81 &lt;BR /&gt; 82 number demand {DCs}=[&lt;BR /&gt; 83 3121515];&lt;BR /&gt; 84 &lt;BR /&gt; 85 number FixedCost {Factories, Crossdocks}= [&lt;BR /&gt; 86 500 650&lt;BR /&gt; 87 220 950&lt;BR /&gt; 88 200 800&lt;BR /&gt; 89 180&lt;BR /&gt; 90 ];&lt;BR /&gt; 91 number M = 1000000;&lt;BR /&gt; 92 number MaxUse {Crossdocks}=[374331];&lt;BR /&gt; 93 &lt;BR /&gt; 94 &lt;BR /&gt; 95 var inflow {Factories,Crossdocks} &amp;gt;= 0;&lt;BR /&gt; 96 var outflow {Crossdocks,DCs} &amp;gt;= 0;&lt;BR /&gt; 97 var Y {Factories,Crossdocks} binary;&lt;BR /&gt; 98 &lt;BR /&gt; 99 minimize Total_Cost= sum {j in Crossdocks}(sum{i in Factories}(inflow[i,j]*incost[i,j])+Y[i,j]*FixedCost[i,j])+sum{j in&lt;BR /&gt; _ _&lt;BR /&gt; 525 525&lt;BR /&gt; _ _&lt;BR /&gt; 621 621&lt;BR /&gt; 99 ! Crossdocks, k in DCs}outcost[j,k]*outflow[j,k];&lt;BR /&gt; &lt;FONT color="#FF0000"&gt;ERROR 525-782: The symbol 'i' is unknown.&lt;/FONT&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;FONT color="#FF0000"&gt; ERROR 621-782: Subscript 1 must be a string, found a number.&lt;/FONT&gt;&lt;BR /&gt; &lt;BR /&gt; 100 &lt;BR /&gt; 101 con Max_Supply {i in Factories} : sum {j in Crossdocks} inflow[i,j] &amp;lt;=capacity[i];&lt;BR /&gt; 102 con No_Stock {j in Crossdocks} : sum {i in Factories} inflow[i,j] = sum {k in DCs} outflow[j,k];&lt;BR /&gt; 103 con Min_Demand {k in DCs} : sum {j in Crossdocks} outflow[j,k] &amp;gt;=demand[k];&lt;BR /&gt; 104 con Max_Use{j in Crossdocks}: sum{i in Factories}inflow[i,j]&amp;lt;=MaxUse[j];&lt;BR /&gt; 105 con Inspections {j in Crossdocks}: sum{i in Factories}inflow[i,j]&amp;lt;=M*Y[j];&lt;BR /&gt; _&lt;BR /&gt; 618&lt;BR /&gt; &lt;FONT color="#FF0000"&gt;ERROR 618-782: The subscript count does not match array 'Y', 1 NE 2.&lt;/FONT&gt;&lt;BR /&gt; &lt;BR /&gt; 106 &lt;BR /&gt; 107 &lt;BR /&gt; 108 solve;&lt;BR /&gt; NOTE: Problem generation will use 2 threads.&lt;BR /&gt; NOTE: Previous errors might cause the problem to be resolved incorrectly.&lt;BR /&gt; &lt;FONT color="#FF0000"&gt;ERROR: The constraint 'Inspections' has an incomplete declaration.&lt;/FONT&gt;&lt;BR /&gt; NOTE: The problem has 36 variables (0 free, 0 fixed).&lt;BR /&gt; NOTE: The problem has 12 binary and 0 integer variables.&lt;BR /&gt; NOTE: The problem has 14 linear constraints (7 LE, 3 EQ, 4 GE, 0 range).&lt;BR /&gt; NOTE: The problem has 60 linear constraint coefficients.&lt;BR /&gt; NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).&lt;BR /&gt; NOTE: The OPTMODEL presolver is disabled for linear problems.&lt;BR /&gt; NOTE: Unable to create problem instance due to previous errors.&lt;BR /&gt; 109 &lt;BR /&gt; 110 print Total_Cost;&lt;BR /&gt; &lt;FONT color="#FF0000"&gt;ERROR: The symbol 'Total_Cost' has no value at line 110 column 7.&lt;/FONT&gt;&lt;BR /&gt; 111 print inflow;&lt;BR /&gt; 112 print outflow;&lt;BR /&gt; 113 &lt;BR /&gt; 114 quit;&lt;BR /&gt; NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt; NOTE: PROCEDURE OPTMODEL used (Total process time):&lt;BR /&gt; real time 0.05 seconds&lt;BR /&gt; user cpu time 0.06 seconds&lt;BR /&gt; system cpu time 0.00 seconds&lt;BR /&gt; memory 2308.37k&lt;BR /&gt; OS Memory 26784.00k&lt;BR /&gt; Timestamp 06/18/2017 09:56:02 PM&lt;BR /&gt; Step Count 8 Switch Count 270&lt;BR /&gt; Page Faults 0&lt;BR /&gt; Page Reclaims 1187&lt;BR /&gt; Page Swaps 0&lt;BR /&gt; Voluntary Context Switches 1129&lt;BR /&gt; Involuntary Context Switches 1&lt;BR /&gt; Block Input Operations 0&lt;BR /&gt; Block Output Operations 200&lt;BR /&gt; &lt;BR /&gt; 115 &lt;BR /&gt; 116 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;BR /&gt; 128&lt;/P&gt;</description>
      <pubDate>Sun, 18 Jun 2017 22:00:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Proc-Optmodel-Error-in-sum-statement/m-p/368110#M1880</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-06-18T22:00:20Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Optmodel Error in sum statement</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Proc-Optmodel-Error-in-sum-statement/m-p/368352#M1883</link>
      <description>&lt;P&gt;It looks like at least some of your errors are addressed by &lt;A href="https://communities.sas.com/t5/Mathematical-Optimization/Sas-Studio-Proc-Optmodel-Multi-part-constraint/m-p/319066/highlight/true#M1597" target="_self"&gt;this related thread&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 14:49:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Proc-Optmodel-Error-in-sum-statement/m-p/368352#M1883</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2017-06-19T14:49:11Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Optmodel Error in sum statement</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Proc-Optmodel-Error-in-sum-statement/m-p/368964#M1889</link>
      <description>&lt;P&gt;Dear Rob,&lt;/P&gt;&lt;P&gt;Thanks for your message.&lt;/P&gt;&lt;P&gt;I have removed number M as well as constraint :&lt;/P&gt;&lt;P&gt;con Inspections {j in Crossdocks} : sum {i in Factories} inflow[i,j] &amp;lt;=M * Y[j];&lt;/P&gt;&lt;P&gt;It seems to work well now. Please, can you have a final look and tell me if everything is fine? I am getting no more any error messages.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc optmodel;&lt;BR /&gt;&lt;BR /&gt;set Factories= {'Kansas','NorthCarolina','NewHampshire','SouthDakota'};&lt;BR /&gt;set DCs= {'Virginia','Missouri','California','Florida'};&lt;BR /&gt;set Crossdocks= {'Wisconsin','Minnesota', 'SouthCarolina'};&lt;BR /&gt;&lt;BR /&gt;number incost{Factories,Crossdocks}=[&lt;BR /&gt;36	26	31&lt;BR /&gt;43	28	48&lt;BR /&gt;37	44	42&lt;BR /&gt;32	28	30&lt;BR /&gt;];&lt;BR /&gt;&lt;BR /&gt;number outcost {Crossdocks,DCs}=[&lt;BR /&gt;37	29	15	26&lt;BR /&gt;30	42	40	20&lt;BR /&gt;16	27	46	42&lt;BR /&gt;];&lt;BR /&gt;&lt;BR /&gt;number capacity {Factories}=[&lt;BR /&gt;37	19	42	25];&lt;BR /&gt;&lt;BR /&gt;number demand {DCs}=[&lt;BR /&gt;3	12	15	15];&lt;BR /&gt;&lt;BR /&gt;number FixedCost {Factories,Crossdocks} = [500 220 200 180 650 950 800];&lt;BR /&gt;number MaxUse {Crossdocks} = [37 43	31];&lt;BR /&gt;&lt;BR /&gt;var inflow {Factories,Crossdocks} &amp;gt;= 0;&lt;BR /&gt;var outflow {Crossdocks,DCs} &amp;gt;= 0;&lt;BR /&gt;var Y {Factories,Crossdocks} binary;&lt;BR /&gt;&lt;BR /&gt;minimize TotalCost =sum {j in Crossdocks} ( sum {i in Factories} ( inflow[i,j]*incost[i,j] + Y[i,j]*FixedCost[i,j] )+sum {j in Crossdocks,k in DCs} outcost[j,k]*outflow[j,k]);&lt;BR /&gt;&lt;BR /&gt;con Max_Supply {i in Factories} : sum {j in Crossdocks} inflow[i,j] &amp;lt;=capacity[i];&lt;BR /&gt;con No_Stock {j in Crossdocks} : sum {i in Factories} inflow[i,j] = sum {k in DCs} outflow[j,k];&lt;BR /&gt;con Min_Demand {k in DCs} : sum {j in Crossdocks} outflow[j,k] &amp;gt;=demand[k];&lt;BR /&gt;con Max_Use{j in Crossdocks} : sum {i in Factories} inflow[i,j] &amp;lt;=MaxUse[j];&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;solve;&lt;BR /&gt;print inflow outflow TotalCost;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2017 22:01:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Proc-Optmodel-Error-in-sum-statement/m-p/368964#M1889</guid>
      <dc:creator>jfm00</dc:creator>
      <dc:date>2017-06-20T22:01:53Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Optmodel Error in sum statement</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Proc-Optmodel-Error-in-sum-statement/m-p/368972#M1890</link>
      <description>&lt;P&gt;I still see a few issues:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Either remove the second occurrence of "j in Crossdocks" in the objective or adjust your parentheses.&lt;/LI&gt;
&lt;LI&gt;FixedCost is declared over 12 elements but has only 7 values. &amp;nbsp;Use "print FixedCost;" to see what you declared. &amp;nbsp;I think you instead want two different sets of fixed cost parameters: one for Factories and one for Crossdocks.&lt;/LI&gt;
&lt;LI&gt;The Y variable appears only in the objective and not in any of the constraints. &amp;nbsp;In that case, the presolver will just set Y = 0. &amp;nbsp;As in issue #2, I think you want two different sets of fixed cost variables.&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Tue, 20 Jun 2017 23:36:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Proc-Optmodel-Error-in-sum-statement/m-p/368972#M1890</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2017-06-20T23:36:20Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Optmodel Error in sum statement</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Proc-Optmodel-Error-in-sum-statement/m-p/369278#M1891</link>
      <description>&lt;P&gt;I have created 2 sets of fixed costs, T and Y.&lt;/P&gt;&lt;P&gt;Still T and Y do not appear in my constraints.&lt;/P&gt;&lt;P&gt;Should they appear? If Yes, how?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc optmodel;&lt;BR /&gt;&lt;BR /&gt;set Factories= {'Kansas','NorthCarolina','NewHampshire','SouthDakota'};&lt;BR /&gt;set DCs= {'Virginia','Missouri','California','Florida'};&lt;BR /&gt;set Crossdocks= {'Wisconsin','Minnesota', 'SouthCarolina'};&lt;BR /&gt;&lt;BR /&gt;number incost{Factories,Crossdocks}=[&lt;BR /&gt;36	26	31&lt;BR /&gt;43	28	48&lt;BR /&gt;37	44	42&lt;BR /&gt;32	28	30&lt;BR /&gt;];&lt;BR /&gt;&lt;BR /&gt;number outcost {Crossdocks,DCs}=[&lt;BR /&gt;37	29	15	26&lt;BR /&gt;30	42	40	20&lt;BR /&gt;16	27	46	42&lt;BR /&gt;];&lt;BR /&gt;&lt;BR /&gt;number capacity {Factories}=[&lt;BR /&gt;37	19	42	25];&lt;BR /&gt;&lt;BR /&gt;number demand {DCs}=[&lt;BR /&gt;3	12	15	15];&lt;BR /&gt;&lt;BR /&gt;number ProdCost {Factories} = [500 220 200 180];&lt;BR /&gt;number FixedCost {Crossdocks} = [650 950 800];&lt;BR /&gt;number MaxUse {Crossdocks} = [37 43	31];&lt;BR /&gt;&lt;BR /&gt;var inflow {Factories,Crossdocks} &amp;gt;= 0;&lt;BR /&gt;var outflow {Crossdocks,DCs} &amp;gt;= 0;&lt;BR /&gt;var T {Factories} binary;&lt;BR /&gt;var Y {Crossdocks} binary;&lt;BR /&gt;&lt;BR /&gt;minimize TotalCost =sum {j in Crossdocks} ( sum {i in Factories} ( inflow[i,j]*incost[i,j] + Y[j]*FixedCost[j]+T[i]*ProdCost[i] )+sum {j in Crossdocks,k in DCs} outcost[j,k]*outflow[j,k]);&lt;BR /&gt;&lt;BR /&gt;con Max_Supply {i in Factories} : sum {j in Crossdocks} inflow[i,j] &amp;lt;=capacity[i];&lt;BR /&gt;con No_Stock {j in Crossdocks} : sum {i in Factories} inflow[i,j] = sum {k in DCs} outflow[j,k];&lt;BR /&gt;con Min_Demand {k in DCs} : sum {j in Crossdocks} outflow[j,k] &amp;gt;=demand[k];&lt;BR /&gt;con Max_Use{j in Crossdocks} : sum {i in Factories} inflow[i,j] &amp;lt;=MaxUse[j];&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;solve;&lt;BR /&gt;print inflow outflow TotalCost;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Jun 2017 19:04:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Proc-Optmodel-Error-in-sum-statement/m-p/369278#M1891</guid>
      <dc:creator>jfm00</dc:creator>
      <dc:date>2017-06-21T19:04:41Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Optmodel Error in sum statement</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Proc-Optmodel-Error-in-sum-statement/m-p/369295#M1892</link>
      <description>&lt;P&gt;Here, I have created 2 sets of fixed costs, and also 2 constraints with number M.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code runs OK, but is it correct?&lt;/P&gt;&lt;P&gt;Thanks for your input.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc optmodel;&lt;BR /&gt;&lt;BR /&gt;set Factories= {'Kansas','NorthCarolina','NewHampshire','SouthDakota'};&lt;BR /&gt;set DCs= {'Virginia','Missouri','California','Florida'};&lt;BR /&gt;set Crossdocks= {'Wisconsin','Minnesota', 'SouthCarolina'};&lt;BR /&gt;&lt;BR /&gt;number incost{Factories,Crossdocks}=[&lt;BR /&gt;36	26	31&lt;BR /&gt;43	28	48&lt;BR /&gt;37	44	42&lt;BR /&gt;32	28	30&lt;BR /&gt;];&lt;BR /&gt;&lt;BR /&gt;number outcost {Crossdocks,DCs}=[&lt;BR /&gt;37	29	15	26&lt;BR /&gt;30	42	40	20&lt;BR /&gt;16	27	46	42&lt;BR /&gt;];&lt;BR /&gt;&lt;BR /&gt;number capacity {Factories}=[&lt;BR /&gt;37	19	42	25];&lt;BR /&gt;&lt;BR /&gt;number demand {DCs}=[&lt;BR /&gt;3	12	15	15];&lt;BR /&gt;&lt;BR /&gt;number ProdCost {Factories} = [500 220 200 180];&lt;BR /&gt;number FixedCost {Crossdocks} = [650 950 800];&lt;BR /&gt;number MaxUse {Crossdocks} = [37 43	31];&lt;BR /&gt;number M=1000000;&lt;BR /&gt;&lt;BR /&gt;var inflow {Factories,Crossdocks} &amp;gt;= 0;&lt;BR /&gt;var outflow {Crossdocks,DCs} &amp;gt;= 0;&lt;BR /&gt;var T {Factories} binary;&lt;BR /&gt;var Y {Crossdocks} binary;&lt;BR /&gt;&lt;BR /&gt;minimize TotalCost =sum {j in Crossdocks} ( sum {i in Factories} ( inflow[i,j]*incost[i,j] + Y[j]*FixedCost[j]+T[i]*ProdCost[i] )+sum {k in DCs} outcost[j,k]*outflow[j,k]);&lt;BR /&gt;&lt;BR /&gt;con Max_Supply {i in Factories} : sum {j in Crossdocks} inflow[i,j] &amp;lt;=capacity[i];&lt;BR /&gt;con No_Stock {j in Crossdocks} : sum {i in Factories} inflow[i,j] = sum {k in DCs} outflow[j,k];&lt;BR /&gt;con Min_Demand {k in DCs} : sum {j in Crossdocks} outflow[j,k] &amp;gt;=demand[k];&lt;BR /&gt;con Max_Use{j in Crossdocks} : sum {i in Factories} inflow[i,j] &amp;lt;=MaxUse[j];&lt;BR /&gt;con Inspections {j in Crossdocks} : sum {i in Factories} inflow[i,j] &amp;lt;= M*Y[j];&lt;BR /&gt;con Facost {i in Factories}: sum {j in Crossdocks}inflow[i,j]&amp;lt;= M*T[i];&lt;BR /&gt;&lt;BR /&gt;solve;&lt;BR /&gt;print inflow outflow TotalCost;&lt;BR /&gt;quit;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Jun 2017 19:44:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Proc-Optmodel-Error-in-sum-statement/m-p/369295#M1892</guid>
      <dc:creator>jfm00</dc:creator>
      <dc:date>2017-06-21T19:44:26Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Optmodel Error in sum statement</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Proc-Optmodel-Error-in-sum-statement/m-p/369309#M1893</link>
      <description>&lt;P&gt;Yes, that is the right idea. &amp;nbsp;But you do not need (and should not use) a large value for M, which can cause numerical difficulties. &amp;nbsp;Instead, you can avoid introducing M and the new constraints by modifying the existing Max_Supply and Max_Use constraints. &amp;nbsp;In that case, capacity[i] and MaxUse[j] will play the roles of M.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 19:54:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Proc-Optmodel-Error-in-sum-statement/m-p/369309#M1893</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2017-06-21T19:54:52Z</dc:date>
    </item>
  </channel>
</rss>

