Lindo Systems

! A fuel ferrying/tankering model in LINGO.  (FuelTanker.lng)
 Given an aircraft that must
  visit a sequence of cities, 
  price of fuel in each city, and
  amount of fuel needed to fly from  city to city, and 
  additional fuel burned to carry additional fuel,
 How much fuel should be bought at each city?
 Qualitatively, we want to buy fuel at the cheap stops,
 and ferry fuel into the stops where fuel is expensive;
!  Additional complications might be: city specific 
  landing and takeoff weight limits that are city specific, 
  nonlinear fuel burn curves, 
  nonlinear fuel purchase schedules at an airport,
    e.g., there might be a fixed cost of refueling;
! Keywords: Aircraft, Aviation, Ferrying, Flight, Flying, 
            Fuel purchasing, LINGO, Tankering;
SETS:
 CITY: C, R, B, P, D;
ENDSETS
DATA:
! Max fuel allowed on board;
  FMX = 6000;
  CITY= DFW   ATL   ORD  DSM   STL  OMA;
! Cost of fuel at each city;
  C =  5.80  6.80  7.00 5.60  6.10  5.90;
! Min fuel required (and used) out of each city
   in order to travel to next city;
  R =  3100  2700  1300 1350  2500   0;
! Additional fuel burned (gal/gal)
  ferried/delivered to next stop;
  B =  .04   .03   .03   .01  .04    0;
! Note, at last stop we do not know how much
  fuel is needed for the next unknown leg,
  so amount delivered to last stop will be 0
  unless constrained otherwise;
ENDDATA
!-----------------------------------------;
! Variables: 
    P(i) = amount of fuel purchased at stop i,
    D(i) = amount of fuel delivered to stop i;
! Minimimze the cost of fuel purchased over all stops;
  MIN = @SUM( CITY( I): C( I) * P( I));
  NSTOPS = @SIZE( CITY);
! Assume plane starts empty;
  D( 1) = 0;
  @FOR( CITY( I) | I #LT# NSTOPS:
!  Fuel delivered to I + purchased at I
 = min burn to get to I+1 
  + extra fuel burned because of extra fuel carried
  + delivered to I+1;
   [MATBAL] D( I) + P( I) = 
           R( I) + B( I) * D( I+1) + D( I+1) ;
! Take off limit;
   [TANKUL] D( I) + P( I) <= FMX;
     );