! A fuel ferrying/tankering model in LINGO.
 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, nonlinear fuel
  burn curves, nonlinear fuel purchase schedules
  at an airport;
! Keywords: Fuel purchasing, Tankering, Ferrying;
 CITY: C, R, B, P, D;
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; 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 + delivered to I+1, + extra fuel burned because of extra fuel carried; [MATBAL] D( I) + P( I) = R( I) + D( I+1) + B( I) * D( I+1); ! Take off limit; [TANKUL] D( I) + P( I) <= FMX; );