I can't share the data as it has confidential production information. Below is the code. My issue was that I could not do a constraint by p,k,t unless every array and all the p,k,t entries in. When I added all the entries to each table, SAS would put values in the undefined vars to reduce cost. So, then I added the constraint to make those be zero. When I have arrays with many more index values and sum on a lesser number of indexes, no problem. but when the indexes have the same index, it will not let me have arrays that don't have all the indexed items. Not sure why. This is a huge model, but I know this is my issue as without these constraints it will solve in less than 10 minutes vs over 60 minutes with these constraints. Thanks for any help you can provide. Roger * Set up FIFO logic; * Load Beg Inv and the time period it must ship out by; set <str,str,num> ixFFTP; num FFBIO{ixFFTP}; read data scomdata.FFBImins into ixFFTP=[plt sku tp] FFBIO=cwt; * Define the vars for FIFO - Note the indexes must be in sync or the constraints will fail; var FFTSO{ixFFTP} >= 0 init 0; var FFPKO{ixFFTP} >= 0 init 0; var FFTPO{ixFFTP} >= 0 init 0; var FFTDO{ixFFTP} >= 0 init 0; var FFTPC{ixFFTP} >= 0 init 0; var FFTDC{ixFFTP} >= 0 init 0; var FFDX{ixFFTP} >= 0 init 0; * When inventory arrives at a warehouse, when must it ship out by; set <str,str,num,num> ixFFTSO; read data scomdata.inFFTSO into ixFFTSO=[plt sku tp tpo]; con CTSO {<p,k,tp,tpo> in ixFFTSO} : sum{<(k),f,fic,m,po,(p),(tp)> in ixTS} TS[k,f,fic,m,po,p,tp] - FFTSO[p,k,tpo] = 0; * If a product is packaged into a new product, when must the new product leave by; set <str,str,num,num> ixFFPKO; read data scomdata.inFFPKO into ixFFPKO=[plt sku tp tpo]; con CPKO {<p,k,tp,tpo> in ixFFPKO} : sum{<ki,(k),w,pl,(p),(tp)> in ixPK} PK[ki,k,w,pl,p,tp] - FFPKO[p,k,tpo] = 0; * Load the time period minimum values that must be moved out in one bucket; con CTPO {<p,k,t> in ixFFTP} : FFBIO[p,k,t] + FFTSO[p,k,t] + FFPKO[p,k,t] = FFTPO[p,k,t]; * Compute a todate value for each of the periods on what must move by said tp; * In FFTD1 time period t always = 1; set <str,str,num> FFTD1; read data scomdata.FFTD1 into FFTD1=[plt sku tp]; con CTDO1 {<p,k,t> in FFTD1} : FFTPO[p,k,t] = FFTDO[p,k,t]; * In FFTDx t = 2 to number of time periods; set <str,str,num> FFTDx; read data scomdata.FFTDx into FFTDx=[plt sku tp]; con CTDO2 {<p,k,t> in FFTDX} : FFTPO[p,k,t] + FFTDO[p,k,t-1] - FFTDO[p,k,t] = 0; * Load FIFO Consumption criteria; * How much product was delivered to customers from this plant; var FFS1C{ixFFTP} >= 0 init 0; set <str,str,num> FFS1Cx; * For p,k,t where there are no delivered shipments set the values to zero; read data scomdata.FFS1Cx into FFS1Cx=[plt sku tp]; set <str,str,num> FFS1Cz; * For p,k,t where there are no pickup shipments set the values to zero; read data scomdata.FFS1Cz into FFS1Cz=[plt sku tp]; * How much product was picked up by customers at this plant; var FFS2C{ixFFTP} >= 0 init 0; set <str,str,num> FFS2Cx; read data scomdata.FFS2Cx into FFS2Cx=[plt sku tp]; * For p,k,t where there are no pickup shipments set the values to zero; set <str,str,num> FFS2Cz; read data scomdata.FFS2Cz into FFS2Cz=[plt sku tp]; * How much product left this plant to go to another plant; var FFTSC{ixFFTP} >= 0 init 0; set <str,str,num> FFTSCx; read data scomdata.FFTSCx into FFTSCx=[plt sku tp]; * For p,k,t where there are no trans ships set the values to zero; set <str,str,num> FFTSCz; * How much of of this product was consumed by time period to make another product; read data scomdata.FFTSCz into FFTSCz=[plt sku tp]; var FFPKC{ixFFTP} >= 0 init 0; set <str,str,num> FFPKCx; read data scomdata.FFPKCx into FFPKCx=[plt sku tp]; * For p,k,t where not packaging consumption set the values to zero; set <str,str,num> FFPKCz; read data scomdata.FFPKCz into FFPKCz=[plt sku tp]; * Load Customer Delivered Shipments into Consumption; con CS1C {<p,k,t> in FFS1Cx} : sum{<(k),f,fic,c,(p),m,(t)> in ixS1} S1[k,f,fic,c,p,m,t] = FFS1C[p,k,t]; * Constain zero nodes to zero; con CS1Z {<p,k,t> in FFS1Cz} : FFS1C[p,k,t] = 0; * Load Customer Pickup Shipments into Consumption; con CS2C {<p,k,t> in FFS2Cx} : sum{<(k),f,fic,c,(p),m,(t)> in ixS2} S2[k,f,fic,c,p,m,t] = FFS2C[p,k,t]; * Constain zero nodes to zero; con CS2Z {<p,k,t> in FFS2Cz} : FFS2C[p,k,t] = 0; * Load Outbound Transport Orders into Consumption; con CTSC {<p,k,t> in FFTSCx} : sum{<(k),f,fic,m,(p),p2,(t)> in ixTS} TS[k,f,fic,m,p,p2,t] = FFTSC[p,k,t]; * Constain zero nodes to zero; con CTSZ {<p,k,t> in FFTSCz} : FFTSC[p,k,t] = 0; * Load Packaging Consumption; con CPKC {<p,k,t> in FFPKCx} : sum{<(k),k2,w,pl,(p),(t)> in ixPK} PK[k,k2,w,pl,p,t] = FFPKC[p,k,t]; * Constain zero nodes to zero; con CPKZ {<p,k,t> in FFPKCz} : FFPKC[p,k,t] = 0; * Load all the consumption into each of the period values; con CTPC {<p,k,t> in ixFFTP} : FFS1C[p,k,t] + FFS2C[p,k,t] + FFTSC[p,k,t] + FFPKC[p,k,t] = FFTPC[p,k,t]; * Add the periods together to get a ytd amount that must be shipped; * Compute a todate value for each of the periods on what must move by said date; * In FFTD1 time period t always = 1; con CTDC1 {<p,k,t> in FFTD1} : FFTPC[p,k,t] = FFTDC[p,k,t] ; * In FFTDx t = 2 to ntp; con CTDC2{<p,k,t> in FFTDX} : FFTPC[p,k,t] + FFTDC[p,k,t-1] = FFTDC[p,k,t]; * Monthly FIFO constraint, FFDX will be a high cost valve to avoid infeasibility; con CFFD{<p,k,t> in ixFFTP} : FFTDC[p,k,t] + FFDX[p,k,t] >= FFTDO[p,k,t];
... View more