开发者

who knows algorithm about stones and backpack?

开发者 https://www.devze.com 2023-01-29 17:54 出处:网络
maybe somebody knows algorithm, or just what name it has, for putting stones (different w开发者_如何转开发eight) into different size backpacks?

maybe somebody knows algorithm, or just what name it has, for putting stones (different w开发者_如何转开发eight) into different size backpacks? I should do it in Prolog. I give weights of stones and capacities of backpacks. Program should give me an answer how can I place all these stones into backpacks.


It's hard to tell since you haven't given much detail, but this sounds like a bin-packing problem. You can start on Wikipedia and Google to find algorithms that fit your needs (note that this an NP-Hard problem).


It's called the knapsack problem.


it's a classic problem, check knapsack problem

0

精彩评论

暂无评论...
验证码 换一张
取 消