In all fields, it is essential to choose a good model for the problem to be addressed. Indeed, the best solution method will be useless if it is given inappropriate data or constraints. Let us illustrate this on the Steiner tree problem. Two simple modelings may naturally be imagined:

  • Steiner nodes to retain A solution can be represented by the Steiner node to belong to the tree; knowing these nodes, the tree is constructed by the application of the Prim or the Kruskal algorithm.

  • Edges to retain A solution can equally be represented by a set of edges; these edges must produce a connected graph containing all terminals.

It is not possible to determine a priori which model is the best. It really depends on the type of algorithm that will be developed to solve the problem. For example, the first model might be better suited to a constructive algorithm, while the second might be better suited to a local search.

The first part of this chapter gives various modeling examples for the graph coloring problem. It presents some techniques to transform the objective and the constraints of an optimization problem in order to obtain a model facilitating the design of solving algorithms.

Sometimes, there is not just one clear objective to optimize, but several. The next part of this chapter introduces some concepts of multi-objective optimization.

When faced with a new problem, it is not necessarily obvious how to find a good model. Sometimes, the “new” problem may even be a classic one that has not been recognized. The last part of this chapter gives some examples of practical applications that can be modeled as combinatorial problems presented in the previous chapter.

1 Objective Function and Fitness Function

To ensure the problem has been understood, it is necessary to formally express or model its core. A problem can be modeled in various ways. Next, the solving methods must be adapted to the chosen model. This section presents various models for the vertex coloring problem. These models are illustrated with a small graph. Figure 3.1 gives an optimal coloring of this graph.

Fig. 3.1
figure 1

Coloring the vertices of a graph with a minimum of color. This coloring is the best possible since the graph contains a clique of four vertices

In Sect. 1.1, we have seen that this problem could be modeled by a satisfiability problem. If a coloring with a minimum number of colors is wanted, a series of satisfiability problems can be solved. Unless working on small graphs and having an efficient satisfiability solver, this approach is hardly practicable. Another modeling, presented in the same section, consists in formulating an integer linear program. The objective (1.4) is to directly minimize the number of colors used. In general terms, a combinatorial optimization problem can be formulated as:

$$\displaystyle \begin{aligned} \mathrm{Optimize} : & \quad f(s) {} \end{aligned} $$
(3.1)
$$\displaystyle \begin{aligned} \mathrm{Subject to} : & \quad s \in S{} \end{aligned} $$
(3.2)

The correspondence between this general model and the linear program presented in Sect. 1.1.1 is as follows: the objective (3.1) is to minimize (1.4), which is equivalent to minimizing the highest color index. Constraint (3.2) summarizes Constraints (1.5), (1.6), (1.7), and (1.8).

The graph coloring problem can be expressed in a less formal way as:

$$\displaystyle \begin{aligned} \mathrm{Minimize} : & \quad c = f_1(s) {} \end{aligned} $$
(3.3)
$$\displaystyle \begin{aligned} \mathrm{Subject to}:& \quad \mathrm{Two adjacent vertices have different colors} {} \end{aligned} $$
(3.4)
$$\displaystyle \begin{aligned} \mathrm{and}:& \quad \mathrm{Number of colors used by }s \leqslant c{} \end{aligned} $$
(3.5)

Here, function f 1 returns the number of the highest color used. Figure 3.2 provides a feasible coloring of a graph that is not optimal. For the solution given in this figure, we have f 1 = 5. For those given in Fig. 3.1, we have f 1 = 4.

Fig. 3.2
figure 2

Graph colored with too many colors. A number of changes are required to remove the unnecessary color

Another graph coloring model is less intuitive. It consists in directing the edges of the graph without creating a circuit. The objective is to minimize the length of the longest path in the directed graph:

$$\displaystyle \begin{aligned} \mathrm{Minimize } : & \quad f_2(s) = \mathrm{Longest path in } G \mathrm{ oriented} {}\\ \mathrm{Subject to} : & \quad \mathrm{The edge orienting of } G \mathrm{ has no circuit} \end{aligned} $$
(3.6)

Once such a directed graph is obtained, a feasible solution can be easily found. The vertices without predecessor receive the color number 1. They cannot be connected by an arc, so there is no constraint violation.

These vertices can be removed from the graph before assigning the color number 2 to those staying without predecessor and so on. Hence, the number of colors obtained is one more than the length of the longest path. The coloring of a graph with this model is illustrated in Fig. 3.3.

Fig. 3.3
figure 3

Graph coloring obtained by directing the edges without circuit. One of the longest paths is indicated in bold. For this solution, f 2 = 4 corresponds to a 5-coloring

Minimizing a maximum—or maximizing a minimum—as (3.3) or (3.6) is generally not a good way for easily discovering or improving solutions satisfying all constraints. In the context of local search, such a modeling contains very large plateaus (see Sect. 5.1.3, Fig. 5.2).

What if a solution that has been discovered uses one color more than the optimum, as shown in Fig. 3.2? Is there just a vertex that uses the extra color, or are there many? The objective function is often replaced by a fitness function, easier to optimize, for instance, by including constraints that have been relaxed.

1.1 Lagrangian Relaxation

A problem that can be put in the form:

$$\displaystyle \begin{aligned} \begin{array}{rcl} \mathrm{Minimize} & f(s) \\ \mathrm{Subject to:} & s \in S &\displaystyle \mathrm{Easy constraint} \\ \mathrm{and:} & g(s) \leqslant 0 &\displaystyle \mathrm{Make the problem hard} \end{array} \end{aligned} $$

could be modeled :

$$\displaystyle \begin{aligned} \begin{array}{rcl} \mathrm{Minimize} & f(s) + \lambda \cdot max(g(s), 0) &\displaystyle \mathrm{with } \lambda \mathrm{being a parameter}\\ \mathrm{Subject to:} & s \in S &\displaystyle \end{array} \end{aligned} $$

If λ is large enough, both models have the same optimal solution.

1.1.1 Lagrangian Relaxation for the Vertex Coloring Problem

For the vertex coloring problem, Constraint (3.4) can be relaxed. A Lagrangian relaxation of the problem is:

$$\displaystyle \begin{aligned} \mathrm{Minimize} : & \quad f_3(s) = c + \lambda \cdot \mathrm{ Number of violations of~(3.4)} {}\\ \mathrm{Subject to} : & \quad \mbox{(3.5)} \end{aligned} $$
(3.7)

For a sufficiently large λ value (for instance, by setting λ =  chromatic number), a solution optimizing (3.7) is also optimal for (3.3). In that manner, a triangle colored with a single color has a fitness of 1 + 3λ. The fitness is 2 + λ with two colors, and the optimal coloring has a fitness of 3. For 0 < λ < 1∕2, the optimum solution of f 3 has one color; for 1∕2 < λ < 1, it has two colors; and for λ > 1, the optimum is a feasible solution with three colors. For instance, the solution of Fig. 3.1 has a fitness of f 3 = 4, that of Fig. 3.2 is f 3 = 5, and that of Fig. 3.4 is f 3 = 4 + 2λ.

Fig. 3.4
figure 4

Unfeasible coloring of a graph with a given number of colors. For this solution, we have f 3 = 4 + 2λ. For those of Fig. 3.1, we have f 3 = 4. For those of Fig. 3.2, we have f 3 = 5

Instead of relaxing the constraint that no two adjacent vertices receive the same color, we can relax the constraint that each vertex be colored:

$$\displaystyle \begin{aligned} \mathrm{Minimize } : & \quad f_4(s) = \mathrm{Number of uncolored vertices} {} \\ \mathrm{Subject to: } : & \quad (3.4) \end{aligned} $$
(3.8)

A partial coloring of a graph with f 4 = 1 is given in Fig. 3.5.

Fig. 3.5
figure 5

Partial coloring of a graph with a given number of colors. For this solution, we have f 4 = 1

Generally, the value of the multiplier λ associated with a relaxed constraint placed in the fitness function is modulated according to the success of the search: if a feasible solution is discovered, the value of λ is diminished. Conversely, if all generated solutions are unfeasible, the value of λ is increased. Let us illustrate this for the TSP.

1.1.2 Lagrangian Relaxation for the TSP

A 1-tree of minimum weight in a network with vertices 1, 2, …, n is a minimum spanning tree on the vertices 2, …, n plus two edges adjacent to vertex 1 with the lowest weights. Node 1 carries out a particular role, hence the term 1-tree. We can reformulate the TSP by specifying that one seeks a 1-tree of minimum weight with the constraint imposing a degree of two for every vertex.

$$\displaystyle \begin{aligned} \begin{array}{rlll} \min z = & \sum_{(i,j) \in H}{d_{ij}x_{ij}} & & \\ \mbox{Subject to:} & \sum_{j = 1}^{n}{x_{ij}} & = & 2 \quad (i = 1, \dots, n)\\ \mbox{and} & H \mbox{ is a 1-tree} & & \\ \end{array}{} \end{aligned} $$
(3.9)

By relaxing Constraints (3.9) on the degree of each vertex and including them with Lagrange multipliers in the objective, we get:

$$\displaystyle \begin{aligned} \begin{array}{rlll} \min z(\lambda) = & \sum_{(i,j) \in H}{d_{ij}x_{ij}} & + \sum_{i = 1}^{n}{\lambda_i(\sum_{j = 1}^{n}{x_{ij}} - 2) }& \\ \mbox{Subject to:} & H \mbox{ is a 1-tree} & & \\ \end{array} \end{aligned} $$
(3.10)

For fixed λ i(i = 1…n), the problem reduces to the construction of a 1-tree of minimum weight in a network where the weight of the edge (i, j) is shifted to d ij + λ i + λ j. With these modified weights, the length of a tour is the same as with unmodified weights, but increased by 2 ⋅∑i λ i. Indeed, it is necessary to enter once in each vertex i and come out once, having to “pay” a λ i penalty twice. Therefore, z(λ) provides a lower bound to the length of the optimal tour. The value of this bound can be improved by finding λ i maximizing z(λ).

Figure 3.6 illustrates various 1-tree that can be obtained by modifying the λ values for a small TSP instance.

Fig. 3.6
figure 6

Left: 1-tree on the TSP instance tsp225 obtained with all λ values set to 0. The size of filled disks is proportional to the value to add to the λ associated with penalized vertices, and circles are proportional to the value to remove. Top right: the 1-tree obtained with the first modification of the λ. Bottom right: the 1-tree obtained after iterating the process. Only 12 vertices have a degree different from 2, and the length of this 1-tree is about 7.5% above the length of the initial 1-tree and 1.1% below the optimum tour length

1.2 Hierarchical Objectives

Rather than introducing several constraints with penalties in the fitness function, another possibility is to consider hierarchical objectives. For the graph coloring problem, a primary objective counts the number of colors used. The value of this objective is chosen and fixed. A secondary objective measures the number of constraints violation. Once a feasible solution is found, one can try reducing the number of colors before starting again. If no feasible solution is achieved, the number of colors of the primary objective is increased. Proceeding like this allows not completely losing the work done so far.

The modeling choice has a significant influence on the problem-solving capacity of a given method. Therefore, it is worth paying close attention to the problem analysis phase. For instance, if a timetable problem is modeled by a graph to color, the user might not necessarily be interested in the timetable using the smallest possible time slots. This last objective is minimized by solving a standard graph coloring problem. The user might just specify the maximum number of time slots available. Then any timetable using no more than these time slots could be fine. In this case, a fitness function of type f 3 (with λ close to 0 and c fixed to the maximum number of time slots desired) or f 4 would certainly be more convenient than f 1 or f 2.

Relaxing constraints by including a penalty for their violations in the fitness function can only be considered for a relatively small number of constraints. However, proceeding like this is very common when we are dealing with “soft” constraints. The last corresponds rather to preferences than to strict constraints. In this case, using a model with hierarchical objectives may be a good option.

A more flexible and frequently used approach is to consider several objectives simultaneously and to leave the user the choice of a compromise—prefer a solution good for an objective rather than another. Such an approach implies the methods to be able to propose various solutions rather than a single one optimizing a unique objective.

2 Multi-Objective Optimization

Route planning is a typical multi-objective optimization example. To go from a point A to a point B, we have to use a given transportation network. This constitutes the constraints of the problem. We want to minimize the travel time of the journey, minimize the energy consumption, and maximize the pleasure of the journey.

These objectives are generally antagonists. The same route can be done by reducing the energy consumption at the cost of an increased travel time. The user will choose an effective route on a more subjective basis: for instance, by “slightly” increasing duration, the energy consumption “sensibly” decreases, and the landscape is “picturesque.”

Figure 3.7 illustrates the case of someone who has to travel by air and who has the choice between several means of transportation to get to an airport and reach the final destination.

Fig. 3.7
figure 7

Example of a multi-objective problem: To travel from a departure place to a destination, several routes can be selected. Each trip has a given cost and duration, indicated next to the arcs. From the departure place, we can either go to the train station by bus, or by taxi, or go directly to the nearest airport by taxi. From the train station, we can reach either the nearest airport or another airport. The last is a little further away but better serviced and flights are more competitive. Then we fly up to the airport the closest to the destination, where we can go to the final destination either by bus or by taxi

An optimization problem with K goals can formulate generally by:

$$\displaystyle \begin{aligned} \mathrm{``Minimize''} : & \quad \vec f(s) = (f_1(s), \dots, f_K(s)) \\ \mathrm{Subject to }: & \quad s \in S \end{aligned} $$
(3.11)

This formulation assumes that one seeks to minimize each objective. This does not constitute a loss of generality. Indeed, it is equivalent to maximizing or minimizing the opposite. It is said that a solution s 1 dominates a solution s 2 if s 1 is better than s 2 on at least one objective and at least as good as s 2 on the other objectives.

The purpose of multi-objective optimization is therefore to exhibit all non-dominated solutions. These solutions are qualified as efficient or Pareto-optimal . Representing a solution where each axis represents the value of each objective, the solutions that are on the convex envelope of the Pareto frontier are called the supported solutions .

Figure 3.8 provides all the solutions to the problem instances given in Fig. 3.7 in a cost/time diagram. We see in this figure that there are efficient solutions not located on the convex hull.

Fig. 3.8
figure 8

Representation of the solutions of the problem of Fig. 3.7 in a cost/time diagram. The nine efficient solutions are highlighted. Only supported solutions may be discovered by an exact scalar method

The ultimate choice of a solution to the problem is left to the decision-maker. This choice is subjective, based, for instance, on political, ethical, or other considerations that cannot be reasonably quantified and therefore introduced neither in the objectives nor in the constraints.

2.1 Scalarizing

A technique for generating various solutions to a multi-objective problem is to modify the last in a single-objective problem. The parameters of this problem are as many as the objectives of the multi-objective problem. Thus, the multi-Objective Problem (3.11) turns into a single-objective problem with parameters w 1, …, w K.

$$\displaystyle \begin{aligned} \mathrm{Minimize }: & \quad \sum_{i = 1}^K{w_i \cdot f_i(s)} {} \\ \mathrm{Subject to }: & \quad s \in S \end{aligned} $$
(3.12)

This technique is known as linear scalarization. Let us suppose we have an exact method for solving Problem (3.12). The supported solutions can be discovered by varying the value of the weights w i. For instance, by setting w i = 1 for a given i and zero weights for the other objectives, the best possible solution for the ith criterion can be found. Once these K solutions are known, other supported solutions can be found, if any exists. Indeed, vectors (w i) orthogonal to the hyperplane supported by the K objectives of these K solutions can be considered. By reiterating the process with this new solution, the proper set of supported solutions can be generated.

2.2 Sub-goals to Reach

The main issue with linear scalarization is that the unsupported efficient solutions are not achievable. The extreme case is that the only supported solutions are the K individually optimizing a single objective. Unsupported solutions can be extracted by fixing the minimum quality of a solution on one or more objectives. The idea is to include one or more constraints while removing the same number of objectives. If the solutions are constrained to get a value at most v 1 for the first objective, we have the problem with d − 1 objectives:

$$\displaystyle \begin{aligned} \mathrm{Minimize}: & \quad \vec f(s) = (f_2(s), \dots, f_K(s)) {} \\ \mathrm{Subject to}: & \quad f_1(s) \leqslant v_1 \\ \mathrm{with} : & \quad s \in S \end{aligned} $$
(3.13)

In the example of Fig. 3.8, imposing a maximum budget v 1 = 250, the solution of cost 248 for a time of 207 is found. The last is not supported.

3 Practical Applications Modeled as Classical Problems

Let us conclude this chapter by giving some examples of practical applications that can be modeled as academic problems.

3.1 Traveling Salesman Problem Applications

As we have taken the traveling salesman problem as the main thread of this book, we start by showing how to model in this form problems that have a priori nothing to do with performing tours.

3.1.1 Minimizing Unproductive Moves in 3D Printing

To produce parts in small quantities, especially to make prototypes directly with CAD software, additive manufacturing or 3D printing techniques are now used. One of these techniques is to extrude a thermoplastic filament which is deposited layer by layer and hardens immediately.

It is particularly useful to minimize the unproductive moves of the extrusion head when printing three-dimensional parts. To produce such a piece, the 3D model is sliced into layers of thickness depending on the diameter of the extrusion head. Each layer is then decomposed into a number of segments. If the extrusion head must start printing a segment at a different position than those of the previous segment, it must perform an on-air move. The total length traveled by the head is consistent: for the part shown in Fig. 3.9—about 10 cm wide, it represents nearly a kilometer. The unproductive moves can represent a relatively consequent fraction of all the moves. As a result, minimizing the latter allows a significant productivity gain.

Fig. 3.9
figure 9

Part of a bicycle lamp, viewed in the PrusaSlicer software

The transformation principle of this problem into the traveling salesman is the following: a naive attempt would create a city per segment endpoint. However, a tour comprising only these cities does not necessarily provide a solution to the extrusion problem, as a segment might not be printed when visiting one of its endpoints.

Therefore, it is necessary to force the tour to visit the other endpoint of a segment immediately after visiting the first endpoint. For this purpose, a city is included in the middle of each segment. The standard TSP does not have constraints on the city visiting order. To ensure a good TSP tour corresponds to a feasible solution to the extrusion problem, the distance matrix must be adapted. To force printing a segment, the distance between the cities’ endpoints and the middle city is zero. The head will truly take a while to print the segment, but this time is incompressible since the segment must be printed anyway.

To prevent certain moves of the head, a large distance M is associated with prohibited moves. In this manner, a proper tour will not include such moves of the head. The value of M should not be too large, to avoid numerical problems. A value about 100 times the size of the object to be printed may be suitable. This technique prevents connecting the middle city of a segment to all other cities but excepted both endpoints of the corresponding segment. Another constraint is to print all segments of a layer before printing the subsequent layer.

Indeed, it is no longer possible to extrude material below an already printed layer. Moreover, this would significantly complicate the management of the extrusion head. The last can collide with the material of an upper layer when printing a lower one. This can be prevented in the traveling salesman model by a technique similar to that presented above. Figure 3.10 illustrates how to build the distance matrix for printing two segments.

Fig. 3.10
figure 10

Transformation of the problem of minimizing non-productive moves of a 3D printing into a TSP. Principle for assigning distances between six cities corresponding to segments [a, c] and [e, g] to print. The “cities” b and f are placed in the middle of the segments to force the extrusion head to go from one endpoint of a segment to the other one. The M value is relatively large (typically, 100 times the size of the object). The value of p depends on the respective layers of both segments: either 0 if they are in the same layer or M∕10 if they are in adjacent layers or M if they are in different and non-adjacent layers

The distance between two endpoints of segments is penalized by a value p depending on the segment layers. If both segments belong to the same layer, the penalty is zero. Else, if the segments are in adjacent layers, we can set p = M∕10. Thus, a proper tour goes only once from a layer to the next one. The length of a good tour corresponds to that of the unproductive moves plus M∕10 times the number of layers to print. Otherwise, if the segments are neither in the same layer nor in adjacent layers, the penalty is set to p = M. Finally, two cities corresponding to the initial and ultimate positions of the extrusion head are added to complete the model.

It should be noted that traveling salesman models for minimizing unproductive moves can lead to large size instances. The part illustrated in Fig. 3.9 has a few hundred thousand segments. Figure 3.11 illustrates the productivity gain that can be obtained by optimizing unproductive moves. On the one hand, we have the moves proposed by the PrusaSlicer software for just one layer. On the other hand are the optimized moves obtained with a traveling salesman model. The length of the unproductive moves can be divided by about 9 for this layer.

Fig. 3.11
figure 11

On the left, moves of the extrusion head, as produced by the PrusaSlicer software. Darker segments correspond to unproductive moves. The total length of these moves is about 740.8 mm. On the right, optimized moves using a traveling salesman model. The length of non-productive moves is about 84.5 mm

3.1.2 Scheduling Coloring Workshop

One of the simplest scheduling problems is that of painting objects. The unique resource is the machine coloring the objects. Each task has only one operation: color the object i (i = 1, …, n); the duration of the operation is t i. After coloring the object i, the machine must be cleaned to correctly color the next, j; this set-up time is s ij. Note that, generally, s ijs ji: indeed, dark pigments in a pastel color are more visible than the opposite. After coloring all the objects, the machine must be cleaned to be ready for the next day; the duration of this operation is r. The goal is to find the best coloring order of the objects. Hence, we look for a permutation p of the n objects minimizing \(\sum _{i = 1}^{n-1}{(t_{p_i} + s_{p_i p_{i+1}})}+t_{p_n} + r\). This scheduling problem with set-up time can be reduced to a traveling salesman instance with n + 1 cities. For proving this, let w ij = t i + s ij(i, j = 1, …, n), w i0 = r, and w 0i = 0, (i = 1, …, n). We can verify that the shortest tour on the cities 0, …, n provides the optimal order to color the objects. The “object” 0 represents the beginning of a workday.

3.2 Linear Assignment Modeled by Minimum Cost Flow

The linear assignment mathematical model given in Sect. 2.5.1 is both concise and rigorous. However, it does not indicate how to solve a problem instance. Using general integer linear programming solvers might be inappropriate—unless the solver automatically detects assignment constraints (2.34) and (2.35) and incorporates an ad hoc algorithm to process them. This is frequently the case.

The maximum matching problem can be treated as a special linear assignment problem: if i can be matched with u, then we can set a cost of 0 to the edge; otherwise, a positive cost is set. If an assignment of minimum cost is found, the last uses as few edges with positive cost and as many edges with 0 cost as possible. The maximum matching problem can be modeled with a maximum flow in a bipartite network. Figure 3.12 illustrates how a matching problem can be solved with a flow in a network.

Fig. 3.12
figure 12

Matching problem: how many mixed couples can be formed between girls and boys? A compatible matching is represented by an edge in a bipartite graph. The problem can be modeled by searching for a maximum possible flow from a vertex s to a vertex t in a network

Similarly, the linear assignment problem can be modeled by a minimum cost flow. A bipartite network R = (I ∪ U ∪{s}∪{t}, E, w, c) is built similarly to the matching problem presented in Fig. 3.12. Every pair of nodes (i ∈ I, u ∈ U) is connected by an arc (i, u) with capacity w(i, u) = 1 and cost c(i, u). An arc (s, i) of capacity w(s, i) = 1 with cost 0 connects s to each node i ∈ I. An arc (u, t) of capacity w(u, t) = 1 with cost 0 connects each node u ∈ U to t.

Finding an optimum cost flow in R allows finding the optimal assignment in polynomial time, for instance, with Algorithm 2.6.

More efficient algorithms have been designed for the linear assignment problem. This leads us to make a comment on the integer linear program presented in Sect. 2.5.1. A peculiarity of the constraint matrix is that it contains only 0s and 1s. It can be proved that the adjacency matrix of a bipartite graph is totally unimodular. This means that the determinant of any square sub-matrix is either − 1 or 1 or 0. Hence, the integrality constraints (2.36) can be omitted. Therefore, the standard linear program provides an integer optimal solution.

3.3 Map Labeling Modeled by Stable Set

An application of the maximum weight stable set appears for map labeling. When one wishes to associate information with objects drawn on a plan, the problem is to choose the label position so that they do not overlap. Figure 3.13 illustrates a tiny problem of labeling three cities.

Fig. 3.13
figure 13

Map labeling problem: The name of three objects must be placed on a map. The texts should not overlap to maintain readability. For this instance, four possibilities are considered for the label position of each object. In terms of a graph, this problem can be modeled by a maximum stable set. The vertices of the stable correspond to the chosen label positions. Here, the name of each city can be placed at the top, right corner

This problem can be transformed into the maximum stable set as follows: A vertex is created for each potential label position. The set of vertices corresponding to the same label is connected in a clique. Indeed, there should be only one label per object. The vertices corresponding to overlapping labels are also connected with an edge. Hence, a stable set corresponds to label positions without overlap. To display as many labels as possible on the map, a maximum stable is searched in the graph.

In practice, not all positions are equivalent. Indeed, according to the language and the culture, there are preferred positions. For instance, in Western countries, one prefers to place the names at the top, right corner rather than at the bottom, left one. Preferences can be modeled as weights associated with positions. The map labeling problem then consists in finding a maximum weight stable set.

Other problems can be modeled in exactly the same way. First is the berth allocation for docking ships. Translated in terms of labeling, a rectangular label is associated with each ship. The label width is the expected duration of the stopover, and the label height is the length of the ship. The possible positions for this label are determined by the ship’s arrival time and by the dock locations that can accommodate the boat.

Another application of this problem is the flight levels allocation for commercial aircraft. Knowing the expected departure times of each aircraft and the routes they take, the potential areas of collision between aircraft are first determined. The size of these zones depends on the uncertainty of the actual departure times and the effective routes followed. A label will therefore correspond to a zone. The possible positions of the labels are the various flight levels that the aircraft could use.

Problems

3.1

Assigning Projects to Students

Four students (A, B, C, D) must choose among a set of four semester projects (1, 2, 3, 4). Each student makes a grade prediction for each project. What choices students should make to maximize grade point average?

  

Project

  

1

2

3

4

 

A

6.0

5.0

5.8

5.5

Student

B

6.0

5.5

4.5

4.8

 

C

4.5

6.0

5.4

4.0

 

D

5.5

4.5

5.0

3.8

3.2

Placing Production Units

A company has three existing production units 1, 2, and 3 and wants to open three new units, 4, 5, and 6. Three candidate locations a, b, and c are retained for the new units. Figure 3.14 illustrates the locations of the existing and new production units.

Fig. 3.14
figure 14

Location of production units

The parts produced must be transferred from an existing unit to a new unit using only the connections indicated in the figure. For instance, the distance between the unit 1 and the location b is 3 + 4 = 7. The numbers of daily transfers between the existing and new units are given in Table 3.1.

Table 3.1 Number of daily transfers between existing and new units

Where to place these new production units to minimize the total transfer distance?

If parts are also transferred between new units, what kind of problem should we solve?

3.3

Oral Examination

Six students (A, …, F) undergo oral examinations for different modules (1, …, 5). The duration of each examination is 1 hour. How to build a timetable as short as possible, knowing that both students and teachers can have only one examination at a time?

  

Student

  

A

B

C

D

E

F

 

1

× 

 

× 

× 

  
 

2

×

×

 

×

×

×

Module

3

×

 

×

  

×

 

4

  

×

 

×

 
 

5

 

×

×

   

3.4

Written Examination

The following table summarizes the student enrolments for written examinations of various modules. Each student can undergo one examination a day at most. All students to pass the same module are examined the same day. How many days, at minimum, are needed to organize the examination session?

  

Student

  

A

B

C

D

E

F

G

H

I

J

K

L

M

 

1

× 

× 

      

× 

 

× 

  
 

2

×

  

×

         
 

3

× 

    

× 

   

× 

× 

  
 

4

 

×

     

×

  

×

 

×

Module

5

  

×

 

×

    

×

  

×

 

6

  

×

   

×

    

×

 
 

7

  

×

    

×

     
 

8

   

×

 

×

×

 

×

×

   

3.5

QAP with More Positions than Items

How to adapt or change the QAP model when there are fewer elements to be placed (n) than positions (m)? Same question if there is a fixed cost c ir for assigning the item i to the position r.

3.6

Mobile Phone Keyboard Layout

We wish to configure the keys of an old mobile phone. We want to place only the 26 lowercase letters as well as the space on the keys 0, 2, 3, …, 9. Up to four symbols can be placed per key.

For the language considered, g ij represents the frequency of appearance of the symbol j after symbol i. To enter a symbol in position p on a key, it is necessary to press p times the key. This requires p time units. To switch from one key to another, the travel time is one unit. To enter two symbols located on the same key, we have to wait 6 time units. How to build a numerical instance of a QAP for this problem?

3.7

Graph Bipartition to QAP

The bipartition problem is to separate the vertices of a graph into two subsets X and Y  of identical size (assuming an even number of nodes) so that the number of edges having an end in X and the other in Y  are as low as possible. How to build a quadratic assignment instance for the graph bipartition?

3.8

TSP to QAP

How to build a quadratic assignment instance corresponding to a TSP instance?

3.9

Special Bipartition

We consider a set of cards numbered from 1 to 50. We want to split up the cards into two subsets. The sum of the numbers of the first should be 1170, and the product of the others should be 36,000. How to code a solution attempt to this problem? How to assess the quality of a solution attempt?

3.10

Magic Square

We want to create a magic square of order n. This square has n × n cells to be filled with the numbers of 1 to n 2. The sum of the numbers in each line, column, and diagonal must be (n 3 + n)∕2. A magic square of order 4 is given below.

$$\displaystyle \begin{aligned} \begin{array}{cccccc} & & & & & 34\\ & & & & \nearrow & \\ 4 & 14 & 15 & 1 & \to & 34\\ 9 & 7 & 6 & 12 & \to & 34\\ 5 & 11 & 10 & 8 & \to & 34\\ 16 & 2 & 3 & 13 & \to & 34\\ \downarrow & \downarrow & \downarrow & \downarrow & \searrow & \\ 34 & 34 & 34 & 34 & & 34 \end{array} \end{aligned}$$

How to code a solution attempt to this problem? How to assess the quality of a solution attempt?

3.11

Glass Plate Manufacturing

For producing glass plates, the molten glass passes on a chain of m machines in the order 1, 2, …, m. Depending on the desired features for each plate, the processing time on each machine differs. It is assumed there are n different plates to produce (in an order which can be decided by the chain manager). The processing time of the plate i on the machine j is t ij. Additionally, when a machine has completed the processing of a plate, the latter must immediately switch to the next machine without waiting time; otherwise, the glass cools down. A machine only processes one plate at a time. The chain manager must determine in which order to produce the n plates to complete the production as quickly as possible. How to model this no-wait permutation flowshop problem as a TSP?

3.12

Optimal 1-Tree

Find values λ 1λ 5 to assign to the five nodes of the network given in Fig. 2.2 such that:

  • \(\sum _{i=1}^5{\lambda _i} = 0\)

  • The weight of the 1-tree associated with these values is as high as possible