Search code examples
algorithmprologbin-packingnp-hard

who knows algorithm about stones and backpack?


maybe somebody knows algorithm, or just what name it has, for putting stones (different weight) 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.


Solution

  • 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).