Questions tagged [np-complete]

NP-Complete refers to the hardest known problems within the complexity class NP. The "Traveling salesman problem" is one of the most widely known NP-Complete problems.

The classic method of attacking NP-complete problems is to try and prove that P = NP. Once a PTIME solution has been proven to exist for at least one NP-complete problem, that could be used to solve all of the others via reduction.

This is an active area of research. Communications of the ACM Volume 52, Number 9 (2009), Pages 78-86: The Status of the P vs NP Problem gives a good overview of the problem and current approaches to resolving it. (The article is freely available here.)

Apart from that, there are some approaches that can be used to get useful—although not optimal—solutions to NP-complete problems in practice:

  • Brute force
  • Heuristics that produce "reasonably good" results most of the time
  • Arbitrary approximation algorithms that can produce increasingly better solutions the longer they are allowed to run
  • Genetic algorithms, which try to find multiple "reasonably good" solutions and then "mutate" these solutions to get even better solutions.
340 questions
11
votes
1 answer

np-completeness in the bounded degree spanning tree

I understand why the Bounded Degree Spanning Tree is considered NP Complete with a degree or 2 (it is an instance of the Hamiltonian Path Problem), but I do not understand why this applies to degrees > 2. If someone could please explain why this is…
user730882
11
votes
8 answers

Is this variant of the subset sum problem easier to solve?

I have a problem related to the subset sum problem and am wondering if the differences make it easier, i.e. solvable in a reasonable amount of time. Given a value V, a set size L, and a sequence of numbers [1,N] S, how many size L subsets of S sum…
dsimcha
  • 67,514
  • 53
  • 213
  • 334
11
votes
6 answers

Suggest an algorithm (graph - possibly NP-Complete)

There is a network of towns, connected by roads of various integer lengths. A traveler wishes to travel in his car from one town to another. However, he does not want to minimize distance traveled; instead he wishes to minimize the petrol cost of…
Andrew Wills
  • 111
  • 4
10
votes
3 answers

NP-complete knapsack

I saw this ECLiPSe solution to the problem mentioned in this XKCD comic. I tried to convert this to pure Prolog. go:- Total = 1505, Prices = [215, 275, 335, 355, 420, 580], length(Prices, N), length(Amounts, N), …
Ashley
  • 829
  • 1
  • 5
  • 16
10
votes
2 answers

Factorial-time algorithms and P/NP

It's quite easy to see that n! grows slower than almost anything to the N power (say, 100^N) and so, if a problems is considered NP complete and one happened upon a n! algorithm that approximates the solution, one would do the Snoopy dance. I have 2…
Zian Choy
  • 2,846
  • 6
  • 33
  • 64
10
votes
2 answers

Algorithm/approximation for combined independent set/hamming distance

Input: Graph G Output: several independent sets, so that the membership of a node to all independent sets is unique. A node therefore has no connections to any node in its own set. Here is an example path. Since clarification was called for here…
tarrasch
  • 2,630
  • 8
  • 37
  • 61
10
votes
4 answers

Find set of numbers in one collection that adds up to a number in another

For a game I'm making I have a situation where I have a list of numbers – say [7, 4, 9, 1, 15, 2] (named A for this) – and another list of numbers – say [11, 18, 14, 8, 3] (named B) – provided to me. The goal is to find all combinations of numbers…
JUST MY correct OPINION
  • 35,674
  • 17
  • 77
  • 99
10
votes
7 answers

Find the best combination from a given set of multiple sets

Say you have a shipment. It needs to go from point A to point B, point B to point C and finally point C to point D. You need it to get there in five days for the least amount of money possible. There are three possible shippers for each leg, each…
cmcculloh
  • 47,596
  • 40
  • 105
  • 130
10
votes
2 answers

Solving an extension of the Shortest Hamiltonian Path

I was thinking about an extension to the Shortest Hamiltonian Path (SHP) problem, and I couldn't find a way of solving it. I know it is NP-complete, but I figured I'd ask here for ideas, since I do not want to simply brute force the problem. The…
Undreren
  • 2,811
  • 1
  • 22
  • 34
9
votes
1 answer

Is minimization of boolean expressions NP-Complete?

I know that boolean satisfiability is NP-Complete, but is the minimization/simplification of a boolean expression, by which I mean taking a given expression in symbolic form and producing an equivalent but simplified expression in symbolic form,…
9
votes
2 answers

how to find the least number of operations to compute x^n

here is the problem from ACM International Collegiate Programming Contest Asia Regional Contest, Yokohama, 2006-11-05 Starting with x and repeatedly multiplying by x, we can compute x^31 with thirty multiplications: x^2 = x * x, x^3 = x^2 *…
user467871
9
votes
4 answers

How to design acceptance probability function for simulated annealing with multiple distinct costs?

I am using simulated annealing to solve an NP-complete resource scheduling problem. For each candidate ordering of the tasks I compute several different costs (or energy values). Some examples are (though the specifics are probably irrelevant to the…
flodin
  • 5,215
  • 4
  • 26
  • 39
8
votes
9 answers

Possible NP-complete problem?

I'd just like someone to verify whether the following problem is NP-complete or if there is actually a better/easier solution to it than simple brute-force combination checking. We have a sort-of resource allocation problem in our software, and I'll…
Lasse V. Karlsen
  • 380,855
  • 102
  • 628
  • 825
8
votes
4 answers

How to tell if greedy algorithm suffices for finding minimum coin change?

The minimum coin change problem is an NP-complete problem but for certain sets of coins the greedy algorithm (choose largest denominations first) works. Given a set of integers denoting coin-values, what's the fastest algorithm to determine if the…
pathikrit
  • 32,469
  • 37
  • 142
  • 221
8
votes
3 answers

Best-case Running-time to solve an NP-Complete problem?

What is the fastest algorithm that exists up with to solve a particular NP-Complete problem? For example, a naive implementation of travelling salesman is O(n!), but with dynamic programming it can be done in O(n^2 * 2^n). Is there any perhaps…
Claudiu
  • 224,032
  • 165
  • 485
  • 680
1
2
3
22 23