[comp.sources.d] v15i083: Awk program for putting a set of files on minimum floppies.

xanthian@zorch.SF-Bay.ORG (Kent Paul Dolan) (12/17/90)

In comp.sources.misc thomas%randvax.UUCP@usc.edu (Susan Thomas) writes:

>Archive-name: greedy/part01

>(I'm posting this for a friend)

>This is a awk implementation of the "greedy" bin-packing algorithm 
>as applied to the problem of spreading a set of files over a set 
>of floppies in such a way as to require the least number of
>floppies.  It takes a list of files and generates copying scripts
>which embody the optimal allocation of files.

>Greedy is not the optimal algorithm.  It's just a easily implemented
>heuristic.

If in fact this works well, it would be nice if someone adapted it
into a version of shar to pack the pieces of a shar into the fewest,
say 60Kbyte, articles possible, to save header and archive bytes.
Diskettes aren't the only place where efficient packing is useful! 

[For shars of directory trees, this would require a smarter shar, that
created all needed directories first, and handed
current-directory-relative file pathnames to sed rather than doing a cd
to the directory, and it would force one to unpack at least the first
part of a multipart shar before the other parts. Is this too much of a
sacrifice? Of course, for a shar of one flat directory, there would be
nothing given away, just gain.]

Kent, the man from xanth.
<xanthian@Zorch.SF-Bay.ORG> <xanthian@well.sf.ca.us>

john@chance.UUCP (John R. MacMillan) (12/19/90)

xanthian@zorch.SF-Bay.ORG (Kent Paul Dolan) writes:

|If in fact this works well, it would be nice if someone adapted it
|into a version of shar to pack the pieces of a shar into the fewest,
|say 60Kbyte, articles possible, to save header and archive bytes.
|Diskettes aren't the only place where efficient packing is useful! 

I looked at this a year or so ago and decided the gain wasn't really
worth it.  In shar-ing up a bunch of things that had been recently
posted to comp.sources.* back then, it saved *one* part in fewer
than 5% of the cases.  Mileage varies, of course, but it only helps
if the source just barely goes onto a new part because of bad
packing; all the one parters, or n-parts plus 30k just don't get
helped.  And saving one set of headers/shar headers over the size
of the whole posting just didn't seem worthwhile.

If someone does do this, though, keep in mind that you may want to
force some files, eg. ReadMe, to the front.
-- 
John R. MacMillan       | I wish I had a nickname like Crusher, Snake or Dennis
john@chance.UUCP        | Because guys with nicknames always get the gal.
...!scocan!chance!john  |       -- barenaked ladies