What is the optimal algorithm for filling a set of Blu-ray disc given many hundred gigabytes of assets of varying sizes?
I am trying to consolidate a large number of old CDROMS, DVDs and small hard drives and put everything in a database indexed by MD5 signature. A daunting task for sure.
What I currently do is to sort the asset sizes (usually directory sizes) in descending order, start inserting the largest assets in the fill list skipping any that don't fit until I run out of assets. It runs almost instantaneously but I would not mind running overnight if necessary one time.
It usually gives me 95% or more utilization, but I am sure there is a way to use other combinations to give a higher efficiency. With huge items like disk images, I can get quite low utilization with this primitive method.
My thought is to take all combinations of the assets taken, 1 then 2, then 3, ... items at a time and keep a running value for the highest byte count < 25,025,314,816 bytes pointing to the array which sums to it. When I get to the point that I have so many assets taken at one time that none of the combinations will fit, stop and use the array pointed to by the running highest counter.
Is this the best possible algorithm?
There are 2 Perl modules which seem up to the task, Algorithm-Combinatorics and Math-Combinatorics. Any advice on which is faster, more stable, cooler?
My scheme is to write a script to calculate the sizes of a large number of directories and show me the optimal contents of the dozens of disks to burn.
And, I don't want to just fill on a file by file basis as I want entire directories on the same disc.
CDBurnerXP - Best for All Kinds of Discs This program can burn CDs and DVDs, including HD DVDs and Blu-ray discs. This program also allows you to create ISOs and bootable discs with ease. CDBurnerXP is a relatively simple program that uses a standard Windows-based interface.
You can easily burn 1080P to DVD with Leawo DVD Creator by referring to the following steps. Step 1: Download Leawo DVD Creator and install it on your computer. Step 2: Insert an empty DVD disc to the computer's drive with enough capacity to store the 1080P content.
Regardless of the AutoPlay setting, to then burn a CD or DVD using File Explorer in Windows 11, select the “Burn files to disc (using File Explorer)” command in the menu of software choices that appears to open the “Burn a disc” window. Then type a name for the disc into the “Disc title:” field.
This is an NP-complete problem known as bin packing. There is no known polynomial-time algorithm that solves it optimally. In other words, the optimal solution cannot be found without basically trying all solutions.
On the plus side, a very simple heuristic like "put the largest remaining folder on the first disk that has room" will guarantee that you will use fewer than twice as many disks as the best case. (You can read more details on the problem's Wikipedia article).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With