I would like to work out that combination of a set of specified items
whose total weight will be closest to 16.50 kg. (from the example data
set, syntax below, weight is in kg).
Any number of combinations can be used. I think the hard part is working
out all possible combinations, and collating them into a data set; once
that bit is done it is easy to clean out duplicates, and figure out the
total weight for each combination, and then get the closest ones.
Clearly this is a combinatorial problem and I have looked at Raynald
Levesque’s macro * !combine* from Aug 30, 2001 -
- that macro is I think mainly designed to work our combinations of
strings. I can see how in principle it might be adapted, but I wondered if
anyone can think of a better solution?
* syntax to create sample data.
DATA LIST FREE/ item(A15) weight.
DATASET NAME picklist.
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
For a list of commands to manage subscriptions, send the command