findLowestCostArrangement

open fun findLowestCostArrangement(availableSpace: Float, targetSmallSize: Float, minSmallSize: Float, maxSmallSize: Float, @NonNull smallCounts: Array<Int>, targetMediumSize: Float, @NonNull mediumCounts: Array<Int>, targetLargeSize: Float, @NonNull largeCounts: Array<Int>): Arrangement

Create an arrangement for all possible permutations for smallCounts and largeCounts, fit each into the available space, and return the arrangement with the lowest cost.

Keep in mind that the returned arrangements do not take into account the available space from the carousel. They will all occupy varying degrees of more or less space. The caller needs to handle sorting the returned list, picking the most desirable arrangement, and fitting the arrangement to the size of the carousel.

Return

the arrangement that is considered the most desirable and has been adjusted to fit within the available space

Parameters

availableSpace

the space the arrangement needs to fit

targetSmallSize

the size small items would like to be

minSmallSize

the minimum size small items are allowed to be

maxSmallSize

the maximum size small items are allowed to be

smallCounts

an array of small item counts for a valid arrangement ordered by priority

targetMediumSize

the size medium items would like to be

mediumCounts

an array of medium item counts for a valid arrangement ordered by priority

targetLargeSize

the size large items would like to be

largeCounts

an array of large item counts for a valid arrangement ordered by priority