5.1. Application of the Benders Decomposition Method in Completing the ARC-ISOP Optimization Model
Using the theory of decomposition and duality, an Internet Shopping Online Problem (ISOP) can be divided into a master problem and a dual subproblem. To perform the Benders decomposition method, the variables and constraints need to be divided into two groups, linear variables and nonlinear variables, in the ARC-ISOP model (Formulations (12)–(23)). To simplify the work, some variables are denoted as follows:
- (1)
The continuous variables , and are denoted as , with Constraints (16)–(20) and (22) representing the linear parts that will be formulated into dual form.
- (2)
The integer variables and are denoted as , with Constraints (13)–(15) and (23) representing the set .
- (3)
As detailed below, , and are dual variables denoted as , introduced for Constraints (16)–(20).
Based on the denotations mentioned, the model indicators in the Benders decomposition algorithm are equivalent to as the initial problem as the master problem and as the subproblem. After identifying the linear and nonlinear variables, the next step is to use the Benders decomposition algorithm.
- (1)
First Stage
The first stage is carried out to find the optimal solution of the variables considered difficult to solve; in this case, the integer variables ( and ) are denoted as .
Solve the initial master problem
as an initial step, obtained from the ARC-ISOP model, which only contains integer variables. Note that
is the empty set, and the limit of the model is
. Since
is an empty set and
, then
can be written as follows:
Note that Benders cut is not added to this problem (since ).
- 2.
Step 2
Determine the inner optimization model
which contains an objective function and a constraint that only has continuous variables
. The term
can be written as follows:
Because the objective function in the minimization optimization model in Equations (33)–(39) is zero, it is necessary to carry out a duality process to avoid a zero value using the duality theory. The zero value in the minimization objective function results in the solution being zero. By introducing the five dual variables
, and
corresponding to five Constraints (34)–(38), respectively, the following is a dual formulation known as subproblem
of the inner optimization problem (see Equation (27)):
Equation (40) can be solved by substituting the value of obtained from Step 1 to obtain the value of the dual variables.
- 3.
Step 3
Test whether the , where .
, where , then stop the iteration and proceed to the second stage.
, where , then the iteration continues to the next step.
- 4.
Step 4
Each iteration will add a Benders cut, which is derived from the objective function in Subproblem
Here is Benders cut as a new constraint:
where
are parameters and
is unknown. By adding a new constraint to the initial master problem
in (32), the regular master problem
can be obtained after introducing the set
of Benders cut generated so far. Note that the dual optimal variables have been assigned an additional index b for each Benders cut. The regular master problem
is stated as follows:
Solve (42), then return to Step 3. The calculation continues until the limit test in Step 3 stops.
- (2)
Second Stage
The second stage is carried out to find the optimal solution of the inner optimization model (see Equations (33)–(39)), which only contains continuous variables by completing the initial model that has been substituted with the value of from the first stage.
The solution obtained from the second stage, added to the optimal solution from the first stage, becomes the total optimal solution from the Benders decomposition method.
5.2. Numerical Simulation
5.2.1. Python Algorithm
The Python algorithm to solve the ARC-ISOP optimization model with the Benders decomposition method is as follows:
Before starting the algorithm, open
https://colab.research.google.com/ (accessed on 27 July 2022) or open a programming application that supports Python.
Algorithm 1: Solving the initial master problem. |
Begin |
Step 1: Define the problem using the syntax “LpMinimize” and the variables using the syntax “LpVariable”. |
Step 2: Use the Pulp module to initiate initial_master_model. |
Step 3: Read intial_master_model using the syntax “print()”. |
Step 4: Use the Pulp module to solve initial_master_model using the syntax “solve()”. |
Step 5: Print the results using the following syntax: |
For all do |
Print |
For all do |
Print . |
End for |
End for |
End |
Algorithm 2: Solving the subproblem model. |
Begin |
Step 1: Define the problem using the syntax “LpMaximize” and the variables using the syntax “LpVariable”. |
Step 2: Use the Pulp module to initiate subproblem_model. |
Step 3: Read subproblem_model using the syntax “print()”. |
Step 4: Use the Pulp module to solve subproblem_model using the syntax “solve()”. |
Step 5: Print the results using the following syntax: |
For all do |
For all do |
Print . |
Print . |
Print . |
End for |
End for |
Step 6: Print and . |
End |
Algorithm 3: Solving inner optimization model. |
Begin |
Step 1: Define the problem using the syntax “LpMinimize” and the variables using the syntax “LpVariable”. |
Step 2: Use the Pulp module to initiate inner_model. |
Step 3: Read inner_model using the syntax “print()”. |
Step 4: Use the Pulp module to solve inner_model using the syntax “solve()”. |
Step 5: Print the results using the following syntax: |
For all do |
For all do |
Print . |
Print . |
End for |
End for |
Step 6: Print and . |
End |
Algorithm 4: Library installation and data upload. |
Begin |
Step 1: Install the pulp library with the following syntax: “pip install pulp”. |
Step 2: Import the required libraries using the following syntax: “import pulp as lp”, “import pandas as pd”, “import numpy as np”, and “import random as rd”. |
Step 3: Upload the research data using the following syntax: |
“from google.colab import files” |
“upload=files.upload()” |
Step 4: Import the sheet in Excel files that has been uploaded using the following syntax: |
“import io” |
“name = pd.read_excel(io.BytesIO(upload[‘file name.xlsx’]),sheet_name=’name’)” |
Algorithm 5: Solving the maximum flow problem model. |
Begin |
Step 1: Define the set of points in the form of an array. |
Step 2: Define the problem using the syntax “LpProblem” then “LpMaximize” and the variables using the syntax “LpVariable”. |
Step 3: Define the objective function and the constraint function. |
For all do |
Define the entry point. |
End for |
For all do |
Define the exit point. |
End for |
Step 4: Use the Pulp module to initiate mfp_model. |
Step 5: Use the Pulp module to solve mfp_model using the syntax “solve()”. |
Step 6: Print the results using the following syntax: |
For all do |
For all do |
Print . |
End for |
End for |
End |
The Benders decomposition method is divided into two stages. The first stage is to find the optimal value of the nonlinear variable using Algorithm 1 and Algorithm 2, while the second stage is to find the optimal value of the linear variable using Algorithm 3. Meanwhile, Algorithm 4 and Algorithm 5 are used before starting the Benders Decomposition Method.
5.2.2. Case Study 1
The data used in this numerical simulation are the secondary data obtained from Tokopedia, accessed on 15 June 2022, using the skincare product category [
19]. Data that have previously been collected from primary sources and made easily accessible for academics to use for their own research are known as secondary data. This is the category of information that has previously been collected [
20,
21]. The data collected include the selling prices of five products from six different online shops in Bandung, including shipping costs and delivery times from each online shop. The data can be seen in
Table 3.
To find the optimal solution on the data in
Table 3, the Benders decomposition algorithm consists of two stages.
- (1)
First Stage
The first stage is to find the optimal solution for the nonlinear or integer variables.
Solve initial master problem
) as an initial step. Note that
B is an empty set, and the limit of the model is
. Substitute data from
Table 3 into (32), then use Algorithm 1 in Python to get the optimal solution.
and with a minimum total cost of (lower bound).
- 2.
Step 2
Solve the subproblem (see Equation (40)) to obtain the values of dual variables. However, in this case, (40) does not contain and variables, so the subproblem can be solved immediately using Algorithm 2 in Python.
with a maximum value of 0.
(upper bound).
- 3.
Step 3
Bound test: , where .
Since where , the first stage is discontinued. The case in this research did not pass Step 4, namely the addition of the Benders cut. Then, the calculation continues to the second stage. From the first stage, the optimal solution is with a minimum total cost of .
- (2)
Second Stage
The solutions in
Table 6 and
Table 7 are the optimal solutions that minimize the total cost of purchasing skincare products at six online shops. The total cost is optimal if products 1, 2, 3, 4, and 5 are purchased from the fourth shop, with a total cost of Rp130.100, and the delivery time is about two days.
5.2.3. Case Study 2
The data used in this numerical simulation are the secondary data obtained from Tokopedia, accessed on 22 June 2022, using the skincare product category [
20]. The data collected include the selling prices of five products from six different online shops in various cities across Java, including shipping costs and delivery times from each online shop. The data can be seen in
Table 8.
To find the optimal solution based on the data in
Table 8, the Benders decomposition algorithm consists of two stages.
- (1)
First Stage
The first stage is to find the optimal solution for the nonlinear or integer variables.
Solve initial master problem
as an initial step. Note that
is an empty set, and the limit of the model is
. Substitute data from
Table 8 into (32), then use Algorithm 1 in Python to obtain the optimal solution.
and with a minimum cost of Rp 119.000 (lower bound).
- 2.
Step 2
Solve the subproblem (see Equation (40)) to obtain values of dual variables. However, in this case, (40) does not contain x and y variables so the subproblem can be solved immediately using Algorithm 2 in Python.
with a maximum value of.
(upper bound).
- 3.
Step 3
Bound test: , where .
Since , where , the first stage is discontinued.
The case in this research did not pass Step 4, namely the addition of the Benders cut. Then, the calculation continues to the second stage. From the first stage, the optimal solution is and , with a minimum total cost of Rp 119.000.
- (2)
Second Stage
The solutions in
Table 11 and
Table 12 are the optimal solutions that minimize the total cost of purchasing skincare products at six different online shops. The total cost is optimal if products 1, 2, 3, 4, and 5 are purchased from the fifth shop, with a total cost of Rp. 119.000 and delivery time is about three days. With the emergence of an optimal solution that satisfies the objective function and all constraints on the model, it can be concluded that the Benders decomposition method can be used to complete a robust optimization model in the case of internet shopping online.