Top
Back: subset_sum02
Forward: multidimensional_knapsack
FastBack:
FastForward:
Up: crypto_lib
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

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


Top Back: subset_sum02 Forward: multidimensional_knapsack FastBack: FastForward: Up: crypto_lib Top: Singular Manual Contents: Table of Contents Index: Index About: About this document
            User manual for Singular version 4.3.1, 2022, generated by texi2html.