4 sizes
[$
((count
++))]=$size
7 echo "computing $i combinations of ${#sizes[*]} containers for limit $limit"
13 for j
in ${!sizes[*]}; do
14 if ((i
& (1 << j))); then
15 containers+=(${sizes[j]})
16 sum=$((sum + sizes[j]))
19 if [[ $sum == $limit && ${#containers[*]} -le $best ]]; then
21 if [[ $part1 ||
${#containers[*]} == $best ]]; then
24 echo "better configuration found"
25 solutions
=1 best
=${#containers[*]}
29 echo "$solutions total solutions"