Lindo Systems

! A blending model with a quadratic approximation      (BlendOctaneQP.lng)
  to the blending of octane in gasoline (Motor Octane Number);
! Keywords: Blending, Fuel, Gasoline, LINGO,  MON, Motor Octane, 
      Nonlinear, Octane, Petroleum refining, Quadratic, Refinery ;
sets:
 ! The table of Raw Materials;
  rm: mon, cost, avail, x, f;
  rxr( rm, rm) | &1 #lt# &2: q;
endsets
data:
 ! Desired Motor Octane Number (MON);
  montarg = 90;
 ! Selling price of blended gasoline;
  sprice = 140;
 ! The raw materials,
  Alkylate, Light straight run, Reformate, 
  Heavy cat cracked, Light cat cracked, Butane;
  rm =  ALKY  LSTR  RFRM  HCAT  LCAT BUTN;
 ! Relative costs;
  cost=  105    87    98    90   101  117;
 ! Availability;
  avail=  70   590   110   150   160   80;
! Data based on:
   Snee, R. "Developing Blending Models for Gasoline and Other Mixtures",
    Technometrics, vol. 23, no. 2, 1981, pp. 119-130.
 ! Stand-alone MON;
    mon= 105.4  81.6  91.4  83.5  88.0 101.6;
 ! Quadratic interaction terms between pairs of rm. 
    E.g. ALKY & HCAT together hurt (-17.0) MON, whereas
         LSTR & LCAT together help (+6.8) MON;
     q =        -7.3  -2.5 -17.0  -7.2   0
                      -0.4   1.6   6.8   0
                            -3.8   1.3   0
                                   0.5   0
                                         0;
enddata 

! Variables:
    batch = quantity blended in total,
    x( j) = amount of rm( j) in blend,
    f( j) = fraction of rm( j) in blend;

! Maximize Revenue minus cost;
  max = sprice*batch - @sum( rm(j): cost(j)*x(j));

! Amount blended;
     batch = @sum( rm( j): x( j));

   @for( rm( j):
!    Blend fractions;
     f( j) = x(j)/batch;
!    Raw material availabilities;
      x( j) <= avail( j);
       );

! The MON (Motor Octane) constraint;
    @sum( rm(j):
        mon(j)*f(j))   ! Linear part;
        + @sum( rxr(i,j): q( i, j)*f( i)*f( j)) ! Quadratic adjustment;
         >= montarg;