Singular Manual: unbounded_knapsack

| #### D.12.3.43 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.2.1, 2021, generated by texi2html.