2D Cutting Stock Problem
2D Cutting Stock Problem
UNIVERSITY OF TECHNOLOGY
FACULTY OF COMPUTER SCIENCE AND ENGINEERING
Assignment
Contents
1 Acknowledgements 3
2 Introduction 3
2.1 History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.2 Cutting Stock Problem . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.3 Column Generation Algorithm . . . . . . . . . . . . . . . . . . . . . 4
2.4 Genetic Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.5 Greedy Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4 Conclusion 20
5 Analyze Results 20
Assignment for Mathematical Modeling - Academic year 2024 - 2025 Page 1/21
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering
Assignment for Mathematical Modeling - Academic year 2024 - 2025 Page 2/21
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering
1 Acknowledgements
We would like to extend our heartfelt gratitude to Mr. Le Hong Trang, our
Math Modeling lecturer, for his invaluable support and guidance throughout this
project. His readiness to address our questions and provide clear explanations
greatly contributed to the successful completion of our research. His dedication
and passion as an educator have been pivotal, offering not only technical insights
but also meaningful life lessons that have enriched our learning experience. The
project owes much of its success to his unwavering support and thoughtful advice.
Additionally, we deeply appreciate the collaboration and efforts of all team
members as well as our classmates. Their commitment and contributions at every
stage of the research were crucial in bringing this project to fruition. It has been
a privilege to work alongside such dedicated teammates and friends.
2 Introduction
Column Generation (CG) is an efficient method for solving large-scale lin-
ear programming problems with a massive number of variables. This method is
commonly applied in optimization problems in industries such as manufacturing,
logistics, or transportation, where solving the entire problem directly is infeasible
due to the sheer number of variables.
The Column Generation technique operates based on the idea of generating
only those variables (columns) that can improve the solution of the main problem
(master problem), rather than handling all variables simultaneously. This approach
saves memory and computation time while ensuring feasibility even for large-scale
problems.
2.1 History
The Cutting Stock Problem (CSP) was first formulated as an integer pro-
gramming problem in 1939 by Kantorovich. However, due to limitations such as
weak continuous relaxation and symmetry, its application in real-world scenar-
ios was initially ineffective. In 1951, Leonid Vitalyevich Kantorovich and Victor
Abramovich Zalgaller proposed a solution using integer linear programming. Over
the years, this model has continued to attract attention from the scientific commu-
nity and has been constantly refined. The problem has been proven to belong to
the NP-hard class, implying high computational complexity that prevents finding
a general solution in polynomial time.
Assignment for Mathematical Modeling - Academic year 2024 - 2025 Page 3/21
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering
Mathematical Formulation
Let the dimensions of the stock sheet be W × H, and let the requested
rectangles have dimensions wi × hi with corresponding demands di .
Decision Variables:
Constraints:
X
aij xj ≥ di , ∀i = 1, . . . , n
j
X
wi hi aij ≤ W × H, ∀j
i
Objective Function:
Assignment for Mathematical Modeling - Academic year 2024 - 2025 Page 4/21
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering
Assignment for Mathematical Modeling - Academic year 2024 - 2025 Page 5/21
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering
Assignment for Mathematical Modeling - Academic year 2024 - 2025 Page 6/21
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering
• No Guarantee of Optimality: GAs may not always find the global optimum,
especially when the search space is vast or fitness landscapes are highly com-
plex.
Assignment for Mathematical Modeling - Academic year 2024 - 2025 Page 7/21
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering
The greedy algorithm solves the 2D-CSP by iteratively selecting and placing
items based on a specific heuristic, such as maximizing material utilization or
minimizing waste for each cut. The basic steps of the algorithm are:
1. Sort the items based on a heuristic (e.g., decreasing order of area or aspect
ratio).
2. Start with an empty stock sheet.
3. Place items sequentially using the "first-fit"strategy, ensuring no overlaps and
adherence to stock dimensions.
4. When an item cannot fit on the current stock, allocate a new stock sheet.
5. Repeat until all items are placed.
Assignment for Mathematical Modeling - Academic year 2024 - 2025 Page 8/21
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering
Problem Description
You have stock sheets of size 10 × 10 units. The items to cut are as follows:
• Item 1: 4 × 6
• Item 2: 3 × 5
• Item 3: 6 × 4
• Item 4: 2 × 7
• Item 5: 5 × 3
The objective is to minimize the number of stock sheets used.
Solution:
3.1.4 Results
Stock Sheet 1:
Assignment for Mathematical Modeling - Academic year 2024 - 2025 Page 9/21
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering
Stock Sheet 2:
Assignment for Mathematical Modeling - Academic year 2024 - 2025 Page 10/21
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering
bm
wi × hi .
• A: Cutting pattern matrix, where aij represents the number of pieces of type
i in pattern j.
3.2.4 Objective
The goal is to minimize the total number of stock sheets used to meet the demand
for all piece types while minimizing waste. Let:
• xj : Number of stock sheets used for cutting pattern j.
• aij : Number of pieces of type i that can be cut in pattern j.
• bi : Demand for pieces of type i.
Objective:
n
X
Minimize z = xj
j=1
Subject to:
n
X
aij xj ≥ bi ∀i = 1, 2, . . . , m
j=1
xj ≥ 0 and integer ∀j = 1, 2, . . . , n
Here, z represents the total number of stock sheets used.
Assignment for Mathematical Modeling - Academic year 2024 - 2025 Page 11/21
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering
The goal is to minimize the number of large sheets (stocks) required to cut smaller
pieces (pieces) according to specified dimensions and demands. This is achieved
by evolving cutting patterns through a Genetic Algorithm (GA).
Assignment for Mathematical Modeling - Academic year 2024 - 2025 Page 12/21
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering
Step 7: Replacement
Replace the least fit chromosomes with new offspring.
Step 8: Termination
Stop the algorithm when a criterion is met:
• Fixed number of generations.
• Fitness value convergence.
Step 9: Decoding the Solution
The fittest chromosome represents the optimal cutting patterns and the total num-
ber of stock sheets required.
Assignment for Mathematical Modeling - Academic year 2024 - 2025 Page 13/21
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering
Input:
• Stock sheet size: W = 10, H = 10.
• Piece types:
– Type 1: w1 = 4, h1 = 4, b1 = 2 (demand: 2 pieces).
– Type 2: w2 = 3, h2 = 3, b2 = 3 (demand: 3 pieces).
Initial Population: Randomly generate feasible patterns that fit the stock
sheet constraints. Example initial patterns:
• Pattern 1: [2, 0] (2 pieces of Type 1, no Type 2).
• Pattern 2: [0, 3] (no Type 1, 3 pieces of Type 2).
• Pattern 3: [1, 2] (1 piece of Type 1, 2 pieces of Type 2).
• Pattern 4: [0, 4] (no Type 1, 4 pieces of Type 2, waste space).
Chromosome Representation: Each chromosome encodes a combination of
patterns. For example:
Assignment for Mathematical Modeling - Academic year 2024 - 2025 Page 14/21
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering
– Chromosome 3: {[0, 4], [1, 2]} (2 stocks used, high waste, fitness = low).
• Selection: Choose the best-fit chromosomes (e.g., Chromosome 1 and Chro-
mosome 2) for crossover.
• Crossover: Combine parts of Chromosome 1 and Chromosome 2 to create
new offspring:
Offspring = {[2, 0], [1, 2]}
• Mutation: Randomly modify a pattern in the offspring to maintain diversity.
For example:
Mutated Offspring = {[2, 0], [0, 3]}
• Replacement: Replace the least fit chromosomes with the offspring.
Output: After multiple generations, the Genetic Algorithm finds an optimal
solution:
• Optimal patterns:
– Pattern 1: [2, 0] (2 pieces of Type 1 per stock).
– Pattern 3: [1, 2] (1 piece of Type 1 and 2 pieces of Type 2 per stock).
• Total stocks used: 2 (1 stock for Pattern 1 and 1 stock for Pattern 3).
• Waste: Minimal (e.g., only a few units of unused space on each sheet).
Assignment for Mathematical Modeling - Academic year 2024 - 2025 Page 15/21
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering
Figure 2: Flow chart outlining the main steps of the Column Generation Algorithm
Assignment for Mathematical Modeling - Academic year 2024 - 2025 Page 16/21
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering
b1
b2
• b=
... : Demand vector, where bi is the required number of pieces of size
bm
wi × hi .
• A: Cutting pattern matrix, where aij represents the number of pieces of type
i in pattern j.
3.4.2 Objective
The goal is to minimize the total number of stock sheets used to meet the demand
for all piece types while minimizing waste. Let:
• xj : Number of stock sheets used for cutting pattern j.
• aij : Number of pieces of type i that can be cut in pattern j.
• bi : Demand for pieces of type i.
Objective:
n
X
Minimize z = xj
j=1
Subject to:
n
X
aij xj ≥ bi ∀i = 1, 2, . . . , m
j=1
xj ≥ 0 and integer ∀j = 1, 2, . . . , n
Here, z represents the total number of stock sheets used.
Assignment for Mathematical Modeling - Academic year 2024 - 2025 Page 17/21
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering
subject to: X
aij xj ≥ di , ∀i = 1, . . . , m
j
xj ≥ 0, ∀j
where: - xj is the number of times pattern-j is used. - aij is the number of pieces
of type-i in pattern-j. - di is the demand for piece type-i.
Step 2: Pricing Problem (PP)
The pricing problem generates new patterns (columns) that can potentially reduce
the overall cost. The subproblem for each stock sheet maximizes the reduced cost:
X
Maximize π i ai
i
subject to: X
wi hi ai ≤ W H, ai ≥ 0 and integer.
i
Here: - πi are the dual prices of the MP. - wi , hi are the dimensions of piece type-i.
- W H is the area of the stock sheet.
If the reduced cost of the solution is negative, the corresponding pattern is
added to the RMP.
Step 3: Initialization
Solve the RMP using a small subset of feasible patterns (e.g. simple patterns with
a single or a few types of pieces). Obtain dual prices πi for the constraints of the
solution.
Step 4: Solve Pricing Problem
Use dual prices πi to solve the pricing problem and identify new cutting patterns
with negative reduced cost. This step can be solved using a **Knapsack Problem**
approach.
Step 5: Add New Columns
If new patterns are identified, add them to the RMP and resolve it. Update the
solution and dual prices.
Step 6: Termination
The algorithm terminates when no new pattern with negative reduced cost can
be found, indicating that the optimal solution to the master problem has been
reached.
Assignment for Mathematical Modeling - Academic year 2024 - 2025 Page 18/21
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering
Example Application
subject to:
4a1 + 3a2 ≤ 10, a1 , a2 ≥ 0 and integer.
If the solution yields a1 = 0, a2 = 3, a new pattern [0, 3] is identified.
Step 3: Add New Pattern
Add the new pattern to the RMP and resolve it.
Step 4: Iterate
Repeat the process of solving the RMP, updating the dual prices, solving the
pricing problem, and adding new patterns until no pattern with negative reduced
cost is found.
Optimal Solution:
After several iterations, the final solution includes:
• Pattern 1: [2, 0] used once.
• Pattern 3: [1, 2] used once.
Result: The total number of stock sheets required is 2, with minimal waste.
Assignment for Mathematical Modeling - Academic year 2024 - 2025 Page 19/21
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering
4 Conclusion
The simplicity of the greedy algorithm allows for quick solutions to the 2D-CSP.
However, it may not produce the optimal solution in all cases due to its myopic
nature. Advanced techniques, such as genetic algorithms or dynamic program-
ming, could potentially improve the results at the cost of increased computational
complexity.
By systematically exploring the solution space using the Column Generation
Algorithm, efficient cutting patterns are identified that minimize trim loss while
satisfying all demands. This approach is particularly effective for large-scale prob-
lems, offering robust and scalable solutions that are adaptable to diverse real-world
scenarios.
5 Analyze Results
We compare four algorithms: two from the given (Greedy and Random) and two
from our group (Greedy - Policy1 and Column Generation - Policy2). The evalu-
ation is conducted using the following settings:
• Seed: 0 to 9
• Epoch: 100
Assignment for Mathematical Modeling - Academic year 2024 - 2025 Page 20/21
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering
References
1. P. C. Gilmore and R. E. Gomory (1961) Operations Research 9(6). Retrieved
from https://doi.org/10.1287/opre.9.6.849
2. M. Iori, V. L. De Lima, S. Martello, F. K. Miyazawa, and M. Monaci (2021)
European Journal of Operational Research 289(2). Retrieved from https:
//doi.org/10.1016/j.ejor.2020.06.047
3. R. W. Haessler and P. E. Sweeney (1991) European Journal of Operational
Research 54(2). Retrieved from https://doi.org/10.1016/0377-2217(91)
90216-U
4. A. R. Pitombeira-Neto and A. H. Murta (2022) EURO Journal on Computa-
tional Optimization 10. Retrieved from https://doi.org/10.1016/j.ejco.
2021.100027
5. Yizhun Wang (November, 2023) Theoretical and Natural Science 14. Re-
trieved from https://www.researchgate.net/publication/376076453_Review_
on_greedy_algorithm
Assignment for Mathematical Modeling - Academic year 2024 - 2025 Page 21/21