×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




This post got me thinking and searching...Apparently, this sort of algorithm is not simple and is the subject of a number of patent applications.
It has the tinge of a fun puzzle. But it is evidently not trivial.

https://www.legionpatent.com/patents/8103561/
http://www.google.com.ar/patents/US8103561


Paul Therrien
Andeco Software, LLC
225-229-2491
paultherrien@xxxxxxxxxxxxxxxxxx
www.andecosoftware.com

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of John McKee
Sent: Monday, September 29, 2014 9:50 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: Combinations & Permutations..... sort of

I believe you are potentially counting combinations twice. Check this page:

http://www.mathwords.com/c/combination_formula.htm

Picking invoices 1 and 4 is the same as picking invoices 4 and 1.

Maybe I am misunderstanding. Wouldn't be the first time.

John McKee

On Mon, Sep 29, 2014 at 8:02 PM, Roger Harman <roger.harman@xxxxxxxxxxx>
wrote:

After some more thinking, I believe I've figured out the total.

For 10 items, there are 4,037,913 possible combinations.

Calculated as:
for x01 = 1 to 1
Total += 1
for x02 = 1 to 2
Total += 1
<and so on>
for x10 = 1 to 10
Total += 1
endfor
endfor
endfor

Smaller sample size is definitely in order.



From: roger.harman@xxxxxxxxxxx
To: rpg400-l@xxxxxxxxxxxx
Subject: Combinations & Permutations..... sort of
Date: Mon, 29 Sep 2014 17:17:55 -0700

Put your math hats on......

I'm looking at a means to *attempt* to auto-match payments to invoices.
We do not want to apply payments to oldest first and end up with a
partial payment or credit leftover.

Pick an arbitrary number of invoices for the attempt - say 10.

Any combination of 1 or more of these 10 invoices that total the
payment
amount would be considered a match.
Could be invoice 1, or 2, or.... Could be invoices 2 and 5 and 8.....
etc.

I assume it's going to have to be a brute force approach but I'm
stumped
on the total # of possible matches. Combinations & permutations I
understand (3 out of 10, etc) but this "1 or 2 or (1 and 2) or (2 and
5 and 8)" is giving me a mind block. I do know it's a big number and
I'll likely cut back the sampling size.

Any suggestions or clarifications would be very welcome.

Thanks.



Roger Harman


COMMON Certified Application
Developer ILE RPG on IBM i on Power





--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at
http://archive.midrange.com/rpg400-l.


--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/rpg400-l.


--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.