简体   繁体   中英

how to minimize the bag numbers with given items?

I have 7 items called ABCDEFG, and each has its weight. The amount of A is 3, B is 2, etc, such as the following table:

在此处输入图片说明

Items will be filled in the same bag and the volume of bag is 1.0kg (the sum of volume in a bag cannot exceed 1.0kg). Now I want to use the least number of bags. How can I assign items to each bag to get the least number?

Start by putting the item with the heighest weight in bag and find additional items for the same bag (again start by trying the haviest ones first) to get a total weight as close as possible to the maximum of 1.0 kg.
Repeat the same with the remaining items until there is no item left anymore and count the bags you have used.

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