binpack.m

From Spinach Documentation Wiki
Jump to: navigation, search

A simple 1D bin packing algorithm.

Syntax

    bins=binpack(box_sizes,bin_size)

Description

Collects the list of numbers supplied into sublists that sum to the number that is smaller or equal to the number specified. The algorithm is not optimal, but it does the job.

Arguments

   box_sizes - a row vector of box sizes

   bin_size  - an integer specifying the bin size

Outputs

   bins      - a cell array of index vectors specifying
               boxes allocated into each bin

See also

path_trace.m, reduce.m, scomponents.m


Version 2.1, authors: Ilya Kuprov