Possible combination of problems with a backpack and?

Good quick review

I reviewed a backpack problem

http://en.wikipedia.org/wiki/Knapsack_problem

and I know that this is what I need for my project, but the difficult part of my project will be that I need several bags inside the main bag.

A large backpack that holds all the “bags” can only contain the “number of bags” (say, 9 for example). Each bag has different meanings;

  • Weight
  • Cost
  • The size
  • Capacity

etc., all of these values ​​are integers. Assume from 0 to 100.

The inner bag will also be assigned a type, and there can only be one type in the outer bag, although the program input will be of the same type.

, , .


:

  • 9
  • 98 [ 5 ]
  • , .

:

  • , 100%
  • , 67%
  • , 44%

, " ", , , .

, , , , .

Java, #. PHP, , -.

,

-Zack

+3
2

, , NP-hard, , NP- ( , .) , , , , . , , ,

 for each possible combination
 do
   if current combination is better than best previous
      save current combination as best so far
   fi
 od

. , .

+2

Prolog . , P # mono (.NET). Theres , , .

, . !

P #

0

Source: https://habr.com/ru/post/1706979/


All Articles