Posts

Showing posts with the label Knapsack

Solving Knapsack with Powershell

Image
One of the most common tasks when designing the migration from a Microsoft Exchange organisation to Exchange Online, is to separate the mailboxes into batches. I recently had to solve a quiz like that where I had to select the right mailboxes to migrate on each day, given the restriction imposed by the network bandwidth available. The way I finally approached it - and trigger for this post - was to apply the knapsack algorithm in order to make the best selection for each migration batch. There are of course many other parameters that you should take into account in cases like that, such as the role of the user and any permission delegations. A short description of the knapsack problem, for those that have not heard it before. We are given a collection of items that each one has a specific weight and value and a knapsack that has specific weight capacity. The goal is to identify the optimal selection of items to put in the knapsack that will not only keep its total weight under the maxi...