Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
vector_bin_packing.proto
Go to the documentation of this file.
1// Copyright 2010-2024 Google LLC
2// Licensed under the Apache License, Version 2.0 (the "License");
3// you may not use this file except in compliance with the License.
4// You may obtain a copy of the License at
5//
6// http://www.apache.org/licenses/LICENSE-2.0
7//
8// Unless required by applicable law or agreed to in writing, software
9// distributed under the License is distributed on an "AS IS" BASIS,
10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11// See the License for the specific language governing permissions and
12// limitations under the License.
13
14// Vector Bin Packing Problem.
15//
16// The problem description is as follows:
17//
18// Given:
19// - a fixed number of resources,
20// - a set of equivalent multidimentional bins with max capacity on each
21// resource.
22// - a set of items, with fixed usage for all resources, and a number of
23// copies for each item.
24//
25// The goal is either:
26// - optimization: minimizing a weighted sum of the number of bins used, plus a
27// weighted sum of skipped items; or
28// - feasibility: checking if all required items can be packed using at most a
29// given number of bins.
30//
31// In both cases we must ensure that for each bin and each resource, the sum of
32// sizes of each assigned item is less than the capacity of the resource of the
33// bin.
34//
35// An optional integer imposes an upper bound on how many copies of the same
36// item are allowed in a single bin, regardless of resource utilization.
37
38syntax = "proto3";
39
40option java_package = "com.google.ortools.packing.vbp";
41option java_multiple_files = true;
42option csharp_namespace = "Google.OrTools.Packing.Vbp";
43
44package operations_research.packing.vbp;
45
46message Item {
47 // Optional name. This is only used for display/debugging purposes.
48 string name = 1;
49
50 // Resource usages for this item. All usages must be non-negative.
51 // Should be the same size as resource_capacity in the
52 // VectorBinPackingProblem.
53 repeated int64 resource_usage = 2;
54
55 // Number of identical copies of this item that must be packed into some bin.
56 int32 num_copies = 3;
57
58 // The number of extra copies which may be skipped for a penalty.
59 // Currently only supported by the ArcFlow solver (arc_flow_solver.h), other
60 // solvers ignore this field.
61 int32 num_optional_copies = 5;
62
63 // An optional upper bound on how many copies of the same item are allowed in
64 // a single bin, regardless of resource utilization. A value of 0 is
65 // interpreted as no limit.
66 int32 max_number_of_copies_per_bin = 4;
67
68 // Minimize the total cost of bins plus this penalty for each optional copy
69 // not placed in any bin.
70 // Currently only supported by the ArcFlow solver (arc_flow_solver.h), other
71 // solvers ignore this field.
72 double penalty_per_missing_copy = 6;
73}
74
75message VectorBinPackingProblem {
76 // Optional name.
77 string name = 1;
78
79 // Max capacity of each resource.
80 // All bins have the same resource capacities.
81 repeated int64 resource_capacity = 2;
82
83 // Resources names. This can either be left empty or
84 // must be of the same size as resource_capacity.
85 repeated string resource_name = 3;
86
87 // The list of items which are to be assigned to bins.
88 repeated Item item = 4;
89
90 // The maximum number of bins available. A value of 0 is interpreted as no
91 // limit. Nonzero values may be used to encode feasibility problems.
92 int32 max_bins = 5;
93
94 // If specified, tries to maximize the value of packed items minus the cost
95 // per bin used. A missing value is treated as 1.
96 // Currently only supported by the ArcFlow solver
97 // (ortools/packing/arc_flow_solver.h), other solvers
98 // ignore this field.
99 optional double cost_per_bin = 6;
100}
101
102// Describe one filled bin in the solution.
103message VectorBinPackingOneBinInSolution {
104 // Which items are in this bin. They are supposed to be unique.
105 repeated int32 item_indices = 1;
106 // How many of each items are in this bins.
107 repeated int32 item_copies = 2;
108}
109
110// Solve status
111enum VectorBinPackingSolveStatus {
112 // Default state.
113 VECTOR_BIN_PACKING_SOLVE_STATUS_UNSPECIFIED = 0;
114
115 // The optimal solution was found and proven.
116 OPTIMAL = 1;
117
118 // A feasible solution has been found.
119 FEASIBLE = 2;
120
121 // The problem is infeasible.
122 INFEASIBLE = 3;
123}
124
125message VectorBinPackingSolution {
126 // Optional info from the solver.
127 string solver_info = 1;
128
129 // Filled bins.
130 repeated VectorBinPackingOneBinInSolution bins = 2;
131
132 // Solve status.
133 VectorBinPackingSolveStatus status = 3;
134
135 // Objective value.
136 // The total cost of bins used plus the penalty for any skipped items.
137 double objective_value = 4;
138
139 // Solve time in seconds.
140 double solve_time_in_seconds = 5;
141
142 // Time to create the Arc-Flow graph.
143 double arc_flow_time_in_seconds = 6;
144
145 // TODO(user): Do we add copies of bins?
146}