Dan,

Are all of the amounts you're dealing with positive? If so, you could
eliminate any amounts that were greater than the discrepancy you were
looking for. Also, during your summing process, you could stop totaling
amounts when the running total exceeded the discrepancy you were looking
for.

It sounds like the "odometer" technique mentioned in a previous post is the
best way to go.

Have fun!
Richard




-----Original Message-----
From: mi400-bounces@xxxxxxxxxxxx [mailto:mi400-bounces@xxxxxxxxxxxx]On
Behalf Of Dan Bale
Sent: Monday, September 20, 2004 12:29 PM
To: MI Programming on the AS400 / iSeries
Subject: RE: [MI400] odd sort of bit-counter...


> -----Original Message-----
> From: mi400-bounces@xxxxxxxxxxxx / David Morris
> Sent: Monday, September 20, 2004 12:03 PM
>
> Here is another non-MI answer. The problem you are trying to solve is
> NP complete. That means someone has already come up with solutions that
> will fit this problem. One way to find a possible solution quickly would
> be a genetic algorithm. The thing you will need to determine if you use
> a genetic algorithm is what constitutes the solution(s); it sounds like
> you may want all possible solutions. There are a few Java solutions that
> run on the iSeries but I have only used JGAP, which is available at
> SourceForge.

I envision that I would have a monitor thingy set up so I could inquire
where the search process was (i.e., is it now up to testing 7-amount
combinations?), and decide whether to cancel the process.  In a list of
hundreds of amounts, it would be impractical to test every possible
combination, but I've already detailed my idea on testing all of the
2-amount combos, then 3-amount combos, etc.  This is where I think the
algorithm would find solutions, if they exist, in the shortest amount of
time possible.  If the search gets to the point where it is searching for
7-amount combos, perhaps that should set a trigger in my mind that there's a
more complex problem than missing amounts.

db



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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

This mailing list archive is Copyright 1997-2022 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.