Sort the array and select consecutive entries until you reach the point where adding the next entry takes you over your magic number. If your sort is in ascending sequence, this gives you the most number of elements that will fit your constraint (this is the Maximize Number of Jobs Processed solution). If your sort is in descending sequence then you get the "Biggest Jobs Complete First" solution. Both solutions are local min/max solutions, and are reasonably easy to implement. Red claims that 95% of the time the effort involved in a full solution (by brute-force, since the problem is not algorithmically 'easy') is not cost-effective; i.e. the amount of improvement you get does not pay for the computing resources you consumed to get the better solution.
----
I Go Back to Sleep, Now.
OGB
In reply to Re: Finding the best option...
by Old_Gray_Bear
in thread Finding the best option...
by ruoso
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |