• No results found

Construction of a cabled network

A university wishes to connect six terminals located in different buildings of its campus. The distances, in meters, between the different terminals are given in Table12.6.

Table 12.6:Distances between the different terminals (in meters)

Terminal 1 Terminal 2 Terminal 3 Terminal 4 Terminal 5 Terminal 6

Terminal 1 0 120 92 265 149 194 Terminal 2 120 0 141 170 93 164 Terminal 3 92 141 0 218 103 116 Terminal 4 265 170 218 0 110 126 Terminal 5 149 93 103 110 0 72 Terminal 6 194 164 116 126 72 0

These terminals are to be connected via underground cables. We suppose the cost of connecting two terminals is proportional to the distance between them. Determine the connections to install to minimize the total cost.

12.4.1

Model formulation

We define the undirected labeled graph G = (TERMINALS, DIST, CONNECTIONS) where the set of nodes

TERMINALS corresponds to the set of terminals and the set of edges CONNECTIONS contains the possible

connections [s, t] between these terminals which are labeled with the distance DISTstthat separates them. We define binary variables connectstthat are 1 if and only if terminals s and t are directly connected. Since the connections are undirected, it is sufficient to define the variables for s < t. The objective is to connect all the terminals at the least cost. The objective function is therefore given by (12.4.1).

minimize X s∈TERMINALS X t∈TERMINALS s<t DISTst· connectst (12.4.1)

To connect NTERM terminals, the most economical network is a tree of NTERM − 1 connections. A tree connecting NTERM nodes is a connected graph without any cycles or, equivalently a connected graph

with NTERM − 1 connections. The constraint (12.4.2) imposes these NTERM − 1 connections. X s∈TERMINALS X t∈TERMINALS s<t connectst= NTERM − 1 (12.4.2)

Furthermore, every terminal must be connected to at least one other terminal in the tree. A first idea is to add the constraints (12.4.3).

∀s ∈ TERMINALS : X t∈TERMINALS

s<t

connectst≥1 (12.4.3)

However, these constraints are not sufficient. The constraints (12.4.2) and (12.4.3) may lead to an infeasi- ble solution as shown in Figure12.5in which a cycle is created.

T6 T2 T4 T3 T1 T5

Figure 12.5:An infeasible unconnected solution

To avoid this type of solution, we need to impose the constraint (12.4.4) for any subset S of the set of terminals. The translation of this constraint into a program is unfortunately a difficult task: on one hand there is no possibility of enumerating all subsets, and on the other hand the number of constraints of this type is enormous (2NTERM, that is, about one million for twenty nodes).

∀S ⊆ TERMINALS :X s∈S

X

t∈S, s<t

connectst≤ |S| − 1 (12.4.4)

There follows therefore, a different way of preventing cycles. Consider a tree with its edges directed departing from a root r, that is, a node that is connected to a single other node, like T1 in Figure12.6 (any root will do). We may now assign every node t a level value levelt that may be interpreted as the length (in terms of number of edges) of the path connecting t with r (in a tree this path exists and is unique). For example, we have levelr = 0 and levelt = 1 for any node t directly connected to r. The anti- cycle constraints (12.4.5) are based on positive level value variables. For this formulation, the connections must be directed: we have either connectst= 1 or connectts= 1 for two directly connected nodes s and t. This has no impact on the solution.

∀s, t ∈ TERMINALS, s 6= t : levelt ≥ levels+ 1 − NTERM + NTERM · connectst (12.4.5)

To understand these constraints, let us suppose that a solution of the mathematical model contains a cycle, for instance the cycle 1 → 2 → 5 → 1 of Figure12.5, oriented in this sense. The constraints (12.4.5) for which connectst= 1 in this cycle result in:

level2≥ level1+ 1 (12.4.6)

level5≥ level2+ 1 (12.4.7)

level1≥ level5+ 1 (12.4.8)

By summing up term by term, we obtain a contradiction: 0 ≥ 3 ! A solution containing a cycle therefore violates the constraints (12.4.5). On the contrary, if we have a tree, values of levelt exist that satisfy the constraints, for instance the level numbers obtained by traversing the tree starting from an arbitrary root

constraint (12.4.5) for s and t is satisfied since it reduces to levelt = levels+ 1. If s is not directly connected to t, we have connectst= 0 and the constraint (12.4.5) reduces to levelt−levels1−NTERM, an inequality that is trivially satisfied since the level numbers range between 0 and NTERM − 1.

The constraints (12.4.5) only detect cycles with connections directed around the cycle. For instance, they do not exclude the cycle 1 → 2 ← 5 → 1. Such a cycle cannot occur when we add the following constraints that direct all connections to the (arbitrarily chosen) root node.

∀s = 2, . . . , NTERM : X t∈TERMINALS

s6=t

connectst= 1 (12.4.9)

In the formulation of the constraints (12.4.9) we have chosen node 1 as the root node. Every node must be connected to at least one other node. Since a tree does not contain cycles there must be a single path from every node in the tree to the root node. That means, every node s other than the root node has exactly one outgoing connection. In other words, for every s 6= 1 exactly one variable connectstmust be at 1.

We thus obtain the following mathematical model.

minimize X s∈TERMINALS X t∈TERMINALS DISTst· connectst (12.4.10) X s∈TERMINALS X t∈TERMINALS connectst≤ NTERM − 1 (12.4.11)

∀s, t ∈ TERMINALS, s 6= t : levelt ≥ levels+ 1 − NTERM + NTERM · connectst (12.4.12) ∀s = 2, . . . , NTERM : X t∈TERMINALS s6=t connectst= 1 (12.4.13) ∀s, t ∈ TERMINALS : connectst∈ {0, 1} (12.4.14) ∀t ∈ TERMINALS : levelt ≥0 (12.4.15)

12.4.2

Implementation

The translation of the mathematical model into a Mosel program is direct.

model "G-4 Cable connections between terminals" uses "mmxprs"

declarations NTERM = 6

TERMINALS = 1..NTERM ! Set of terminals to connect DIST: array(TERMINALS,TERMINALS) of integer ! Distance between terminals connect: array(TERMINALS,TERMINALS) of mpvar ! 1 if direct connection

! between terminals, 0 otherwise level: array(TERMINALS) of mpvar ! level value of nodes

end-declarations

initializations from ’g4cable.dat’ DIST

end-initializations

! Objective: length of cable used

Length:= sum(s,t in TERMINALS) DIST(s,t)*connect(s,t) ! Number of connections

sum(s,t in TERMINALS | s<>t) connect(s,t) = NTERM - 1 ! Avoid subcycle

forall(s,t in TERMINALS | s<>t)

level(t) >= level(s) + 1 - NTERM + NTERM*connect(s,t) ! Direct all connections towards the root (node 1)

forall(s in 2..NTERM) sum(t in TERMINALS | s<>t) connect(s,t) = 1 forall(s,t in TERMINALS | s<>t) connect(s,t) is_binary

! Solve the problem minimize(Length) end-model

12.4.3

Results

The optimal solution connects the terminals as shown in Figure12.6. The total length of cable required is 470 meters. T6 T2 T4 T3 T1 T5 92 110 93 72 103

Figure 12.6: Optimal network of connections