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
8
votes
7 answers

How to find what numbers in a set add up to another given number?

Here's a problem that I seem to be running into working with an accounting system. I have a set of transactions, but their sum does not equal the amount that the accounting department thinks that it should. They are not questioning the math, just…
Even Mien
  • 44,393
  • 43
  • 115
  • 119
8
votes
2 answers

find the maximum number of vertex-disjoint paths in a graph with a constraint

Given a undirected graph G=(V,E), each edge is associated with a non-negative value. How to find the maximum number of vertex-disjoint paths from s to t on the graph G, with a constraint that the sum of paths length is not greater than a predefined…
wzb5210
  • 735
  • 2
  • 9
  • 16
7
votes
6 answers

Is this "Valid mathematical expression" problem P, or NP?

This question is purely out of curiosity. I am off school for the summer, and was going to implement an algorithm to solve this just for fun. That led to the above question, how hard is this problem? The problem: you are given a list of positive…
trh178
  • 11,228
  • 5
  • 28
  • 37
7
votes
3 answers

Minimal addition-chain exponentiation

I know it has been proven NP-complete, and that's ok. I'm currently solving it with branch and bound where I set the initial upper limit at the number of multiplications it would take the normal binary square/multiply algorithm, and it does give the…
harold
  • 61,398
  • 6
  • 86
  • 164
7
votes
2 answers

How to divide a set into two sets such that the difference of the average is minimum?

As I understand, it is related to the partition problem. But I would like to ask a slightly different problem which I don't care about the sum but the average. In this case, it needs to optimize 2 constraints (sum and number of items) at the same…
Imtk
  • 133
  • 1
  • 7
7
votes
1 answer

List of problems that are in general NP-hard but have polynomial-time solution in planar graphs?

I encountered many problems that can be formulated as graph problem. It is in general NP-hard but sometimes the graph can be proved to be planar. Hence, I am interested in learning these problems and the algorithms. So far as I know: Max cut in…
Ivan Xiao
  • 1,919
  • 3
  • 19
  • 30
7
votes
9 answers

Have you ever had a business requirement that turned out to be an NP-Complete problem?

NP-completeness seems to me like one of those things that's mostly just theoretical and not really something you'd run into in a normal work environment. So I'm kind of curious if anyone's ever run into a problem at their job that turned out to be…
Davy8
  • 30,868
  • 25
  • 115
  • 173
7
votes
6 answers

Algorithms to find the number of Hamiltonian paths in a graph

I'm trying to solve a slightly modified version of the Hamiltonian Path problem. It is modified in that the start and end points are given to us and instead of determining whether a solution exists, we want to find the number of solutions (which…
efficiencyIsBliss
  • 3,043
  • 7
  • 38
  • 44
7
votes
3 answers

Proof that Dominating Set is NP-Complete

here is the question. I am wondering if there is a clear and efficient proof: Vertex Cover: input undirected G, integer k > 0. Is there a subset of vertices S, |S|<=k, that covers all edges? Dominating Set: input undirected G, integer k > 0. Is…
SecureFish
  • 2,391
  • 7
  • 32
  • 43
7
votes
2 answers

can some sorting be P, NP, and NP-Complete?

I am quite confused, and this is my thought after some reading: P is in NP and NP is in NP-Complete. Therefore, all P could be in NP and NP-Complete? Does that mean there are sorting algorithms that could be NP and NP-Complete? Hope this…
Chaos
  • 307
  • 1
  • 4
  • 13
6
votes
2 answers

How is 2-CNF SAT is in P, while 3-CNF SAT is in NPC?

I am really confused why 2-CNF SAT is in P, while 3-CNF SAT is in NPC. I Read CLRS, and I understand how they prove 3-CNF SAT is in NPC. Can't I use the same reducibility from SAT to 2-CNF-SAT to prove 2-CNF-SAT is in NPC. I don't understand why…
Rave
  • 835
  • 4
  • 15
  • 28
6
votes
1 answer

How to do Binary Encoding in Genetic Algorithm for better results in Timetable Scheduling Problem?

I have a problem of University Timetable Scheduling which I am trying to solve with Genetic Algorithm. I want to know the best encoding type for this problem that can also help me in satisfying few of the constraints. For this problem, the timetable…
6
votes
4 answers

Is this combinatorial optimization problem NP-hard?

I working on a combinatorial optimization problem that I suspect is NP-hard, and a genetic algorithm has been working well with our dataset. We're a research group and plan to publish our results in our field (not in math or CS), and I'd like to…
6
votes
2 answers

Why is TSP NP-hard while the Hamiltonian path NP-complete?

Why aren't these 2 problems, namely TSP and Hamiltonian path problem, both NP-complete? They seem identical.
User
  • 23,729
  • 38
  • 124
  • 207
6
votes
3 answers

Optimal algorithm to count the number of strings a DFA accepts

Here is the question I came across Deterministic finite automaton(DFA) is a finite state machine that accepts/rejects finite strings of symbols and only produces a unique computation (or run) of the automation for each input string. DFAs can be…
pgiitu
  • 1,671
  • 1
  • 15
  • 23
1 2
3
22 23