Hi William. Thank you, as always, for your wonderful work! This is fantastic. I tried your code on a 25-cities problem. It was hanging up, eventually erroring out with Out Of Heap memory error. The change that made it work was: I changed this: Double[][] memo = new Double[N][1
For debugging I like Double because it'll throw a NPE if I'm doing something wrong. In this case, I think a primitive double[][] also works, so no reason to use Double[][]. As you've seen, primitives are better if you're trying to boost performance. Tip: a primitive double also plays nicely with Double.POSITIVE_INFINITY and Double.NEGATIVE_INFINITY which can be used as placeholder values when you're trying to find a min/max value.
nice solution. I finally found answer to how we can save a set as key.
Thank you so much for you explanations :)
Hi William. Thank you, as always, for your wonderful work! This is fantastic. I tried your code on a 25-cities problem. It was hanging up, eventually erroring out with Out Of Heap memory error. The change that made it work was: I changed this:
Double[][] memo = new Double[N][1
For debugging I like Double because it'll throw a NPE if I'm doing something wrong. In this case, I think a primitive double[][] also works, so no reason to use Double[][]. As you've seen, primitives are better if you're trying to boost performance. Tip: a primitive double also plays nicely with Double.POSITIVE_INFINITY and Double.NEGATIVE_INFINITY which can be used as placeholder values when you're trying to find a min/max value.
How can we modify the code to have the end node different from the start node. As if we don’t know the end node, but we need to find it
good job bud
So how to use the codes, I mean what input should we put to see the effectiveness of the code
Hello, I'd like to ask a sort of dumb question, but is this an implementation of the Held-Karp Algorithm?
W
ould like to know that too
In combinations(set,at,r,n,subsets), Dont u have to make another recursive call to combinations after u backtrack on line 153?
Looks correct to me. You flip off the bit before moving to the next position. Try adding the call and see what happens :)
WilliamFiset thank u!Will plan 2 take another look
and how result of that code?