简体   繁体   中英

`n` bag of sand and inserting into Box, Algorithms

we have n bag of sand, with volume v_1 to v_n (for all i, 0 < v_i < 1, but not essentially sorted). we want to place all bag to boxes with volumes 1. we proposed one algorithms.

at first we place all bags in the original order. then we select one box and place on it, bag 1, 2, 3,... until these can be place in box. if the i'th bag couldent be inserted in box, we choose another box and place it i'th, i+1'th and... until these can be place in the box.

if number of boxed that be used be X, and the number of boxes used in minimum way (by using minimum algorithms) be Y, why always X < 2 * Y.

In your final distribution, the sum of the volumes in consecutive boxes is bigger than 1. Particularly, the sum of the volumes in boxes 2*i and 2*i+1 is bigger than one, for every i. Therefore X/2 < (sum of every vi) and (sum of every vi) <= Y. qed

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM