np

Is “house coloring with three colors” NP?

瘦欲@ 提交于 2019-12-03 03:41:10
Consider the problem described here (reproduced below.) Can some better known NP-complete problem be reduced to it? The problem: There are a row of houses. Each house can be painted with three colors: red, blue and green. The cost of painting each house with a certain color is different. You have to paint all the houses such that no two adjacent houses have the same color. You have to paint the houses with minimum cost. How would you do it? Note: The cost of painting house 1 red is different from that of painting house 2 red. Each combination of house and color has its own cost. Knoothe No, it

What is fixed-parameter tractability? Why is it useful?

拜拜、爱过 提交于 2019-12-02 17:12:35
Some problems that are NP-hard are also fixed-parameter tractable , or FPT. Wikipedia describes a problem as fixed-parameter tractable if there's an algorithm that solves it in time f(k) · |x| O(1) . What does this mean? Why is this concept useful? templatetypedef To begin with, under the assumption that P ≠ NP, there are no polynomial-time, exact algorithms for any NP-hard problem. Although we don't know whether P = NP or P ≠ NP, we don't have any polynomial-time algorithms for any NP-hard problems. The idea behind fixed-parameter tractability is to take an NP-hard problem, which we don't

Reduction to Clique prob

家住魔仙堡 提交于 2019-12-01 11:44:20
Subgraph isomorphism We have the graphs G_1=(V_1,E_1), G_2=(V_2,E_2). Question : Is the graph G_1 isomorphic to a subgraph of G_2 ? (i.e. is there a subset of vertices of G_2, V ⊆ V_2 and subset of the edges of G_2, E ⊆ E_2 such that |V|=|V_1| and |E|=|E_1| and is there a one-to-one matching of the vertices of G_1 at the subset of vertices V of G_2, f:V_1 -> V such that {u,v} ∈ E_1 <=> { f(u),f(v) } ∈ E) Show that the problem Subgraph isomorphism belongs to NP. Show that the problem is NP-complete reducing the problem Clique to it. (Hint: consider that the graph G_1 is complete) I have tried

Proof that the halting problem is NP-hard?

半城伤御伤魂 提交于 2019-11-29 00:12:50
问题 In this answer to a question about the definitions of NP, NP-hard, and NP-complete, Jason makes the claim that The halting problem is the classic NP-hard problem. This is the problem that given a program P and input I, will it halt? This is a decision problem but it is not in NP. It is clear that any NP-complete problem can be reduced to this one. While I agree that the halting problem is intuitively a much "harder" problem than anything in NP, I honestly cannot come up with a formal,

What are NP and NP-complete problems? [closed]

百般思念 提交于 2019-11-28 17:06:54
I am struggling to understand what are nondeterministic polynomial-time problems and NP-complete problems. I understand what polynomial-time solvable problems are, and saw in Wikipedia about NP problems. After reading about this I tried to think about some example problems. As I understand it, depth-first search in an undirected is NP-complete, since each decisions can be made nondeterministically (i.e if I made the wrong decision, I could instead try some other choice) if the graph is large (cit an be polynomial if graph size is small.) Can anyone briefly explain all these NP terms with

Algorithm for creating a school timetable

 ̄綄美尐妖づ 提交于 2019-11-27 16:36:04
I've been wondering if there are known solutions for algorithm of creating a school timetable. Basically, it's about optimizing "hour-dispersion" (both in teachers and classes case) for given class-subject-teacher associations. We can assume that we have sets of classes, lesson subjects and teachers associated with each other at the input and that timetable should fit between 8AM and 4PM. I guess that there is probably no accurate algorithm for that, but maybe someone knows a good approximation or hints for developing it. This problem is NP-Complete ! In a nutshell one needs to explore all

What are NP and NP-complete problems? [closed]

╄→尐↘猪︶ㄣ 提交于 2019-11-27 10:12:18
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 8 years ago . I am struggling to understand what are nondeterministic polynomial-time problems and NP-complete problems. I understand what polynomial-time solvable problems are, and saw in Wikipedia about NP problems. After

Algorithm for creating a school timetable

怎甘沉沦 提交于 2019-11-27 04:08:44
问题 I've been wondering if there are known solutions for algorithm of creating a school timetable. Basically, it's about optimizing "hour-dispersion" (both in teachers and classes case) for given class-subject-teacher associations. We can assume that we have sets of classes, lesson subjects and teachers associated with each other at the input and that timetable should fit between 8AM and 4PM. I guess that there is probably no accurate algorithm for that, but maybe someone knows a good

Sum-subset with a fixed subset size

僤鯓⒐⒋嵵緔 提交于 2019-11-26 14:22:48
The sum-subset problem states: Given a set of integers, is there a non-empty subset whose sum is zero? This problem is NP-complete in general. I'm curious if the complexity of this slight variant is known: Given a set of integers, is there a subset of size k whose sum is zero? For example, if k = 1 , you can do a binary search to find the answer in O(log n) . If k = 2 , then you can get it down to O(n log n) (e.g. see Find a pair of elements from an array whose sum equals a given number ). If k = 3 , then you can do O(n^2) (e.g. see Finding three elements in an array whose sum is closest to a

Sum-subset with a fixed subset size

别等时光非礼了梦想. 提交于 2019-11-26 03:53:23
问题 The sum-subset problem states: Given a set of integers, is there a non-empty subset whose sum is zero? This problem is NP-complete in general. I\'m curious if the complexity of this slight variant is known: Given a set of integers, is there a subset of size k whose sum is zero? For example, if k = 1 , you can do a binary search to find the answer in O(log n) . If k = 2 , then you can get it down to O(n log n) (e.g. see Find a pair of elements from an array whose sum equals a given number). If