FICO
FICO Xpress Optimization Examples Repository
FICO Optimization Community FICO Xpress Optimization Home
Back to examples browserPrevious exampleNext example

Air transport

Description
Problem name and type, featuresDifficulty
F‑1 Flight connections at a hub: Assignment problem *
F‑2 Composing flight crews: Bipartite matching ****
2 problems, data preprocessing, incremental definition of data array, encoding of arcs, logical or (cumulative version) and and, procedure for printing solution, forall-do, max, finalize
F‑3 Scheduling flight landings: Scheduling problem with time windows ***
generalization of model to arbitrary time windows; calculation of specific BigM, forall-do
F‑4 Airline hub location: Hub location problem ***
quadruple indices; improved (re)formulation (first model not usable with student version), union of index (range) sets
F‑5 Planning a flight tour: Symmetric traveling salesman problem *****
loop over problem solving, TSP subtour elimination algorithm; procedure for generating additional constraints, recursive subroutine calls, working with sets, forall-do, repeat-until, getsize, not


Further explanation of this example: 'Applications of optimization with Xpress-MP', Chapter 11: Air transport

mosel_app_6.zip[download all files]

Source Files

Data Files





f1connect.mos

(!******************************************************
   Mosel Example Problems
   ======================

   file f1connect.mos
   ``````````````````
   Planning flight connections at a hub
   
   (c) 2008 Fair Isaac Corporation
       author: S. Heipcke, Mar. 2002
*******************************************************!)

model "F-1 Flight connections"
 uses "mmxprs"

 declarations
  PLANES = 1..6                         ! Set of airplanes
  
  PASS: array(PLANES,PLANES) of integer ! Passengers with flight connections
  
  cont: array(PLANES,PLANES) of mpvar   ! 1 if flight i continues to j
 end-declarations

 initializations from 'f1connect.dat'
  PASS
 end-initializations

! Objective: number of passengers on connecting flights
 Transfer:= sum(i,j in PLANES) PASS(i,j)*cont(i,j)

! One incoming and one outgoing flight per plane
 forall(i in PLANES) sum(j in PLANES) cont(i,j) = 1
 forall(j in PLANES) sum(i in PLANES) cont(i,j) = 1

 forall(i,j in PLANES) cont(i,j) is_binary

! Solve the problem: maximize the number of passengers staying on board
 maximize(Transfer)
 
! Solution printing
 writeln("Passengers staying on board: ", getobjval)
 forall(i in PLANES)
 writeln(i, " -> ", getsol(sum(j in PLANES) j*cont(i,j)), " (",
         getsol(sum(j in PLANES) PASS(i,j)*cont(i,j)), ")")
 
end-model

Back to examples browserPrevious exampleNext example