1 / 55

Linear Programming

Linear Programming. An example of LP problem: Political Elections.

ghada
Download Presentation

Linear Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Linear Programming

  2. An example of LP problem: Political Elections • Suppose that you are a politician trying to win an election. Your district has three different types of areas: urban, suburban, and rural. These areas have, respectively, 100,000, 200,000,and 50,000 registered voters. To govern effectively, you would like to win a majority of the votes in each of the three regions. • you can estimate how many votes you win or lose from each population segment by spending $1,000 on advertising on each issue.

  3. Figure 1: The effects of policies on voters. Each entry describes the number of thousands of urban, suburban, or rural voters who could be won over by spending $1,000 on advertising support of a policy on a particular issue. Negative entries denote votes that would be lost.

  4. • x1 is the number of thousands of dollars spent on advertising on building roads, • x2 is the number of thousands of dollars spent on advertising on gun control, • x3 is the number of thousands of dollars spent on advertising on farm subsidies, and • x4 is the number of thousands of dollars spent on advertising on a gasoline tax. We can write the requirement that we win at least 50,000 urban votes as

  5. Similarly, we can write the requirements that we win at least 100,000 suburban votes and 25,000 rural votes as • And • To minimize the expression

  6. there is no such thing as negative-cost advertising. • We format this problem as

  7. General linear programs • In the general linear-programming problem, we wish to optimize a linear function subject to a set of linear inequalities. Given a set of real numbers a1, a2, ..., an and a set of variablesx1,x2,..., xn, alinear function f on those variables is defined by

  8. are linear inequalities. We use the term linear constraints to denote either linear equalities orlinear inequalities. In linear programming, we do not allow strict inequalities.

  9. A linear programming is in standard form is the maximization of a linear function subject to linear inequalitis. • A linear program in slack form is the maximization of a linear function subject to linear equalities.

  10. Let us first consider the following linear program with two variables (example 2):

  11. We call any setting of the variables x1 and x2 that satisfies all the constraints a feasible solution to the linear program.

  12. Figure 2: (a) The linear program given in example 2. Each constraint is representedby a line and a direction. The intersection of the constraints, which is the feasible region, is shaded. (b) The dotted lines show, respectively, the points for which the objective value is 0, 4, and 8. The optimal solution to the linear program is x1 = 2 and x2 = 6 with objective value8.

  13. Because the feasible region in Figure 2 is bounded, there must be some maximum value z for which the intersection of the line x1 + x2 = z and the feasible region is nonempty. • An optimal solution to the linear program must be on the boundary of the bounded feasible region. In this case, the point is x1 = 2 and x2 = 6 with objective value 8. An optimal solutionto the linear program occurred at a vertex or a line segment of the feasible region for two variables.

  14. This is because of the convexity of bounded feasible regions. • Similarly, if the LP has n variables, each constraint defines a half-space in n-dimensional space. The feasible region formed by theintersection of these half-spaces is called a simplex. • The objective function is now a hyper-plane and, because of the convexity, an optimal solution will still occur at a vertex of the simplex.

  15. Algorithms for LP • Simplex algorithm – worst case exponential-time. Practical – very simple and performance is good. • Ellipsoid algorithm -- polynomial-time • Interior-point method – polynomial-time.

  16. The basic idea of simplex algorithm • The simplex algorithm takes as input a linear program and returns an optimal solution. • Itstarts at some vertex of the simplex and performs a sequence of iterations. In each iteration, it moves along an edge of the simplex from a current vertex to a neighboring vertex whose objective value is no smaller than that of the current vertex (and usually is larger.)

  17. The simplex algorithm terminates when it reaches a local maximum, which is a vertex from which all neighboring vertices have a smaller objective value. Because the feasible region is convex and the objective function is linear, this local optimum is actually a global optimum. (What if it is non-convex or non-linear)

  18. If we add to a linear program the additional requirement that all variables take on integer values, we have an integer linear program. It has been proven that even finding the feasible region of an integer program is NP-hard.

  19. Standard form • In standard form, we are givennreal numbers c1, c2, ..., cn; mreal numbers b1, b2, ..., bm; and mnreal numbers aijfor i = 1, 2, ..., m and j = 1, 2, ..., n. We wish to findnreal numbers for n variables: x1, x2,..., xnthat maximize the objective function.

  20. We call the maximize expression above, the objective function and the n + m inequalities,the constraints, among themthe n constraints, are called the non-negativity constraints.

  21. In a more compact form for LP, let A = (aij ) be an m x n matrix b = (bi ) be an m dimensional vector c = (cj ) be an n dimensional vector x = (xj ) be an n dimensional vector • We can rewrite the LP as follows:

  22. Where cT x is inner product of two n dimensional vectors; Ax is a matrix-vector Product; x must be non-negative.

  23. A linear program may not be in standard form for one of four possible reasons: 1. The objective function may be a minimization rather than a maximization. 2. There may be variables withoutnon-negativity constraints. 3. There may be equality constraints, which have an equal sign rather than a less-than or -equal-to sign. 4. There may be inequality constraints, but instead of having a less-than-or-equal-to sign, they have a greater-than-or-equal-to sign.

  24. Method to convert to Standard form: • To convert a minimization linear program L into an equivalent maximization linear program L′, we simply negate the coefficients in the objective function. • For example, if we have the linear program

  25. To convert a linear program in which some of the variables do not have non-negativity constraints into one in which each variable has a non-negativity constraint. Suppose that some variable xjdoes not have a non-negativity constraint. Then we replace eachoccurrence of xj by and add the non-negativity constraints

  26. Thus, if the objective function has a term cjxj , it is replaced byAny feasible solution x to the new linear program correspondsto a feasible solution to the original linear program with and with the same objective value, and thus the two solutions are equivalent. • We apply this conversion scheme to each variable that does not have a non-negativity constraint to yield an equivalent linear program in which all variables have non-negativity constraints.

  27. In our previous example, Variable x1has a non-negative constraint, but variable x2does not. To ensure that each variable has a corresponding non-negativity constraint. we replace x2by two variables, x’2 – x’’2 then we solve the modified linear program to obtain x2 = x’2 – x’’2 .

  28. To convert equality constraints into inequality constraints, we can replace this equality constraint by the pair of inequality constraints. • Suppose that a linear program has an equality constraint f (x1, x2, ..., xn) = b. Since x = y if and only if both x ≥ y and x ≤ y, we can replace f (x1, x2, ..., xn) = b by f (x1, x2, ...,xn) ≤ b and f (x1, x2, ..., xn) ≥ b.

  29. Finally, we can convert the greater-than-or-equal-to constraints to less-than-or-equal-to constraints by multiplying these constraints through by -1. That is, any inequality of the form

  30. Thus, by replacing each coefficient aij by -aij and each value bi by -bi, we obtain an equivalentless-than-or-equal-to constraint. Finishing our example, we replace the equality in constraint by two inequalities, obtaining

  31. Finally, we negate constraint. For consistency in variable names, we rename X’ 2to x2and X’’ 2to x3, obtaining the standard form as follows:

  32. Converting linear programs into slack form • To efficiently solve a linear program with the simplex algorithm, we prefer to express it in a form in which some of the constraints are equality constraints. • Let be an inequality constraint. We introduce a new variable s and rewrite inequality as the two constraints:

  33. We call s a slack variable because it measures the slack, or difference, between the left-handand right-hand sides of equation.

  34. we shall use xn+i (instead of s) to denote the slack variable associated with the i th inequality. • The ith constraint is therefore • along with the non-negativity constraint xn+i ≥ 0.

  35. For example, we introduce slack variables x4, x5, and x6, obtaining maximize • The variables on the left-hand side of the equalities are called basic variables, and those on theright-hand side are called non-basic variables.

  36. We shall also use the variable z to denote the value of the objective function. • Thus we can concisely define a slack form by a 5-tuple (N, B, A, b, c, v), denoting the slack form

  37. N – set of indices of nonbasic variables • B – set of indices of basic variables • |N|= n; |B|=m; N U B = {1,2, …, n+m} • A – coefficient matrix of variables b,c – vectors; v -- constant

  38. In this slack form, we have that B= {4,5,6}; N={1,2,3}; A = (a41, a42, a43, a51,a52, a53, a61 ,a62 , a63 ) = (-1, -1, 1, 1, 1, -1, -1 2 -2 ) b = (b4 , b5 , b6 ) = (7, -7, 4) c = (c1 , c2 , c3 ) = (2, -3, 3) v = 0

  39. For more example, the slack form below

  40. Examples for formulation of problems into LP • Shortest paths • Maximum flow • Minimum-cost flow • Multi-commodity flow

  41. Shortest paths • The single-pair shortest path problem: Given a weighted directed graph G = (V,E) weight function w: E  R, a source vertex s and destination vertex t, compute the value d[t], the weight of the shortest path from s to t. • Note that for each edge (u,v) in E, d[v] <= d[u] + w(u,v); d[s] = 0

  42. Shortest paths • We obtain the following linear program to compute the shortest-path weight from nodes s to t: • In this linear program, there are |V | variables d[v]’s, one for each vertex v in V . There are |E| + 1 constraints, one for each edge plus the additional constraint that the source vertex always has the value 0.

  43. Maximum flow • A flow network G=(V,E) is a directed graph s.t. each edge (u,v) in E has non-negative capacity c(u,v) >=0. If (u,v) not in E, then c(u,v)=0. Designate a source s and a sink t in V. G is a connected graph. • A flow in G is a real-valued function f: V X V  R satisfies three properties:

  44. Capacity constraint: for all u,v in V, f(u,v) <= c(u,v) • Skew symmetry: for all u,v in V, f(u,v) <= - f(u,v) • Flow conservation: for all u,v in V-{s,t}, SUMv in V f(u,v) = 0 The value of a flow f is |f| = SUMv in V f(s,v) That is the total flow out of the source s.

  45. The maximum flow problem is defined as Given a flow network G with source s and sink t, find a flow of maximum value. Ford-Fulkerson-method initialize flow f to 0 while there exists an augmenting path p do augment flow f along p returnf O(E |f*|) time, f* the maximum value found by algorithm

  46. Maximum flow • we can express the maximum-flow problem as following linear program: This linear program has |V|-2 variables, corresponding to the flow between each pair ofvertices, and it has 2|V|2 + |V| - 2 constraints.

More Related