• Tidak ada hasil yang ditemukan

CHAPTER 4 Optimization

4.4 Integer linear programming

DRAFT - Version 2 - Integer linear programming

Consider the network flow graph in Figure 4. Here, the node s represents the source and has a total capacity of 11.6 leaving it. The sink, denoted t, has a capacity of 25.4 entering it. The maximum capacity from s to t can be no larger than 11.6, but may be smaller, depending on the intermediate paths.

FIGURE 4. Example of a network flow problem

We can compute the maximal flow that can be sustained on a network flow graph using linear programming. Denote the capacity of the link ij from i to j by cij and the amount of traffic assigned to that link (as part of a flow from s to t) by fij. For example, in Figure 4, c12 = 10.0 and we may assign f12 = 2.3 on it as part of the overall flow from s to t. There are three types of constraints on the fijs:

1. Capacity constraints: the flow on a link cannot exceed its capacity, that is, .

2. Conservation conditions: all the flow entering a node (other than the sink) must exit it; that is, for all nodes j other than

sand t, .

3. Non-negativity:

Given these constraints, the objective function maximizes the flow leaving s. That is O = . The LP is now easy to frame. It consists of the capacity inequalities (written as equalities after introducing slack variables), the conservation condi- tions (with the right hand side carried over to the left and adding slack variables), and the conditions on the flows being non- negative. Some examples of these constraints are: on edge 5-7, and at vertex 3, .

„

DRAFT - Version 2 - Network flow

111

Two users, Alice and Bob, can schedule jobs on a machine in one of two time periods, Period 1 or Period 2. If Alice sched- ules a job during Period 1, she gains a benefit of 20 units, and incurs a cost of 10 units, and during Period 2, she gains a ben- efit of 10 units and incurs a cost of 20 units. If Bob schedules a job during Period 1, he gains a benefit of 100 units and incurs a cost of 10 units, and during Period 2, he gains a benefit of 10 units and incurs a cost of 200 units. Each user may schedule at most one job in one time unit and in each time period, at most one job can be scheduled. There are only four jobs to sched- ule. Express this system in standard form to maximize the benefit derived from the assignment of user jobs to time periods (also called a schedule).

Solution:

The control parameters here are the choice of assignments of user jobs to time periods.We have four jobs and only two time periods. Let xij be a control parameter that is set to 1 if user i is assigned to schedule a job in time period j. A user can sched- ule at most two jobs (one in Period one, and one in Period two), so:

; In each time period, we can have at most one job scheduled, so:

;

If Alice's job is scheduled in Period 1, the net benefit is (20-10) and if it isn't, the benefit is 0. The benefit to Alice in time Period 1, therefore, as: x11(20-10). Similarly, taking into account the other costs and benefits, the overall objective function is:

O = x11(20-10) + x12(10-20) + x21 (100-10) + x22(10-200) = 10x11 -10 x12 + 90x21 -190x22

Note that the constraints are not in standard form because of the inequalities. We can rewrite the constraints using the slack variables s1 - s4 as:

; ; ; or

;

This expresses the system in standard matrix form. Note that all the xijs must be 0 or 1, and therefore the system is an ILP.

„

There are three alternatives to solving an ILP. One approach is to carefully model the system so that the input size is small which would minimize the time taken by an ILP solver. A second approach is to not require the solution to be optimal and accept sub-optimal solutions found using heuristic approaches such as those discussed in Section 4.7 on page 117. A third approach, discussed next, allows certain ILPs to be solved as if they were LPs.

x11+x12≤2 x21+x22≤2

x11+x21≤1 x12+x22≤1

x11+x12+s1 = 2 x12+x22+s2 = 2 x11+x21+s3 = 1 x12+x22+s4 = 1

1 1 0 0 1 0 0 0 0 0 1 1 0 1 0 0 1 0 1 0 0 0 1 0 0 1 0 1 0 0 0 1

x11 x12 x21 x22 s1 s2 s3 s4

2 2 1 1

=

x11 x12 x21 x22 s1 s2 s3 s4

0 0 0 0 0 0 0 0

DRAFT - Version 2 - Integer linear programming

4.4.1 Total unimodularity

An ILP can be solved as a LP, ignoring integer constraints, if A is totally unimodular. A square, integer matrix A is called unimodularif its determinant is either 0, +1 or -1. An integer matrix (which may itself not be square) is called totally unimodularif every square, nonsingular submatrix is unimodular.

In practice, there is a simple test for unimodularity:

1. Every entry is either 0, 1, or -1.

2. There are zero, one, or two non-zero entries in any column.

3. The rowscan be partitioned into two sets A and Bsuch that:

(a) If a column has two entries of the same sign, one of these is in A, and the other is in B.

(b) If a column has two entries of different signs, both entries are in either A or B.

EXAMPLE 7: A TOTALLYUNIMODULARMATRIX

Here is an example of a totally unimodular matrix:

The matrix can be divided into two sets of two rows (the first and second and the third and fourth) that meet the test for uni- modularity.

„

Like LP, ILP can also be used to model a variety of problems. As an example, we study the use of ILP to solve the weighted bipartite matching problem.

4.4.2 Weighted bipartite matching

A bipartite graph is a graph where the vertices can be divided into two sets such that all the edges in the graph have one ver- tex in one set and another vertex in another set (see Figure 5). Such graphs arise naturally in many problems. For instance, one set of vertices could represent a set of demands and the other set could represent a set of resources. Edges then show the resources that could meet each demand. A weight on such an edge could represent the goodness of fit or perhaps the cost of the resource.

FIGURE 5. Example of a weighted bipartite graph.

Ax = b

1 1 0 0 1 0–1 –1 0 0 1 0 0 1 0 0 0 –1–10

10.0 12.2

5.9

0.5 13.1

12.3 9.2

1.6

U V

DRAFT - Version 2 - Weighted bipartite matching

113

A matching M on a graph is the subset of edges such that no two edges in this set share a common vertex. ‘Matching’ indi- cates that each edge in M matches one vertex in one set (say, a demand) to a vertex in another set (say, a resource). A maxi- mal weighted matching is a matching such that the sum of the edge weights, summed over the edges in M, is the greatest. If only one such matching exists, it is also the maximum weighted matching.

ILP can be used to find the maximal weighted matching in a bipartite graph. Let Uand V be the two sets of vertices and let uv refer to an edge that goes from some element u in U to some element v in V. Let wuv be the weight of such an edge.

Define integer variables xuv that are set to 1 if the corresponding edge is in the matching M and 0 otherwise. The total weight of a matching is and this is the value we wish to maximize in the LP (i.e., this is the objective function).

In a matching, there should be at most one edge from an element in U to an element in V and vice versa (note that there may be no edge incident at some node in U or V in M if |U| and |V| are not equal). It is convenient to convert the original graph, where not every element in Uhas an edge to an element in V, to a complete graph, where we add extra zero-weight edges so that every element in U has |V| edges. Then, the constraints are:

;

The first constraint ensures that at most one edge in M leaves every node in U. If this is an extra edge, it adds zero weight to M’s weight and can be ignored in the final solution. Similarly, the second constraint ensures that at most one edge is incident at every node in V. With these constraints, an ILP solver can be used to solve the maximal weighted matching problem.