/*! This file is auto-generated */ .wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;text-decoration:none;padding:calc(.667em + 2px) calc(1.333em + 2px);font-size:1.125em}.wp-block-file__button{background:#32373c;color:#fff;text-decoration:none} 8 E In the MAX SAT problem, we are g... [FREE SOLUTION] | 91影视

91影视

In the MAX SAT problem, we are given a set of clauses, and we want to find an assignment that satisfies as many of them as possible.

(a) Show that if this problem can be solved in polynomial time, then so can SAT.

(b) Here鈥檚 a very naive algorithm.

for each variable:

set its value to either0or1 by flipping a coin

Suppose the input has m clauses, of which thejth haskj literals. Show that the expected number of clauses satisfied by this simple algorithm is

j=1m1-12k鈥娾赌娾赌m2

In other words, this is a 2-approximation in expectation! And if the clauses all contain literals, then this approximation factor improves to 1+1/2k1.

(c) Can you make this algorithm deterministic? (Hint: Instead of flipping a coin for each variable, select the value that satisfies the most of the as of yet unsatisfied clauses. What fraction of the clauses is satisfied in the end?)

Short Answer

Expert verified

This problem can be solved in polynomial time is shown below.

b). Thenaive algorithm is proved.

c). Yes, this algorithm is deterministic.

Step by step solution

01

MAX SAT problem

MAXSAT (the maximum satisfiability problem) is stated as follows is defined as given a set of clauses with weights, find a truth assignment that maximizes the sum of the weights of the satisfied clauses.

In the multiway cut problem, we are given a graph with k special vertices Our goal is to find the smallest set of edges which when removed from the graph disconnect the graph into at least k components where each is in a different component. When ,

this is exactly the min s-t cut problem, but if the problem becomes . Consider the following algorithm.

Let Fi be the set of edges in the minimum cut with si one one side and all other special vertices on the other side. And output is , the union of all . Also note that this is a multiway cut because removing from isolates in its own component.

02

MAX SAT problem can be solved in polynomial time.

MAX- SAT PROBLEM is solvable in polynomial time and two-SAT is -Hard.

MAX-two-SAT is -Hard and its decision version is NP-Complete, while two-SAT is in and hence also in . This means that 2-SAT is polynomial-time reducible to (the decision version of) MAX-2-SAT. The converse is not true unless = be a two-SAT formula with mm clauses. If you really want to reduce an instance of two-SAT to (the decision version of) MAX-two-SAT, then this simply amounts to checking whether at least mm (i.e., all) clauses of are satisfiable.

2SAT is the problem of counting the number of satisfying assignments to a given two-Chomsky normal form formula. This counting problem is -complete, which implies that it is not solvable in polynomial time unless = .

there are (this is a polynomial algorithms). We can bound this through some very simple observations.

1. Initially E厂,厂炉0,

2. In every iteration,E厂,厂炉 increases by at least one, and

3.E厂,厂炉is always at most mn.

Thus, the problem exhibits a phase transition at 伪 = 1. In the maximum-2-satisfiability problem ( MAX-2-SAT ), the input is a formula in conjunctive normal form with two literals per clause.These facts in the graphG=V,E clearly imply that the number of iterations is at most mn., and thus the total running time is polynomial. To prove the next theorem about the approximation ratio, we will do something which is very common when analyzing local search algorithms. We will not reason directly about the solution which the algorithm outputs, but will instead reason about an arbitrary local optimum. Since the algorithm outputsS,T a local optimum,

Hence, MAX SAT problem is solved in polynomial time

03

Naive algorithm

Naive algorithm is exact string matching it means finding one or all exact occurrences of a pattern in a text algorithm. This algorithm is helpful for smaller texts. It does not need any pre-processing phases. We can find substring by checking once for the string.

for each variable.

set its value to either0or1 by flipping a coin

Suppose the input has m clauses, of which thejth haskj literals. Show that the expected number of clauses satisfied by this simple algorithm is ,

j=1m1-12k鈥娾赌娾赌m2

This is a 2-approximation in expectation! And if the clauses all contain literals, then this approximation factor improves to1+1/2k-1.

04

Deterministic Algorithm

Here, each coin of a given denomination can come an infinite number of times. (Repetition allowed), this is what unbounded knapsack and have two choices for a coin of a particular denomination, either

i) to include, or

ii) to exclude. But here, the inclusion process is not for just once; we can include any denomination any number of times until N<0.

Basically, If we are at sm-1, we can take as many instances of that coin is known as unbounded inclusion that is, countS,m,nSm-1; then we move to After moving to sm-2., we can鈥檛 move back and can鈥檛 make choices for s[m-1] thart iscountS,m,nSm-1;

Finally, as we have to find the total number of ways, so we will add these two possible choices, i.e countS,m,nSm-1;+countS,m-1,n;

Instead of flipping a coin for each variable ,in first step just select the value that satisfies the most of the as of yet unsatisfied clauses. The definite fraction of the clauses is satisfied in the end.

Hence, each coin of a given denomination can come an infinite number of times. (Repetition allowed), this is what unbounded knapsack and have two choices for a coin of a particular denomination and this is deterministic in nature.

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with 91影视!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

Devise a branch-and-bound algorithm for the SET COVER problem. This entails deciding:

(a) What is a subproblem?

(b) How do you choose a subproblem to expand?

(c) How do you expand a subproblem?

(d) What is an appropriate lowerbound

Do you think that your choices above will work well on typical instances of the problem? Why?

In the backtracking algorithm for SAT, suppose that we always choose a subproblem (CNF formula) that has a clause that is as small as possible; and we expand it along a variable that appears in this small clause. Show that this is a polynomial-time algorithm in the special case in which the input formula has only clauses with two literals (that is, it is an instance of 2SAT).

In the MINIMUM STEINER TREE problem, the input consists of: a complete graph G=(V,E)with distances duvbetween all pairs of nodes; and a distinguished set of terminal nodesV'V.The goal is to find a minimum-cost tree that includes the vertices V'. This tree may or may not include nodes in V-V'

Suppose the distances in the input are a metric (recall the definition on page 292). Show that an efficient ratio-2approximation algorithm for MINIMUM STEINER TREE can be obtained by ignoring the nonterminal nodes and simply returning the minimum spanning tree onV'. (Hint: Recall our approximation algorithm for the TSP.)

Devise a backtracking algorithm for the RUDRATA PATH problem from a fixed vertex s. To fully specify such an algorithm you must define:

(a) What is a subproblem?

(b) How to choose a subproblem.

(c) How to expand a subproblem.

Argue briefly why your choices are reasonable

Local search for minimum spanning trees. Consider the set of all spanning trees (not just minimum ones) of a weighted, connected, undirected graphG=(V,E).

Recall from Section 5.1 that adding an edge to a spanning treeT creates an unique cycle, and subsequently removing any other edgee'e from this cycle gives back a different spanning treeT' . We will say that differ by a single edge swap (e,e')and that they are neighbors.

a) Show that it is possible to move from any spanning tree Tto any other spanning tree T' by performing a series of edge-swaps, that is, by moving from neighbor to neighbor. At most how many edge-swaps are needed?

(b) Show that ifT' is an MST, then it is possible to choose these swaps so that the costs of the spanning trees encountered along the way are nonincreasing. In other words, if the sequence of spanning trees encountered is

T=T0T1T2Tk=T',

then cost(Ti+1)cost(Ti)foralli<k.

(c) Consider the following local search algorithm which is given as input an undirected graph G.

Let Tbe any spanning tree of G

while there is an edge-swap(e,e') which reduces cost(T):

TT+ee'returnT

Show that this procedure always returns a minimum spanning tree. At most how many iterations does it take ?

See all solutions

Recommended explanations on Computer Science Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.