np-complete

Bin Packing regarding Optimization and Decision Versions

和自甴很熟 提交于 2019-12-11 09:38:14
问题 I'm studying for an exam and we were given a set of practice problems. Here's one I'm struggling with and I hope somebody can help shed some light on the right approach to this problem: Here's my initial go at the problem: Decision Version: To find the optimal solution using the decision version, I would try using various K's until I got a yes answer. Let's say the optimized solution is 7, I would try : k=1, no k=2, no k=3, no k=4, no k=5, no k=6, no k=7, yes. So now that we know that the

How can some NP-Complete problems be also NP-Hard?

≯℡__Kan透↙ 提交于 2019-12-11 09:15:25
问题 I'm trying wrap my heard around P, NP, NP-Complete and NP-Hard in an intuitive way so that I don't have to remember their definitions. In the following image (the left hand scenario, P != NP), there's an overlapping area between NP-Complete and NP-Hard. Does it mean that some problems are both NP-Complete and NP-Hard? I find that contradictory, according to this particular answer: What are the differences between NP, NP-Complete and NP-Hard?. The table in the above link says an NP-Complete

how is sudoku np-complete?

和自甴很熟 提交于 2019-12-11 06:24:22
问题 how is Sudoku an np-complete problem? according to wiki, to be classed as an np-complete problem it must satisfy 2 conditions problem must be in np every other problem in np must be reducible to given problem in polynomial time how is the second condition satisfied? can you give an example? for instance, I don't see any correlation between Sudoku problem and the travelling salesman problem or knapsack problem (kindly forgive poor formatting as I'm typing this question on my mobile device) 回答1

How to optimize this suboptimal Set-Cover solution?

烈酒焚心 提交于 2019-12-11 01:29:33
问题 I wrote this program to test how long it would take to "solve" the set-cover problem. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Diagnostics; using MoreLinq; namespace SetCover { class Program { const int maxNumItems = 10000; const int numSets = 5000; const int maxItemsPerSet = 300; static void Main(string[] args) { var rand = new Random(); var sets = new List<HashSet<int>>(numSets); var cover = new List<HashSet<int>>(numSets); var

Is the 0-1 Knapsack that each item has the same weight NP-complete?

白昼怎懂夜的黑 提交于 2019-12-11 00:57:20
问题 The 0-1 Knapsack problem is known as NP-complete. But if the weight for each item are the same, the problem is still NP-complete? 回答1: No, because you always just take whatever items are the most valuable. 来源: https://stackoverflow.com/questions/11249448/is-the-0-1-knapsack-that-each-item-has-the-same-weight-np-complete

Java: Traveling Salesman - Found polynomial algorithm

ぃ、小莉子 提交于 2019-12-06 16:29:43
问题 Edit : An improvement to this algorithm been found. Your are welcome to see it. This question is the an improvement of my old question. Now I want to show you Java code sample, and explain my algorithm in more details. I think that I found a polynomial algorithm to get an exact solution to the Traveling Salesman Problem. My implementation is build from 5 steps: 1) Quick setup 2) Search for solution 3) Stop condition 1 4) Stop condition 2 5) Stop condition 3 I want to start from step 2 and 3,

Partitioning a list of integers to minimize difference of their sums

老子叫甜甜 提交于 2019-12-06 10:21:35
问题 Given a list of integers l , how can I partition it into 2 lists a and b such that d(a,b) = abs(sum(a) - sum(b)) is minimum. I know the problem is NP-complete, so I am looking for a pseudo-polynomial time algorithm i.e. O(c*n) where c = sum(l map abs) . I looked at Wikipedia but the algorithm there is to partition it into exact halves which is a special case of what I am looking for... EDIT: To clarify, I am looking for the exact partitions a and b and not just the resulting minimum

algorithm to check whether a given graph is subgraph of another graph [closed]

こ雲淡風輕ζ 提交于 2019-12-06 07:32:47
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 assume that we have 2 labeled graphs G and T and the algorithm determine if G a subgraph of T and the corresponding vertices in the main graphT and the subgraph G should have same label That problem is called "subgraph isomorphism" and it is NP-complete (and so likely to be hard). Do you need a general solution

Graph Coloring with using Simulated Annealing

こ雲淡風輕ζ 提交于 2019-12-06 05:34:31
I am trying to come up with the algorithm for a Graph Coloring problem using Simulated Annealing. There is the general algorithm online, but when i look at it, I couldn't understand how can apply this algorithm on this problem. Each node in graph must had diffrent color from it's neibours. How can I use the Simulated annealing algorithm for this. What is the "temperature", "schedule" in this problem? Please help me understand this. Thanks Setting the starting temperature and cooling scheduling parameters correctly is a pain, because you need to have a good value for both before you get a good

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

孤街浪徒 提交于 2019-12-05 21:43:36
问题 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 question): global_finish_time : The total number of days that the schedule spans. split_cost : The number of days by which each task is delayed due to interruptions by other tasks (this is meant to discourage interruption of a task once it has