MODEL:
 ! Two level blending or pooling model(POOLINGR.lg4).
   Raw materials are selectively blended into pools,
   then pools are blended into finished products.
    We want to maximize the profit = sales of finished goods,
   minus cost of raw materials purchased,
    subject to satisfying the quality requirements
   of each finished good;
 ! Keywords: Blending, Pooling, Petroleum refining;
SETS:
 ! Each raw material has an availability and cost/unit;
   RM : A, COST;

 ! There are a set of intermediate pools, e.g., storage tanks;
   POOL: BP ;
 ! Each finished good has a min required, max sellable,pro-
   fit contribution/unit and batch size to be determined;
   FG: D, E, PRICE, BF;

  ! There are a set of quality measures;
   QM;

  ! For each combo of RM and QM there is a quality level;
   RXQ( RM, QM): QL;

  ! For each combo QM, FG there are upper and lower limits
   on quality, and slack on upper quality to be determined;
   QXF( QM, FG): U, L, S;

  ! For each combination of Pool and quality level, there is
     a quality level to be determined;
   PXQ( POOL, QM): QP;

  ! Set of which RM can go into which POOL;
   RXP( RM, POOL): R2P;

  ! Set of which POOL can go into which FG;
   PXF( POOL, FG): P2F;
 ENDSETS
DATA: RM= RMA RMB RMC; ! Set of raw materials; A = 9999 9999 9999; ! Raw matl availabilities; COST = 6 16 10; ! R. M. costs; QM = SULFUR; ! Set of qualities; QL = .03 .01 .02; ! Quality by R.M.; FG = FGX FGY; D = 0, 0; ! Min needed of each F.G.; E = 100 200; ! Max sellable of each F.G; PRICE= 9 15; ! Selling price of each F.G.; U = .025 .015; ! Upper limits on quality for each FG.; L = 0 0 ; ! Lower limits on quality...; POOL = POOLAB POOLC; ! The names of the pools; ! Which R.M. can go into which POOLS; RXP= RMA POOLAB RMB POOLAB RMC POOLC; ! Which pools go into which F.G.; PXF = POOLAB FGX POOLAB FGY POOLC FGX POOLC FGY; ! This data set has several local optima: ! Local optimum 1: Obj = 0, Do not buy or sell anything, BP( ) = BF( ) = 0, Local optimum 2: Obj = 300, R2P( RMA, POOLAB) = 50.0000 R2P( RMB, POOLAB) = 150.0000 R2P( RMC, POOLC) = 0.0000 P2F( POOLAB, FGX) = 0.0000 P2F( POOLAB, FGY) = 200.0000 QP( POOLAB, SULFUR)= 0.0150 Local optimum 3 (Global): Obj = 400, R2P( RMA, POOLAB) = 0.0000 R2P( RMB, POOLAB) = 100.0000 R2P( RMC, POOLC) = 100.0000 P2F( POOLAB, FGX) = 0.0000 P2F( POOLAB, FGY) = 100.0000 P2F( POOLC, FGX) = 0.0000 P2F( POOLC, FGY) = 100.0000 QP( POOLAB, SULFUR)= 0.0100 QP( POOLC, SULFUR) = 0.0200 ; ENDDATA !---------------------------------------------------------------; ! Variables: R2P(r,p) = amount of raw material r transferred to pool p, P2F(p,f) = amount of material transferred from pool p to finished good f, QP(p,q) = level of quality q (e.g., fraction sulfur) in pool p, BP(p) = batch size (or amount in) of pool p, BF(f) = batch size (or amount in) of finished good f; ! The model; ! Max revenues - cost of raw materials; [PROFIT] MAX = @SUM( FG(f): PRICE(f) * BF(f)) - @SUM( RXP(r, p): COST( r)*R2P( r, p)); ! Raw materials stage: raw material availabilities; @FOR( RM( r): [RMLIM] @SUM( RXP(r, f): R2P( r, f)) <= A( r); ); ! Pools stage; @FOR( POOL(p): ! How much ( the batch size) is in each pool; [INPOOLI] BP(p) = @SUM( RXP(r,p): R2P(r,p)); [INPOOLO] BP(p) = @SUM( PXF(p,f): P2F(p,f)); ! The quality level, QP(p,q), of each pool. The model is nonlinear and nonconvex because of the product terms QP( p, q) * BP( p); @FOR( QM( q): [QPOOL] QP( p, q)* BP( p) = @SUM( RXP(r,p): QL(r,q)*R2P(r,p)); ); ); ! Finished goods stage; @FOR( FG( f): ! Batch size computation; [BDEFO] BF( f) = @SUM( POOL( p): P2F( p, f)); ! Batch size limits; [BLO] BF( f) >= D( f); [BHI] BF( f) <= E( f); ! Quality restrictions for each quality q, The model is nonlinear and nonconvex because of the product terms QP( p, q) * P2F( p, f); @FOR( QM( q): [QUP] @SUM( POOL( p): QP( p, q) * P2F( p, f)) + S( q, f) = U( q, f) * BF( f); [QDN] S( q, f) <= ( U( q, f) - L( q, f)) * BF( f); ); ); END