Anybody understands NP complete problems? Especially the ones related to Bonnie and Clyde?
I don't know about the Bonnie and Clyde problem, but I do understand NP complete problems.
Bonnie and Clyde have just robbed a bank. They have a bag of money and want to divide it up. For each of the following scenarios, either prove that the problem is in P, or prove that the problem is NP-complete. The input in each case is a list of the n items in the bag, along with the value of each. There are n checks as in part (3), but this time they are willing to accept a split in which the dierence is no larger than 100 dollars, i.e., neither of them gets more than 100 dollars more than the other. This is NP Complete but I can't prove it. can you help? thanks
What other NP Complete problems do you know?
well I know that this is the same as the set-partition problem if we remove the 100 difference margin. I found an answer online but I can't copy it since I cannot understand how to reduce this to the set-partition problem
Can you explain the set-partition problem?
yes. you basically have a set and you want to partition it into two disjoint subsets where the sum of all elements in one subset is half the sum of all elements in the original set.
Oh ok.
Well, do you understand how to use that problem to solve the Bonnie and Clyde problem?
Yes, no?
no
I mean I do know how to do it with the normal problem without the 100 difference margin
If Bonnie and Clyde have to split it evenly then we immediately have a set-partition problem
Consider if the took out an item under 100 and then tried to set partition.
ok
you have to play around with the problem in this fashion.
I am still confused. Thanks but I give up. there is a solution where they multiply things by 1000 but I have no idea as of what's the motivation behind that multiplication
1000? And the margin is 100?
it's the last problem on that link
It looks like they use Set Partition to get the closest possible solution.
Yea man lol. I am just not good at this stuff. Thanks anyways.
I have another idea for a solution.
``` for x in range(100): S = moneybag.copy().add(x) if set-partition(S): return true return false ```
Perhaps make that `range 101`. We want `x` to be from `0` to `100`.
Since this will run set-partition a constant number of times, we are showing that the problem is as easy as set-partition.
sweet. thanks
Do you understand it?
yea. I was thinking about that too but wasn't sure if splitting an additional check would compensate for the difference
If there is a solution that is \(x\leq100\) different, then by adding in \(x\) to the bag, there will be a completely even solution.
This works when `1` is the lowest denomination. If there are cents involved, then we would use `x in range(0, 100*100+1, 0.01)`. So long as there is a minimum denomination, this works.
And if there is no solution, then adding in \(x\) simply will not create a solution.
Join our real-time social learning platform and learn together with your friends!