MODEL:
 ! Capacitated Plant Location Problem;
 ! Keywords: Capacitated plant location, Fixed charge, P median, Plant Location, Transportation problem ;
SETS:
    PLANT : FCOST, CAP, OPEN;
    CUSTOMER : DEM;
    ARCS( PLANT, CUSTOMER)  : COST, VOL;
 ENDSETS
DATA: ! There is a set of candidate plants; PLANT = P1 P2 P3; ! Fixed cost of opening a plant at each origin; FCOST = 91, 70, 24; ! Capacities at each origin; CAP = 39, 35, 31; ! There is a set of customers to be served; CUSTOMER = C1 C2 C3 C4; ! Demands at each destination; DEM = 15, 17, 22, 12; ! The cost/unit shipment matrix from Plant to Customer; COST = 6, 2, 6, 7, 4, 9, 5, 3, 8, 8, 1, 5; NPOPEN = 2; !Max plants allowed open; ENDDATA ! Variables: OPEN( I) = 1 is PLANT I is used (or open), else 0, i.e., it is a binary variable, VOL( I, J) = amount shipped from PLANT I to CUSTOMER J; ! Minimize sum of Fixed + Shipping costs; [TTL_COST] MIN = FCTOT + SCTOT; SCTOT = @SUM( ARCS( I, J): COST( I, J) * VOL( I, J)); FCTOT = @SUM( PLANT( I) : FCOST( I) * OPEN( I) ); ! Must satisfy demand at Customer J; @FOR( CUSTOMER( J): [DEMAND] @SUM( PLANT( I): VOL( I, J)) >= DEM( J) ); ! Cannot ship more than installed capacity from PLANT I; @FOR( PLANT( I): [SUPPLY] @SUM( CUSTOMER( J): VOL( I, J)) <= CAP( I) * OPEN( I); ! Make OPEN binary(0/1); @BIN( OPEN( I)); ); ! Maximum number of plants open; @SUM( PLANT(I): OPEN(I)) <= NPOPEN; END