Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
100% found this document useful (1 vote)
62 views

Computer Network Assignment Help

The document discusses two computer network assignment problems: 1) A simplex example problem involving maximizing an objective function subject to constraints. The problem is solved using the simplex method through multiple pivots to arrive at the optimal solution. 2) Two NP-completeness problems - (a) proving the TRIPLE-SAT decision problem is NP-complete by reducing SAT to it, and (b) proving the DONUT decision problem is NP-hard by reducing 3SAT to it, which implies no efficient algorithm exists unless P=NP.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
62 views

Computer Network Assignment Help

The document discusses two computer network assignment problems: 1) A simplex example problem involving maximizing an objective function subject to constraints. The problem is solved using the simplex method through multiple pivots to arrive at the optimal solution. 2) Two NP-completeness problems - (a) proving the TRIPLE-SAT decision problem is NP-complete by reducing SAT to it, and (b) proving the DONUT decision problem is NP-hard by reducing 3SAT to it, which implies no efficient algorithm exists unless P=NP.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

For any Assignment related queries, Call us at : - 

+1 678 648 4277


You can mail us at : - support@computernetworkassignmenthelp.com or
reach us at : - https://www.computernetworkassignmenthelp.com/

Computer Network Assignment Help


Problem 8-1. A Simple Simplex Example Consider a linear
program (LP) consist ing of two variables x1 and x2 satisfying the
following three constraints:

The goal is to maximize the value of the objective function p = 4x1


+ x2.

(a) Draw a diagram of the feasible region.

Solution:
Figure 1: The feasible region of the LP problem. Image courtesy of
Finite mathematics & Applied calculus

(b) Write the given LP in standard form, and transform this


standard form representation into slack form.

Solution:
Standard form:
Maximize p = 4x1 + x2, subject to:

(c) Use Simplex to solve the resulting slack form LP. Identify the
pivots you choose and give the resulting modified LPs and the
successive feasible solutions. Indicate the successive solutions
on your diagram from Part (a).

Solution: Start with x1 = x2 = 0, x3 = 10, x4 = 20, x5 = 24, that is,


the solution (0, 0, 10, 20, 24), with objective function value p =
0. The first nonbasic variable we select for pivoting can be
either x1 or x2, since both have positive coefficients in the
objective function. To be specific, let’s choose x2. As we
increase x2, the values of x3 and x5 decrease. The limiting
constraint is the one for x5: we can only increase x2 to 8,
because any more would make x5 negative. We exchange x2
with x5: We solve the third constraint for x2, obtaining x2 = 8
− 1 3 x1 − 1 3 x5. Then we substitute, resulting in the
following new LP:
Maximize p = 8 + 11 x1 − 1 x5, subject to:

We get a new solution by setting the non-basic variables, x1 and


x5 equal to 0 and calculating the others: (0, 8, 2, 28, 0). The
value of the objective function is now p = 8. The only option
now for pivoting is x1, because the coefficient of x5 in the
objective function is negative. As we increase x1, the values of
x2, x3, and x4 all decrease. The limiting constraint is the one for
x3; we can only increase x1 to 3. We exchange x1 with x3, and
solve the first constraint for x1, obtaining x1 = 3 − 2 3 x3 + 2 1
x5. We get the following new LP:

Maximize p = 19 − 11 x3 + 3 x5, subject to:

We get a new solution by setting x3 and x5 to 0, obtaining (3, 7, 0,


14, 0). The value of the objective function is now p = 19.
Next, we pivot on x5. Increasing x5 causes x4 and x2 to decrease,
with the limiting constraint being the one for x4. We exchange x5
with x4, and obtain x5 = 6 + 13 x3 − 2 5 5 x4. We obtain the
following new LP:
Maximize p = 28 − 8 5 x3 − 5 3 x4,

We get a new solution by setting x3 and x4 to 0, obtaining (6, 4, 0,


0, 6), with an objective function value of 28. At this point no further
pivots are possible (their co efficients in the objective function are
both negative). Thus, an optimal solution is x1 = 6,x2 = 4.
In the above process, we started from the basic solution (0,0)
meaning x1 = 0, x2 = 0, gradually improved our estimates through
(0,8), (3,7), and finally arrived at the final solution (6,4). In Figure
1, this corresponds to traversing four corners of the white region
starting from the origin in the clockwise direction.

(d) Give the dual LP of your standard-form LP from Part (b) and
give its optimal value. (Hint: Use your solution to Part (c).)

Solution: The standard-form LP from Part (b) is: Maximize p =


4x1 + x2, subject to:

As in CLRS p. 880, the dual LP uses new variables y1, y2, and y3.
The LP is: Minimize 10y1 + 20y2 + 24y3, subject to:
By LP duality (Theorem 29.10), the minimum value
for this LP is 28. This value is attained when y1 = 5 8 , y2 = 5 3 ,
and y3 = 0. You can find this solution manually, or by considering
the final slack form LP in your solution in Part (c) and using
formula (29.91) on p. 882.

Problem 8-2. NP-Completeness

In this problem, you will prove NP-completeness of a few decision


problems. To prove NPhardness, you may reduce from any problem
that has been shown, in class or in CLRS, to be NP-complete.

(a) Let TRIPLE-SAT denote the following decision problem: given


a Boolean formula φ, decide whether φ has at least three distinct
satisfying assignments. Prove that TRIPLE-SAT is NP-
complete.

Solution: To show that TRIPLE-SAT is in NP, for any input formula


φ, we need only guess three distinct assignments and verify that
they satisfy φ. To show that TRIPLE-SAT is NP-hard, we reduce
SAT to it. Let φ denote the input Boolean formula to a SAT
problem and suppose that the set of variables in φ are X =
{x1,...,xn}. We construct a TRIPLE-SAT problem with a
Boolean formula φ/ over a new variable set X/ as follows:

• X/ = {x1,...,xn, y, z}.
• φ/ = φ.

Now we claim φ is satisfiable iff φ/ has at least 3 satisfying


assignments. If φ is satisfiable, then we can augment any particular
assignment by adding any of the 4 possible pairs of values for {y,
z} to give at least four satisfying assignments overall. On the other
hand, if φ is not satisfiable, then neither is φ/.

(b) In Problem Set 1, we considered how one might locate donut


shops at some of the vertices of a street network, modeled as an
arbitrary undirected graph G = (V, E). Each vertex u has a
nonnegative integer value p(u), which describes the potential profit
obtainable from a shop located at u. Two shops cannot be located
at adjacent vertices. The problem was to design an algorithm that
outputs a subset s U ⊆ V that maximizes the total profit u ∈U p(u).
No doubt, you found an algorithm with time complexity that was
exponential in the graph parameters. Now we will see why.
Define DONUT to be the following decision problem: given an
undirected graph G = (V, E), given a mapping p from vertices u ∈
V to nonnegative integer profits p(u), and given a nonnegative
integer k, decide whether there is a subset U ⊆ V such that no two
vertices in U are neighbors in G, and such that s that DONUT is
NP-hard. Prove (Hint: Try a reduction from 3SAT.) u∈U p(u) ≥ k.
Also, explain why this implies that, if there is a polynomial-time
algorithm to solve the original problem, i.e., to output a subset U
that maximizes the total profit, then P = NP.

Solution: Let φ = C1 ∧ C2 ∧ ...Cm be the input formula to a 3SAT


problem, where each clause Cc has three literals chosen from {xi,
x¯i11 ≤ i ≤ n}. We construct a DONUT problem (G, p, k) as
follows. The vertices V of G are {vc,j 11 ≤ c ≤ m, 1 ≤ j ≤ 3}, where
vc,j corresponds to literal j in clause Cc. We label each vertex vc,j
with xi or x¯i, whichever appears in position j of clause Cc. The
edges E of G are of two types:
• For each clause Cc, an edge between each pair of vertices
corresponding to literals in clause Cc, that is, between vc,j1 and
vc,j2 for j1= j2.
• For each i, an edge between each pair of vertices for which one is
labeled by xi and the other by x¯i.

The function p maps all vertices to 1. The threshold k is equal to m.


We claim that φ is satisfiable iff the total profit in the DONUT
problem (G, p, k) can be at least k.
First, suppose that φ is satisfiable. Then there is some truth
assignment A mapping the variables to {true, false}. A must make at
least one literal per clause true; for each clause, select the vertex
corresponding to one such literal to be in the set U. Since there are
m clauses, this yields exactly m = k vertices, so the total profit is k.
Moreover, we claim that U cannot contain two neighboring vertices
in G. Suppose for contradiction that u, v ∈ U and (u, v) ∈ E. Then
the edge (u, v) must be of one of the two types above. But u and v
cannot correspond to literals in the same clause because we selected
only one vertex for each clause. And u and v cannot be labeled by xi
and x¯i for the same i, because A cannot make both a variable and
its negation true. Since neither possibility can hold, U cannot
contain two neighboring vertices. U achieves a total profit of k for
the DONUT problem (G, p, k).
Conversely, suppose that there exists U ⊆ V , |U| ≥ k = m
containing no two neighbors in G. Since U does not contain
neighbors, it cannot contain two vertices from the same clause.
Therefore, we must have |U| = m, with exactly one vertex from
each clause. Now define a truth assignment A for the variables:
A(xi) = true if some vertex with label xi is in U, and A(xi) = false
if some vertex with label x¯i is in U. For other variables the truth
value can be arbitrary. Also since U does not contain neighbors, U
cannot contain two vertices with contradictory labels, so
assignment A is well-defined. A satisfies all clauses by making one
literal corresponding to a vertex in U true in each clause.
Therefore, A satisfies φ. For the last question, suppose that there is
a polynomial-time algorithm to solve the original problem, i.e., to
output a subset U that maximizes the total profit. Then this
algorithm can be easily adapted to a polynomial-time algorithm for
DONUT: for any (G, p, k), simply run the assumed algorithm and
obtain an optimal subset U. Then output true if k ≤ |U|, and false
otherwise. Since we have already shown that DONUT is NP-hard,
this implies that P= NP.

(c) Suppose we have one machine and a set of n tasks a1,a2,...,an.


Each task aj requires tj units of time on the machine, yields a profit
of pj , and has a deadline dj . Here, the tj , pj , and dj values are
nonnegative integers. The machine can process only one task at a
time. Not all tasks have to be run, but if a task starts running, it
must run without interruption and must complete by its deadline.
A schedule for a subset of the tasks describes when each of the
tasks in the subset starts running. A schedule must observe the
constraints given above. The profit for the schedule is the sum of
all the pj values for the tasks aj in the schedule.
The problem is to produce a schedule for a subset of the tasks that
returns the greatest possible amount of profit. State this problem as
a decision problem and show that it is NP-complete. In showing
this, you may reduce from any problem that has been shown, in
class or in CLRS, to be NP-complete.

Solution: Define SCHED to be the following decision problem:


given (T, P, D, k) where T , P , and D are sequences {tj }, {pj} and
{dj }, each of length n, decide whether there exists a subset I ⊆
{1,...,n} and an ordering i1,i2,...,im of I, such that:

1. For every j, sj l=1 T (il) ≤ D(ij ). That is, the sum of the running
times of the f irst j tasks being run is no greater than the
deadline for the jth task. That means that, when run in the given
order, all tasks meet their deadlines.
2. Σ l=1 s m P (il) ≥ k. That is, the total profit is at least k.

To see that SCHED is in NP, given an instance (T, P, D, k), we


can guess a subset of the tasks and a sequence of start times,
and verify that it meets all the constraints for a schedule and
that it finishes within the given time k.
To show that SCHED is NP-hard, we can reduce from
SUBSET-SUM, defined on p. 1097 of CLRS. Given an instance
(S, t) of SUBSET-SUM, where |S| = n, order the elements of S
arbitrarily, as s1, . . . , sn. We construct an instance (T, P, D, k)
of SCHED as follows: Let T = P = {s1,...,sn} in that order, let D
be a length-n sequence consisting of t in every position, and let
k = t. We claim that the answer to the SUBSET-SUM problem
(S, t) is “yes”, iff the answer to the SCHED problem (T, P, D, k)
is “yes”.
First, the answer to the SUBSET-SUM problem (S, t) is “yes”.
Then there is a subset S/ of the elements in S whose sum is exactly
t. Let I be the set of indices of the S/ elements within the sequence
s1,...,sn, and let i1, i2, . . . ,im order I in increasing order. Then the
sum of the running times of all tasks is exactly t, that is, s m s m
l=1 T (il) = t. This implies that all tasks meet their deadlines.
Moreover, the total profit is exactly l=1 P (il) “yes”. = t = k.
Therefore, the answer to the SCHED problem (T, P, D, k) is
Conversely, suppose the answer to the SCHED problem (T, P, D,
k) is “yes”. Then there is a subset I of 1, . . . , n and an ordering i1,
i2, . . . , im of I, such that:
1. For every j, sj l=1 T (il) ≤ D(ij ).
2. Σ m l=1 P (il) ≥ k.
Since all of the deadlines are equal to k = t, this is the same as
saying:

Since each T (ij ) = P (ij ), this says that s l=1 s m T (il) = m P


(il)= t. Now let S/ be l=1 the subset of S corresponding to the
indices in I, that is, S/ = {si1i ∈ I}. Then the sum of the
elements of S/ is exactly t. Therefore, the answer to the
SUBSET-SUM problem (S, t) is “yes”.

You might also like