Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
"A tourist want to go from Liverpool to Sydney, visiting a number of other cities in the process.
for each pair of cities, he can travel by car, train or ferry, each option has a Cost and Time.
the goal is to go to syndey,traversing all cities in the process whilst keeping the time and cost to a minimum."
1-how do i verify that this problem is NP? given total time T and total cost C?
i.e: if i have 5 nodes, connected by 4 edges,
each edge has 3 options (car,ferry,train)
each option has Cost and time
how do i process the constraints? do i just try all permutations ?
2-i need guidance on actual solution, i do realize this is a subset of the Minimum spanning tree , but now i have 2 constraints, time and cost..how to tackle that ?
This kind of problem is solved with the Hungarian algorithm
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Say I'm a runner, ran a fixed distance of 42KM, no more, no less.
There are a couple of cities (or shops if you think distances between cities are normally bigger than 42KM) can be traversed in this range.
You can start from ANY vertex(city), how to schedule a route so that I can reach the most number of cities? The runner visit each city exactly once and returns to the origin city. (When the runner returned to the original point, the KMs he ran could be smaller than 42KM)
In real world, this graph should be a cyclic able, non-directed, weighted graph.
However, you are welcome to give any opinion including changing the constraints.
Edit:
I had a brute force solution as follows, still trying to find out a better solution.
(1) setup a collection of possible result set (E.g. 4 cities, a, b, c, d; then I get a combination of 2 cities[ab,ac,ad,bc,bd,cd], 3 cities[abc,abd,acd,bcd], 4 cities[abcd]);
(2) run TSP on each of this result, the result is a distance; if this distance is smaller than 42KM, this result is a candidate.
(3) from the candidate list, choose the one with most cities. This is a brute force solution, however.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am looking for an optimal seat allocation algorithm, such that for example, if i have a cinema with capacity 100, and n groups of people, i want to choose the right groups that will fill in as maximum seats as possible.
The only thing that will work is brute force, but I'm sure there must be cleverer ways to do that. Any ideas?
This is a special case of the Knapsack problem known as the Subset Sum problem. There is a lot of work already done on this so the wiki article is a good jumping off point discussing many possible algorithms. The correct choice in algorithm will depend on the sort of data you’re operating on.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
You may have heard that last year it was proven that the smallest number of starting clues for a Sudoku game, guaranteeing a unique solution, is 17.
An example is shown below.
I am interested in the opposite:
What is the largest number of starting clues for a Sudoku game that does not guarantee a unique solution?
I have a lower bound of 63. This is if you take a solved Sudoku and delete every instance of two numbers (i.e., delete all the 1s and 2s). Alternatively, you could delete the top two rows, again yielding two different solutions for 63 starting clues.
Can you do better than 63, or is 63 is the highest?
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Maximum degree of concurrency is the maximum number of task that can be executed concurrenty.
I believe the graph's max degree of concurrency is 2. Because only two task can be executed at the same time and others have to wait for another. However in solution, it was given 8. What do you think?
In general, for task-dependency graphs that are trees, the
maximum degree of concurrency is always equal to the number of leaves in the tree. That's why it is 8.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
There are n bins and m balls. Balls are with different weights, say ball i has weight w_i. Is there an algorithm that assigns balls into x<n bins so that maximal load of these bins is minimized.
This is equivalent to the multiprocessor scheduling problem, which is NP-complete. In other words: algorithm(s) exist, but they are very slow.
This is a disguised hash function question. i.e. You are looking for an optimal hash function. Check out this page - http://en.wikipedia.org/wiki/Hash_function
Generally you want a random key that you can XOR with w_i then take the result mod n to get the bin number.
Note: I took maximal load to mean number of balls per bin. Hashing of course does not work if you want to minimize the weight of each bin.