Home | Research Interests | Publications | Positions | Personal | Models | Seminar Abstracts | Powerpoint Talks
 

 

» Agprice
» Constraint
» Curve
» Decent
  Distrib
» Economy
» Efficient
» Factory
» Farm
» Food
» Hydro
» Logic
» Manpower
» Market
» Milk
» Mining
» OandX
» Opencast
» Refinery
» Tariff
» TSP
» Yield
 

Model Distrib

  MODEL DISTRIB
  SET
   

nfact = {1 .. 2},

! factories
   

ndeps = {1 .. 4},

! depots
   

ncust = {1 .. 6};

! customers
  DATA
    costftod[nfact,ndeps] = [0.5,0.5,1,0.2,
   

 

0,0.3,0.5,0.2], ! factory to depot unit costs
    costftoc[nfact,ncust] = [1,0,1.5,2,0,1,
   

 

2,0,0,0,0,0], ! factory to customer unit costs
    costdtoc[ndeps,ncust] = [0,1.5,0.5,1.5,0,1,
      1,0.5,0.5,1,0.5,0,
      0,1.5,2,0,0.5,1.5,
      0,0,0.2,1.5,0.5,1.5], ! depot to customer unit costs
   

prefftoc[nfact,ncust] =

[0,1,1,1,1,1,1,1,1,1,1,1], ! preferred factories for each customer (0=preferred)
    prefdtoc[ndeps,ncust] = [1,0,1,1,1,1,
      1,1,1,1,0,1,
      1,1,1,1,1,0,
   

 

1,1,1,1,1,0], ! preferred depots for each customer (0=preferred)
   

factcap[nfact] =

[150,200], ! factory capacities (k tons)
   

depcap[ndeps] =

[70,50,100,40], ! depot capacities ( k tons)
   

custreq[ncust] =

[50,10,40,35,60,20]; ! customer requirements ( k tons)
  VARIABLES
   

ftod[nfact,ndeps],

  ! quantity factory to depot ( k tons)
   

ftoc[nfact,ncust],

  ! quantity factory to customer ( k tons)
   

dtoc[ndeps,ncust];

  ! quantity depot to customer ( k tons)
  OBJECTIVE
 
 

MINIMIZE cost = sum{i in nfact, j in ndeps} costftod[i,j]*ftod[i,j] + sum{i in nfact, k in ncust} costftoc[i,k]*ftoc[i,k] + sum{j in ndeps, k in ncust} costdtoc[j,k]*dtoc[j,k];

 
 

! MINIMZE pref = sum{i in nfact, k in ncust} prefftoc[i,k]*ftoc[i,k] + sum{j in ndeps, k in ncust} prefdtoc[j,k]*dtoc[j,k];

  CONSTRAINTS
   

fcap{i in nfact} : sum{j in ndeps} ftod[i,j] + sum{k in ncust} ftoc[i,k] <= factcap[i],

! factory capacities
   

dcap{j in ndeps} : sum{i in nfact} ftod[i,j] <= depcap[j],

! depot capacities
   

dcont{j in ndeps} : sum{k in ncust} dtoc[j,k] - sum{i in nfact} ftod[i,j] = 0,

! continuity at depots
   

creq{k in ncust} : sum{i in nfact} ftoc[i,k] + sum{j in ndeps} dtoc[j,k] = custreq[k],

! customer requirements
   

bounds : ftod[2,1] = 0,

! block out non allowed routes
   

bounds : ftoc[1,2] = 0,

   

bounds : ftoc[1,5] = 0,

   

bounds : ftoc[2,2] = 0,

   

bounds : ftoc[2,3] = 0,

   

bounds : ftoc[2,4] = 0,

   

bounds : ftoc[2,5] = 0,

   

bounds : ftoc[2,6] = 0,

   

bounds : dtoc[1,1] = 0,

   

bounds : dtoc[1,5] = 0,

   

bounds : dtoc[2,6] = 0,

   

bounds : dtoc[3,1] = 0,

   

bounds : dtoc[3,4] = 0,

   

bounds : dtoc[4,1] = 0,

   

bounds : dtoc[4,2] = 0;

  END MODEL
   

solve Distrib;

   

print solution for Distrib >> "Distrib.sol";

   

quit;

 
   
  MODEL Depot
  SET
   

set1 = {1 .. 1},

   

set2 = {4 .. 6},

   

nfact = {1 .. 2},

! factories, Liverpool, Birmingham
   

ndeps = {1 .. 6},

! depots, Newcastle, Birmingham, London, Exeter, Bristol, Northampton
   

ncust = {1 .. 6};

! customers
  DATA
    costftod[nfact,ndeps] = [0.5,0.5,1,0.2,0.6,0.4, ! factory to depot
   

 

0,0.3,0.5,0.2,0.4,0.3], ! unit costs
    costftoc[nfact,ncust] = [1,0,1.5,2,0,1, ! factory to customer
   

 

2,0,0,0,0,0], ! unit costs
   

costdtoc[ndeps,ncust] << "dtocfile.dat",

 
   

factcap[nfact] =

[150,200], ! factory capacities (k tons)
   

depcap[ndeps] =

[70,20,100,40,30,25], ! depot capacities ( k tons)
   

fixcost[ndeps] =

[10,3,0,5,12,4], ! costs (£k) of opening depots (Birmingham expansion, Newcastle & Exeter retaining)
   

custreq[ncust] =

[50,10,40,35,60,20]; ! customer requirements (k tons)
  VARIABLES
   

ftod[nfact,ndeps],

  ! factory to depot quantities ( k tons)
   

ftoc[nfact,ncust],

  ! factory to customer quantities ( k tons)
   

dtoc[ndeps,ncust],

  ! depot to customer quantities ( k tons)
   

delta[ndeps] integer;

  ! 0-1 variable indicating opening/expanding/retaining
  OBJECTIVE
 

 

MINIMIZE cost = sum{i in nfact, j in ndeps} (costftod[i,j]*ftod[i,j]) + sum{i in nfact, k in ncust} (costftoc[i,k]*ftoc[i,k]) + sum{j in ndeps, k in ncust} (costdtoc[j,k]*dtoc[j,k]) + sum{j in ndeps} (fixcost[j]*delta[j]); ! objective + 1.5 (000) (Newcastle and Exeter costs)
  CONSTRAINTS ! constraints as in Distrib
   

fcap{i in nfact} : sum{j in ndeps} (ftod[i,j]) + sum{k in ncust} ftoc[i,k] <= factcap[i],

   

dcap1{j in set1} : sum{i in nfact} (ftod[i,j])-depcap[j]*delta[j] <= 0,

   

dcap2{j in set2} : sum{i in nfact} (ftod[i,j])-depcap[j]*delta[j] <= 0,

   

dcap3 : sum{i in nfact} (ftod[i,2]) - depcap[2]*delta[2] <= 50,

   

dcap4 : sum{i in nfact} (ftod[i,3]) <= depcap[3],

   

dcont{j in ndeps} : sum{k in ncust} (dtoc[j,k]) - sum{i in nfact} (ftod[i,j]) = 0,

   

creq{k in ncust} : sum{i in nfact} (ftoc[i,k]) + sum{j in ndeps}

   

dtoc[j,k] = custreq[k],

   

numb1 : sum{j in set1} delta[j] <= 2,

!
   

numb2 : sum{j in set2} delta[j] <= 2,

! no more than 4 depots (Birmingham and London remain)
   

bounds : ftod[2,1] = 0,

! non-allowed routes
   

bounds : ftoc[1,2] = 0,

   

bounds : ftoc[1,5] = 0,

   

bounds : ftoc[2,2] = 0,

   

bounds : ftoc[2,3] = 0,

   

bounds : ftoc[2,4] = 0,

   

bounds : ftoc[2,5] = 0,

   

bounds : ftoc[2,6] = 0,

   

bounds : dtoc[1,1] = 0,

   

bounds : dtoc[1,5] = 0,

   

bounds : dtoc[2,6] = 0,

   

bounds : dtoc[3,1] = 0,

   

bounds : dtoc[3,4] = 0,

   

bounds : dtoc[4,1] = 0,

   

bounds : dtoc[4,2] = 0,

   

bounds : dtoc[5,4] = 0,

   

bounds : dtoc[6,1] = 0,

   

bounds : dtoc[6,3] = 0,

   

bounds{j in nfact} : delta[j] <= 1,

   

bounds{j in set2} : delta[j] <= 1;

  END MODEL
   

solve Depot;

   

print solution for Depot >> "Depot.sol";

   

quit;


  dtocfile.dat
  [0,1.5,0.5,1.5,0,1,
  1,0.5,0.5,1,0.5,0,
  0,1.5,2,0,0.5,1.5,
  0,0,0.2,1.5,0.5,1.5,
  1.2,0.6,0.4,0,0.3,0.8,
  0,0.4,0,0.5,0.6,0.9]

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 

 

 

 

 

 

 

 

 

 
         
 
Site updated December 2021 | email: h.p.williams@lse.ac.uk