• No results found

Composing flight crews

During the Second World War the Royal Air Force (RAF) had many foreign pilots speaking different languages and more or less trained on the different types of aircraft. The RAF had to form pilot/co-pilot pairs (‘crews’) for every plane with a compatible language and a sufficiently good knowledge of the aircraft type. In our example there are eight pilots. In the following table every pilot is characterized by a mark between 0 (worst) and 20 (best) for his language skills (in English, French, Dutch, and Norwegian), and for his experience with different two-seater aircraft (reconnaissance, transport, bomber, fighter- bomber, and supply planes).

Table 11.3:Ratings of pilots

Pilot 1 2 3 4 5 6 7 8

Language English 20 14 0 13 0 0 8 8

French 12 0 0 10 15 20 8 9

Dutch 0 20 12 0 8 11 14 12

Norwegian 0 0 0 0 17 0 0 16

Plane type Reconnaissance 18 12 15 0 0 0 8 0 Transport 10 0 9 14 15 8 12 13

Bomber 0 17 0 11 13 10 0 0

Fighter-bomber 0 0 14 0 0 12 16 0 Supply plane 0 0 0 0 12 18 0 18

A valid flight crew consists of two pilots that both have each at least 10/20 for the same language and 10/20 on the same aircraft type.

Question 1: Is it possible to have all pilots fly?

Subsequently, we calculate for every valid flight crew the sum of their scores for every aircraft type for which both pilots are rated at least 10/20. This allows us to define for every crew the maximum score among these marks. For example, pilots 5 and 6 have marks 13 and 10 on bombers and 12 and 18 on supply planes. The score for this crew is therefore max(13 + 10, 12 + 18) = 30.

Question 2: Which is the set of crews with maximum total score?

11.2.1

Model formulation

Let PILOTS be the set of pilots. This type of problem is easily modeled through an undirected compati- bility graph G = (PILOTS, ARCS). Every node represents a pilot, two nodes p and q are connected by an undirected arc (or edge) a = [p, q] if and only if pilots p and q are compatible, that is, they have a lan- guage and a plane type in common for which both are rated at least 10/20. The arcs are assigned weights corresponding to the maximum score SCOREaof the flight crew. Figure11.1shows the resulting graph with the scores for question 2.

A valid set of crews corresponds in G to a subset of arcs such that any two among them have no node in common. In Graph Theory, such a set is called a matching. For question 1 we are looking for the maximum cardinality matching, for question 2 for the matching with maximum total weight. The graph suggests we formulate the model as follows.

maximize X a∈ARCS

CREWa· flya (11.2.1)

2 3 5 6 7 8 25 1 30 27 28 27 36 29 21 24 28 26 25 30 30 30 4

Figure 11.1:Compatibility graph for pilots ∀r ∈ PILOTS : X

a=[p,q]∈ARCS p=r∨q=r

flya≤1 (11.2.2)

∀a ∈ ARCS : flya∈ {0, 1} (11.2.3)

For every edge a = [p, q] in the graph, a binary variable flyaindicates whether this edge is used or not (11.2.3). Through constraints (11.2.2) every node r is contained in at most one edge. The objective func- tion (11.2.1) accumulates the weight of the chosen edges for question 2. For question 1, we maximize the number of flight crews to see whether all pilots are taken: the coefficients SCOREaneed to be removed from the objective function. Note that the matching of maximum cardinality is a special case of matching with maximum weight, with all weights equal to 1.

11.2.2

Implementation

The Mosel program below first calculates the set of admissible crews based on the language skills and flight experience of the pilots: for every pair of pilots p and q the algorithm first checks whether they have compatible language skills, and if this is the case then their flight experience is compared. The two pilots are retained as an admissible crew if they both have sufficient experience on the same aircraft type. The crews are saved in a two-dimensional arrayCREWindexed by the set of arcs, that is, the two pilots p and q of an arc a = [p, q] are represented byCREW(a,1)andCREW(a,2). With the convention p < q, every pair of pilots is listed only once. The following program solves the problem twice, once with the objective function for question 1 and once for question 2.

model "F-2 Flight crews" uses "mmxprs"

forward procedure print_sol declarations

PILOTS = 1..8 ! Set of pilots

ARCS: range ! Set of arcs representing crews RL, RT: set of string ! Sets of languages and plane types LANG: array(RL,PILOTS) of integer ! Language skills of pilots

PTYPE: array(RT,PILOTS) of integer ! Flying skills of pilots CREW: array(ARCS,1..2) of integer ! Possible crews

end-declarations

initializations from ’f2crew.dat’ LANG PTYPE

end-initializations

! Calculate the possible crews ct:=1

forall(p,q in PILOTS| p<q and

(or(t in RT) (PTYPE(t,p)>=10 and PTYPE(t,q)>=10)) ) do CREW(ct,1):=p CREW(ct,2):=q ct+=1 end-do finalize(ARCS) declarations

fly: array(ARCS) of mpvar ! 1 if crew is flying, 0 otherwise end-declarations

! First objective: number of pilots flying NFlying:= sum(a in ARCS) fly(a)

! Every pilot is member of at most a single crew

forall(r in PILOTS) sum(a in ARCS | CREW(a,1)=r or CREW(a,2)=r) fly(a) <= 1 forall(a in ARCS) fly(a) is_binary

! Solve the problem maximize(NFlying) ! Solution printing

writeln("Number of crews: ", getobjval) print_sol

! **** Extend the problem **** declarations

SCORE: array(ARCS) of integer ! Maximum scores of crews end-declarations

forall(a in ARCS)

SCORE(a):= max(t in RT | PTYPE(t,CREW(a,1))>=10 and PTYPE(t,CREW(a,2))>=10) (PTYPE(t,CREW(a,1)) + PTYPE(t,CREW(a,2)))

! Second objective: sum of scores

TotalScore:= sum(a in ARCS) SCORE(a)*fly(a) ! Solve the problem

maximize(TotalScore)

writeln("Maximum total score: ", getobjval) print_sol !--- ! Solution printing procedure print_sol forall(a in ARCS) if(getsol(fly(a))>0) then writeln(CREW(a,1), " - ", CREW(a,2)) end-if end-procedure end-model

A feature of Mosel shown by the above implementation is the incremental definition of the arrayCREW that stores the list of crews (and hence of its index setARCS). After the calculation of the crews is com- pleted the (dynamic) index setARCSis finalized so that the array of variablesflyis defined as a static array on this index set.

Another feature that is new in this model is the cumulativeorused for testing the pilots’ compatibility. The expression

or(l in RL) (LANG(l,p)>=10 and LANG(l,q)>=10)

evaluates totrueif for at least onelthe values ofLANG(l,p)andLANG(l,q)are both greater than or equal to 10.

11.2.3

Results

In answer to the first question, the program finds that four crews are flying, that is, all eight pilots. For the second question, the optimization calculates a maximum total score of 125 for the four crews [1,2], [3,7], [4,5], and [6,8].