#sets
param f; #facility sites param r; #retailer param c; # customer param t; #time #Parameters #manufacturing sites parameters param ci; #Weekly production capacity of facility ; param ui; #Production cost at manufacture site per unit. param fi; #Weekly facility cost in each facility ; param gi; #Weekly operating cost in each facility ; #transportation parameters param dij{i in 1..f,j in 1..r}; #The distance between manufacture site and retail store , param djk{j in 1..r,k in 1..c}; #The distance between retail store and customer zone , param aij; #Transportation cost from manufacture site to retail store (per mile) param ajk; #Transportation cost from retail store to customer zone , (per mile) param bij; #Fixed cost of each vehicle commute between manufacture site to retail store param bjk; #Fixed cost of each vehicle commute between retail store and customer zone ; param eij; #The capacity of each vehicle commute between manufacture site to retail store param ejk; #The capacity of each vehicle commute between retail store and customer zone ; #Retail store parameters param o1; #Inventory holding cost retail store in period param h1; #The cost of shortage at customer zone at period param h2; #Weekly store cost at retail store ; param h3; #Weekly operating cost in each district j; param B; #Demand of customer zone param N; #The capacity of each retail store at period param lj; #Minimum sales required (unit/day) for retail store at period #Decision Variables #continuous var x{i in 1..f,j in 1..r,k in 1..t}; #Total quantity of products shipped from manufacture site to retail store at period var w{j in 1..r, k in 1..c, l in 1..t}; #Total quantity of products shipped from retail store to customer zone at period var s{j in 1..r, k in 1..t}; #The amount of units stocked in the inventory of retail store at the at period #integers var E{i in 1..f,j in 1..r} integer >= 1; var q1{j in 1..r,k in 1..c} integer >= 1; #binary var y{i in 1..f}binary; #open facility var oi{i in 1..f}binary; # if facility is opened var z{j in 1..r}binary; #open retailer var rj{j in 1..r,i in 1..r}binary; #if retail store is opened #Objective minimize total_cost: sum{i in 1..f} fi*y[i] + sum{i in 1..f} gi* + sum{j in 1..r} h2*z[j] + sum{j in 1..r} h3 + sum{k in 1..t,i in 1..f,j in 1..r} dij[i][j][k]*aij*E[i][j] + sum{l in 1..t,j in 1..r,k in 1..k} ajk*djk*q1 + sum{k in 1..t,i in 1..f,j in 1..r} bij*eij + sum{i in 1..t, j in 1..r,k in 1..c} bjk*q1 + sum{k in 1..t,i in 1..f,j in 1..r} ui*x[i][j][t] + sum{k in 1..t, j in 1..r} o1 * s + sum { in 1..t,k in 1..c} ; #Constraints subject to only_open_hubs{i in 1..r,j in 1..r}: x[i,j] <= y[i]; subject to supply_retailstore{j in 1..r,i in 1..c,k in 1..t}: w[j,k,t] >= B; subject to mincapacity_retailstore { i in 1..r,j in 1..c,k in 1..t}: w[k] <= N*rj[j][i]; subject to Maxcapacity_retailstore {i in 1..r,j in 1..c,k in 1..t}: w[k] >= lj *rj[j][i]; subject to Retailstore_limit{j in 1..r}: rj[j][i] <= z ; subject to Amountunits_stocked {i in 1..c,j in 1..r,k in 1..t}: s[j][k]-1 + sum{i in 1..f}x[i][j][k] - sum[i]* w[i][j][k] = s[j][k]; subject to stocked_1to7 {j in 1..r,k in 1..t}: s[j][k=1] = s[j][k=7]; subject to Facilityprod_capacity {i in 1..f}: sum{k in 1..t,j in 1..r}x[i][j] <= ci * oi; subject to Facility_limit{i in 1..f}: oi[i] <= y[i]; subject to Vehicles_facility{i in 1..f,j in 1..r, t in 1..t} : x[i][j][t] <= E[i][j][t] * eij; subject to vehices_retailer{ j in 1..r,k in 1..c, t in 1..t} : w[j][k][t] <= ejk * q1[j][k]; subject to mbignumber{ i in 1..f,j in 1..r,t in 1..t}: E[i][j] <= 1000 * oi[i]; subject to mbignumber1{ i in 1..f,j in 1..r,t in 1..t}: E[i][j] <= 1000 * rj[i]; subject to mbignumber2{ j in 1..r,k in 1..c,t in 1..t}: q1[j][k] <= 1000 * rj[j]; subject to greaterthan0{i in 1..f,j in 1..r,k in 1..c,t in 1..t}: x[i][j][t] and w[j][k][y][t] and s[j][t] >=0 ; -- Sent from: http://ampl.996311.n3.nabble.com/ -- You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/ampl. For more options, visit https://groups.google.com/d/optout. |
So you have declared
-- param dij{i in 1..f,j in 1..r}; but access as dij[i][j][k]. dij is a two dimensional param and you need to access as d[i,j]. Same thing is happening with rj. You are accessing as rj[j][i], but it should be rj[j,i]. There should not be braces after each index in AMPL, rather all indcies should be within a single braces [...]. Thanks, Paras On Saturday, December 2, 2017 at 8:45:32 PM UTC-8, yudhisthir patil wrote: #sets You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email]. Visit this group at https://groups.google.com/group/ampl. For more options, visit https://groups.google.com/d/optout. |
Free forum by Nabble | Edit this page |