#### D.12.2.45 unbounded_knapsack

Procedure from library `crypto.lib` (see crypto_lib).

Usage:
  unbounded_knapsack(knapsack,profit,capacity)

Return:
  list of maximum profit of each iteration. For example, output_list[2] contains the maximum profit that can be achieved if the knapsack has capacity 2.

Example:

    LIB "crypto.lib";
    list h=1,4,7,32;
    list knapsack = 5,2;
    list profit = 10,3;
    int capacity = 5;
    unbounded_knapsack(knapsack,profit,capacity);
    ==> [1]:
    ==>    0
    ==> [2]:
    ==>    0
    ==> [3]:
    ==>    3
    ==> [4]:
    ==>    3
    ==> [5]:
    ==>    6
    ==> [6]:
    ==>    10

User manual for Singular version 4.4.1, 2025, generated by texi2html.