Sie sind auf Seite 1von 3

Coursehero >> Illinois >> Roosevelt >> CST 405

Course Hero has millions of student submitted documents similar to the one below including
study guides, homework solutions, papers, and exam answer keys.
to Solutions Final Exam Fall 2008 1 Open Problems In this section every problem is 20 points
for graduate students and 35 points for undergraduate students. Problem 1: Extended systems of
difference constraints. Sometimes in addition to difference inequality constraints we want to
handle upper bound inequality constraints on some variables. So suppose we are given a system
of constraints with n variables and m constraints of a type xi - xj br and p constraints of a type xt
bk . Design an algorithm that can handle this system. Prove its correctness and estimate its
running time. Hint: of course you need to modify constraint-graph-construction and/or Bellman-
Ford-based algorithm. Solution by Radhika Shrivastava. the following algorithm does the job: 1.
Solve the sub-system that does not contain the upper bound constraints of the
form xt bk ; 2. For each constraint of the form xt bk such that d(vt ) > bk
compute yt = d(vt ) - bk where d(vt ) solutions for the subsystem without
upper bounds obtained in step 1 (i.e. using BF); 3. Compute r = maxt yt ; 4.
Compute solution x = d(vi ) - r. i 5. Return x Correctness. The algorithm is
correct since every constraint of the form xt bk is satisfied by construction
while every other constraint is satisfied by correctnesses of BF and Lemma
24.8. Runtime. Step 1 takes O(nm)-time Additional steps take at most O(m)-
time so the total runtime is O(nm) Problem 2: Traveling repair-person. Consider the
following traveling repairperson problem: given a list of cities where repairs must be made. Of
course not all cities are connected to each other by direct highway, but every city on the list is
reachable by road from the base town of the repairperson via other cities. Distances between any
two neighboring cities (i.e. connected by direct highway) are known. The repairperson has to
start in his base city and he must visit every city in the list. Unfortunately, he needs to come back
to the base city after visiting each city to get resupply of new parts. Give an algorithm to find the
shortest total route for the repairperson. Show that it is correct. What's its runtime? Note that the
repairperson is allowed to visit each city multiple times. 1 Solution by Remi Arntzen. The
following algorithm does the job: 1. Construct a graphs G = (V, E) such that V is a set of cities
and E = {(u, v)|u and v are connected by direc 2. Apply BF to G, b where b is the base city; 3.
Return schedule b, 1, b, 2, b, . . . , b, |V |, b in which to each part b, i, b a shortest path from b to i
is associated. The sales person uses the same SSP associated in the schedule to b, i, b to go b i
and back. Thus the total time it takes to visit all cities is 2 n d(i). Note that any permutations of
the set i=1 {1, . . . , |V |} defines another order of visiting of the cities that still obtains the same
total time of the trip as long as SSP is used to and from each city. Correctness. Suppose this
algorithm does not produce the optimal route, i.e. there is another algorithm that produces the
route of length T < 2 n d(i). This algorithm still defines a permutation on {1, . . . , |V |} (by
omitting b form i=1 the route). Thus at some part of T there must be a subpath b i or subpath i b
such that it has distance shorter than SSP, i.e. we have a contradiction. Runtime. Graph
construction takes O(|V | + |E|)-time while BF takes O(|V ||E|)-time. Problem 3: Problem Solving
With LP. Manufacturer of printed circuits has the stock of 200 resistors, 120 transistors and 150
capacitors and is planning to produce two types of circuits: circuit A requires 20 resistors, 10
transistors and 10 capacitors, and circuit B requires 10 resistors, 20 transistors, and 30 capacitors.
If profit of circuit A is $5 and profit of circuit B is $12 how many circuits of each type should be
produced to maximize profit? Solution by Ray Doleijs. Let xa and xb denote the (unknown)
number of produced circuits of typa A and circuits of type B respectively. The capacity
constraint of resistors then is 20xa +10xb 200. Similarly there must be capacity constraints on
transistors and capacitors. WE are trying to maximize profits, so since the objective function
must be 5xa +12xb . The following is the associated linear program: Maximize 5xa + 12xb
subject to 20xa + 10xb 200 10xa + 20xb 120 10xa + 30xb 150 xa , xb 0 Solving this LP using
Simplex we get xa = 6 and xb = 3. Probelm 4: Using Duality. Consider the LP minimize 47x1 +
93x2 + 17x3 - 93x4 subject to -3 -1 -6 1 3 x -1 -2 7 1 5 1 x 0 3 -10 -1 2 -8 ; x3 -7 -6 -11 -2 12 x4
1 6 -1 -3 4 x1 , x2 , x3 , x4 0 Prove, without using any LP code, that x = (1, 1, 1, 1) is optimal. 2
Solution. This is a minimization problem so standard form will be: minimize 47x1 + 93x2 +
17x3 - 93x4 subject to 3 1 6 -1 -3 x 1 2 -7 -1 1 -5 x 0 -3 10 1 2 8 ; x1 , x2 , x3 , x4 0 x3 7 6 11 2
-12 x4 -4 -1 -6 1 3 Therefore the dual program is: Maximize 3y1 - 5y2 + 8y3 + 7y4 - 4y5 subject
to y1 1 1 0 6 -1 47 y2 6 93 2 -3 11 -6 y -1 -7 10 2 1 3 17 y4 -3 -1 1 -12 3 -93 y5 ; y1 , y 2 , y 3 , y
4 , y 5 0 If x = (1, 1, 1, 1) is optimal solution the substituting it into primal LP the optimal value
of objective function must be 64 but then the value of the dual objective function must be the
same, so we have 3y1 - 5y2 + 8y3 + 7y4 - 4y5 = 64. Let us see if we can substitute the dual
constraint inequalities with equations, augment the obtained system with the objective equation
and get a solution for the system of linear equations using any known method (e.g. Gauss-Jordan
matrix reduction or Gaussian elimination). If this solution gives us non-negative values pof yi
then we obtained maximum since these values ill satisfy of constraint inequalities of dual
program and give us required objective function value. 3 -5 8 7 -4 y1 64 1 1 0 6 -1 y2 47 6 2 -3
11 -6 y3 = 93 ; -1 -7 10 2 1 y4 17 -3 -1 1 -12 3 y5 -93 Indeed this system has the nonnegative
solution y1 = 3, y2 = 2, y3 = 2, y4 = 7, y5 = 0 which means that 1.1 TRUE or FALSE In this
section every problem is 2 points for graduate students and 10 points for undergraduate students.
1. Suppose that in a graph G = (V, E, w : E R) there is an edge e that has the weight which is
strictly less than weights of all other edges. Then e belongs to every MST of G. Solution. TRUE.
Suppose there is an MST T that does not contain e. Add e to T . New graph has a cycle by
properties of a free tree. Since e is the lightest edge on this cycle we can remove any other edge
and we still get a tree (it was the only cycle so now the graph is acyclic and connected) that has
weight less than MST T - contradiction. 3 2. Given a system of difference constraints of the form
xi - xj s b where s {, , =} and b 0. To find the solution we transform the system into a standard
form and then apply Bellman-Ford-based algorithm from chapter 24.4. The returned solution
vector x will be positive, i.e. x will be > 0 for all i. i Solution. FALSE. The standard algorithm
connects the supersource to all vertexes of a graph of difference inequalities by edges with
weight= 0 so after one step a solution d(vi ) = 0 is already obtained. The solution value can only
decrease, so it must be 0. 3. The runtime of Bellman-Ford algorithm when an input graph is a
weighted complete tree with n = 2k vertexes is O(k2k ). Solution. TRUE. There are |E| = |V | - 1
= 2k edges in the tree. At each step we relax all edges. In Bellman-Ford there are as many steps
necessary as is the number of edges in a longest simple path. In a general graph longest path may
contain as many as |V | - 1 edges, but in the complete tree with n = 2k vertexes the maximum
path length is at most k (if it is a complete binary tree), so we only need to relax all edges k times
because after that d(vi ) won't change. 4. The following system of difference equation has no
solution: x1 - x5 x1 - x2 x3 - x2 x4 - x1 x4 - x2 x5 - x4 Solution. graph. -1 1 1 3 1 1 2 1 -1
TRUE. There is a negative cycle x1 x2 x4 x1 in the difference constraint 5. Consider the
following class of 1-variable LPs: Maximize tx Subject to rx s; If r, s 0 and t < 0 its dual program
is feasible. Solution. TRUE. The dual program is Minimize sy subject to ry t; y 0. When t < 0 r
the constraint holds for any y 0, so dual is feasible. x0 4 6. Given the following LP is unbounded
Maximize 4x1 + x2 - 5x3 subject to x2 - 3x3 18 4x1 - 2x2 + x3 3 x1 , x2 , x3 0 Solution. TRUE.
IBFS is self-evident. After 2 iterations of simplex. one can see that x3 is unbounded and
contributes to objective function. 7. The following linear program is not feasible: Maximize 2x1
+ 3x2 - x3 subject to 2x1 + 2x2 - x3 3x1 - 2x2 + x3 x1 - 3x2 + x3 x1 , x2 , x3 20 15 10 0
Solution. TRUE. After 3 iterations of INITIALIZE-SIMPLEX objective function obtains the
value -5/4 while at the same time coefficients with all non-basic variables are negative. 5

Das könnte Ihnen auch gefallen