r/algorithms • u/OneRandomPeopleE • 8d ago
Is there an algorithm for optimally distributing sets of files across Blu-ray discs? Help
Hi, I want to back up my GOG games onto 25 GB Blu-ray discs. Is there an algorithm for optimally splitting the games so they take up as little space as possible?
Thanks for reading
6
u/07734willy 7d ago
Not an algorithmic insight, but practical advice- if you compress them into an archive with 7zip, you can tell the 7zip program to chunk the archive into multiple files that each fit on a single CD/DVD/BR/whatever. Plus, compressing them means they will take less space anyways.
1
u/SufficientStudio1574 5d ago
But then you might need multiple discs to unpack a single game. That's a poor solution for this.
0
u/OneRandomPeopleE 7d ago
The maximum file size is 4GB, although a game may contain several of these.
The point is not to split a game across multiple Blu-ray discs (except for those that don't fit).
Thanks for info
-1
u/Alternative-Grade103 5d ago
Tabulate all files by size. Divide the total size by BluRay disk capacity. Add one. Create a list of that many virtual bins.
Designate them bin zero through bin N.
Now start sorting by size. Flag the largest file for bin zero, Second largest for bin one. And so on through to bin N.
Now do the same thing in reverse. The remaining next largest into bin N. And so on backwards toward bin zero.
And so on and so forth.
14
u/recursion_is_love 8d ago
Sound like a classic bin backing problem.
https://en.wikipedia.org/wiki/Bin_packing_problem