vrp_multiple_knapsack - Experimental¶
Warning
Possible server crash
These functions might create a server crash
Warning
Experimental functions
They are not officially of the current release.
They likely will not be officially be part of the next release:
The functions might not make use of ANY-INTEGER and ANY-NUMERICAL
Name might change.
Signature might change.
Functionality might change.
pgTap tests might be missing.
Might need c/c++ coding.
May lack documentation.
Documentation if any might need to be rewritten.
Documentation examples might need to be automatically generated.
Might need a lot of feedback from the comunity.
Might depend on a proposed function of vrpRouting
Might depend on a deprecated function of vrpRouting
Availability
Version 0.4.1
Support for or-tools v9.10.4067
Version 0.4.0
New experimental function
vrp_knapsack
Description¶
The multiple knapsack problem is a problem in combinatorial optimization: it is a more general verison of the classic knapsack problem where instead of a single knapsack, you will be given multiple knapsacks and your goal is maximise the total value of packed items in all knapsacks.
Signatures¶
Parameters¶
Column |
Type |
Description |
---|---|---|
|
Weight Costs SQL as described below |
|
capacities |
|
An array describing the capacity of each knapsack. |
Optional Parameters¶
Column |
Type |
Default |
Description |
---|---|---|---|
|
ANY-INTEGER |
\(100000\) |
Maximum items(rows) to fetch from bin_packing_data table. |
Inner Queries¶
Weight Costs SQL¶
Column |
Type |
Description |
---|---|---|
|
ANY-INTEGER |
Unique identifier of the item. |
|
ANY-INTEGER |
Weight of the item. |
|
ANY-INTEGER |
Cost of the item. |
Where:
- ANY-INTEGER:
SMALLINT
,INTEGER
,BIGINT
Result Columns¶
Column |
Type |
Description |
---|---|---|
|
|
Indentifier of the knapsack. |
|
|
Indentifier of an item in the |
Example¶
SELECT *
FROM vrp_multiple_knapsack($$SELECT id, weight, cost FROM ortools.multiple_knapsack$$, ARRAY[100,100,100,100,100]);
knapsack | id
----------+----
1 | 2
1 | 9
1 | 11
2 | 4
2 | 5
2 | 10
3 | 8
3 | 13
4 | 3
4 | 6
5 | 14
5 | 15
(12 rows)
See Also¶
Indices and tables