News for hackers. Stuff that matters.
Re:A scalable photonic computer solving the subset sum problem by shireboy on Sunday February 02, 2020 @10:36PM (#22221233)
I actually have this problem in a work project: matching 1-n point of sale transactions, credit card payments etc to 1-n bank transactions for large companies. Ie “these three credit card payments totaling 300 match this bank transfer for 290 2 days later.” Can confirm it’s difficult and would love any creative solutions.
Re:A scalable photonic computer solving the subset sum problem by anderskaseorg on Monday February 03, 2020 @12:20AM (#22221619)
You're looking for a mixed integer programming solver. Although the problem is NP-hard, in practice, state of the art MIP solvers run much faster than brute force search in most non-pathological cases.
Re:A scalable photonic computer solving the subset sum problem by ampdepolymerase on Monday February 03, 2020 @12:24AM (#22221636)
Are SMT solvers insufficient?
Re:A scalable photonic computer solving the subset sum problem by Hercuros on Monday February 03, 2020 @02:21AM (#22222106)
Mixed integer programming is a more specialized task than SMT solving, therefore an MIP implementation is likely to be more optimized for the task, even if you might be able to use an SMT solver to solve the same problem. Moreover, SMT solvers are focused on finding some solution to some constraints, whereas MIP solvers are focused on finding the best solution to the constraints according to some linear objective. Finally, an SMT solver is basically a SAT solver combined with a theory solver for reasoning about integers, etc. If the problem can be expressed just as a conjunction of constraints (i.e, it has no interesting propositional structure), then you don’t really need the SAT solver part and can just use a specialized theory solver (optimizer, in this case) directly.
Re:A scalable photonic computer solving the subset sum problem by tgflynn on Sunday February 09, 2020 @04:52PM (#22284582)
Like the comment above yours says there are algorithms for SSP that are polynomial in the target value of the sum. For values on the order of something someone would buy with a credit card I think they should be practical.

See: https://en.wikipedia.org/wiki/Subset_sum_problem#Pseudo-poly...

The problem only becomes really difficult when the numbers are so large that it takes a large number of bits to represent them.

Re:A scalable photonic computer solving the subset sum problem by ampdepolymerase on Monday February 03, 2020 @12:17AM (#22221606)
The secret solution is called Z3.
Re:A scalable photonic computer solving the subset sum problem by ganzuul on Monday February 03, 2020 @07:25AM (#22223537)
This? https://github.com/z3prover/z3

What is secret about it?

Re:A scalable photonic computer solving the subset sum problem by pipnasti on Monday February 03, 2020 @12:06AM (#22221556)
That sounds like an interesting problem. Would love to know more of the contraints.
Re:A scalable photonic computer solving the subset sum problem by shireboy on Wednesday February 12, 2020 @11:48PM (#22315400)
It's for reconciling customers' items such as point of sale, payroll, and other systems with bank transactions. Each client item has date, description, and amount. Each transaction similarly has date, description and amount. The goal is to match all items with corresponding bank transactions. However, it is more complicated because: * bank dates and item dates may not be the same. A sale may take a few days to clear the bank. * amounts may not be the same. A credit card sale may be for 100, but when it clears the bank, the CC provider has deducted fees, so it's 98. * quantities may not be the same. Ten sales may be deposited as one deposit. In some cases, multiple items may match to multiple transactions. * there are rules about which matches are best. A sale may match ten transactions, but it can be important to match the right one, typically the closest date.

As others have suggested, I can take shortcuts by ignoring some sets. But it is tricky and slow, especially for large sets.