multiway
"method"
, method)Solve the multiway number partitioning problem.
multiway
partitions a set of numbers into a specified number of
subsets such that the sums of the subsets are as equal as possible.
numbers is a vector of positive real numbers to be partitioned.
num_parts is a positive integer scalar specifying the number of partitions (subsets) to create.
The optional parameter "method"
specifies the algorithm used for
partitioning. Supported methods are:
"completeKK"
(Complete Karmarkar-Karp)
"greedy"
(Greedy algorithm)
The output arguments are:
Example:
numbers = [4, 5, 6, 7, 8]; num_parts = 2; [groupindex, partition, groupsizes] = multiway (numbers, num_parts); |
See also:
Source Code: multiway