Утилита для оптимального распределения файлов на несколько DVD?

4051
Alex R

У меня есть куча мультимедийных файлов, которые я хочу записать на DVD, но, поскольку каждый DVD занимает только 4,5 ГБ, я должен найти оптимальный способ организации файлов, чтобы использовать минимальное количество DVD-дисков (в противном случае на каждом из них остается свободное место). DVD можно легко сложить). Есть ли инструменты, которые помогут с этим?

Много лет назад была DOS-утилита, которая делала это с дискетами.

10
Нет, я не ищу сжатия и разбиения. Я хочу распространять файлы изначально (файловая система), чтобы каждый диск мог использоваться напрямую. Alex R 14 лет назад 1
Просто чувствовал, что это хорошая страница для всех, кто ищет: http://www.howtogeek.com/76264/how-to-burn-data-across-multiple-dvd-or-cd-discs/ Nav 10 лет назад 0

7 ответов на вопрос

2
harrymc

Попробуйте бесплатный DVD Span :

DVD Span - это инструмент резервного копирования для записи содержимого больших папок на несколько DVD. DVD Span может автоматически определять наилучшую организацию каждого диска, чтобы соответствовать максимальному объему данных на минимальном количестве дисков. DVDSpan - отличный инструмент для резервного копирования музыкальной коллекции, фотографий или даже всего жесткого диска на DVD. А поскольку он производит обычные DVD-диски (или компакт-диски), не требуется никакого специального программного обеспечения для чтения или восстановления ваших резервных копий.

2
Jeff Shattock

Ах, проблема с рюкзаком . Я мог бы найти только один онлайн решатель для этого здесь . Ваш размер рюкзака будет 4,5 ГБ, а каждый пакет будет соответствовать размеру вашего файла. Вам нужно будет немного помассировать его вывод, чтобы он соответствовал вашему конкретному применению, но это должно быть работоспособно. Это не будет работать очень быстро, потому что эта проблема сложная .

Да, на самом деле это NP-полная проблема, но для этого практического применения достаточно грубого решения :) Alex R 14 лет назад 0
Это не эквивалентно проблеме ранца, но (1-D) [проблема упаковки бина] (http://en.wikipedia.org/wiki/Bin_packing_problem), из которых есть [точный алгоритм] (http: / /en.wikipedia.org/wiki/Bin_packing_problem#Exact_algorithm). Kenny Evitt 9 лет назад 1
2
Kenny Evitt

Overview

Jeff Shattock's answer is correct that this is equivalent (or isomorphic, as mathematicians write) to a combinatorial optimization problem, but it's equivalent to the 1-dimensional bin packing problem, not the knapsack problem.

Lucky for you, I have some code to share that will solve this problem for you, or anyone else, with access to a Windows computer with at least version 3.5 of the .NET Framework installed.

A Rough Solution

  1. First, download and install LINQPad.

  2. Second, download the LINQPad query I just wrote – here's the linq (ha) to the raw file. Save it as a .linq file and open it in LINQPad.

  3. Change the parameters:

    Here's the part in the LINQPad query code you should change:

    int binSizeMb = 4476; // This is the (floor of the) total size of a DVD+R reported by CDBurnerXP. string rootFileFolderPath = @"F:\2006 - Polyester Pimpstrap Intergalactic Extravaganza multicam";

    Change binSizeMb to the size of your 'bin', e.g. CD, DVD, ex. int binSizeMb = 650; for a CD.

    Note – the binSizeMb value is interpreted as what's sometimes referred to as a mebibyte. Contrary to my childhood, when all byte multiples were 'binary', sometimes 'MB' now refers to a 'decimal megabyte' or exactly 1,000,000 bytes, as opposed to the 1,048,576 bytes of a mebibyte (MiB), which is used in my code. If you wish to change this, change the line const int bytesPerMb = 1048576; in the code to const int bytesPerMb = 1000000;.

    Change rootFileFolderPath to the full path of the folder containing the files you wish to 'pack into bins', ex. string rootFileFolderPath = @"C:\MySecretBinFilesFolder";.

  4. Run the query by either hitting F5 or clicking the Execute button at the top left of the query tab.

Results

The query code will enumerate all of the files in the rootFileFolderPath folder, recursively, meaning it will include files in all of the subfolders too.

Then it will create 'bins' for the files such that the total size of all the files in each bin is less than or equal to the bin size specified.

In the LINQPad results pane you'll see two lists.

The first list is of all the files it found, listed in decreasing order by size.

The second list is the bins created by 'packing the files', with a list of the files and their sizes, as well as the remaining size of the bin.

Here's a screenshot showing the second list and the first two bins created:

LINQPad screenshot showing list of bins

Cursory Analysis

According to Wikipedia, the algorithm I used – the First Fit Decreasing (FFD) strategy – shouldn't be too bad; Wikipedia states:

In 2007, it was proven that the bound 11/9 OPT + 6/9 for FFD is tight.

'OPT' refers to the optimal strategy (as something potentially unreachable, not any particular actual strategy).

Based on my somewhat fuzzy memories of the mathematical terms involved, this should mean that the FFD strategy should, at worst, pack items into ~1.22 times the number of bins that an optimal strategy would. So, this strategy might pack items into 5 bins instead of 4. I suspect that it's performance is likely to be very close to optimal except for specific 'pathological' item sizes.

The same Wikipedia article also states that there is an "exact algorithm". I may decide to implement that too. I'll have to read the paper that describes the algorithm first.

0
Journeyman Geek

Я думаю, вы можете использовать любой инструмент сжатия, который позволяет разбить архив

Сжатие не то, что я ищу. Это делает его слишком громоздким для доступа к файлам. Alex R 14 лет назад 1
0
imz -- Ivan Zakharyaschev

You can take one of the variants of the program in Hitchhiker's guide to Haskell, perhaps after working through some part of that tutorial; the tutorial is written around solving exactly yours problem of distributing things onto several disks whereby the solution is incrementally refined, as exemplified by the following passage from Chapter 3 of the tutorial:

Enough preliminaries already. let's go pack some CDs.

As you might already have recognized, our problem is a classical one. It is called a "knapsack problem" (google it up, if you don't know already what it is. There are more than 100000 links).

let's start from the greedy solution...

More ideas: a related question

Here is a similar question (although not the same: it's not being asked for optimization there), where you may find more useful solutions/programs for your task (if they will be posted):

Some hints for understanding the programming in the suggested tutorial

In general, the Haskell code is quite expressive (since Haskell is a language for programming on a high level of abstraction), and hence can be easily grasped.

When looking at the code of one of the solutions, remember that the top-level structure of the program we want to write is quite simple, as put in Chapter 1 of the tutorial:

Now let's think for a moment about how our program will operate and express it in pseudocode:

main = Read list of directories and their sizes. Decide how to fit them on CD-Rs. Print solution. 

Sounds reasonable? I thought so.

Let's simplify our life a little and assume for now that we will compute directory sizes somewhere outside our program (for example, with "du -sb *") and read this information from stdin.

and look further more closely at the parts of the solution.

0
Marcin Orlowski

Много лет назад я написал PHP-скрипт для решения этой задачи: https://bitbucket.org/borszczuk/php-backup-maker/

0
Anton

Также попробуйте Discfit, которая выбирает файлы и каталоги для копирования на различные диски:

https://sourceforge.net/projects/discfit/

An answer with link only is not a good answer. When recommending software, please follow [this outline](http://meta.superuser.com/a/5330/432690). You should expand ([edit](http://superuser.com/posts/1113099/edit)) your answer to make it better. E.g. your answer doesn't comply with "give a brief overview of HOW to use the product…" requirement. Kamil Maciorowski 7 лет назад 0
С веб-сайта: «Располагает большой набор файлов или каталогов, чтобы использовать минимальное количество физических носителей (CD, DVD, BD ...). Вы можете перетащить полученные наборы прямо поверх программного обеспечения для записи (Nero, DVD). -идти...)". Anton 7 лет назад 0
Почти. Чтобы сделать ответ лучше, вы должны отредактировать ответ. Kamil Maciorowski 7 лет назад 0
Я не вижу ничего больше, кроме того, что написали авторы. Можно, наверное, просто зайти на сайт и узнать. Anton 7 лет назад 0
Это нормально. Я хочу сказать, что вы должны [редактировать] (http://superuser.com/a/1113099/432690) свой ответ, а не писать комментарий с «расширением» к нему. Это ответ, который должен следовать указанному плану, а не отвечать + комментарии. Фрагмент, указанный в комментарии, должен быть указан в вашем ответе. Это все. Kamil Maciorowski 7 лет назад 0

Похожие вопросы