0% found this document useful (0 votes)
21 views

Stochastic Programming-1

This document describes a stochastic programming assignment involving two problems: 1) optimizing manufacturing production to meet uncertain demand, and 2) developing emergency response strategies under uncertainty. For the first problem, students employ a two-stage stochastic linear programming model to determine an optimal production plan that balances costs and responsiveness to demand scenarios. For the second problem, algorithmic solutions based on stochastic programming are used to optimize resource allocation and evacuation routes amid unpredictable emergencies. The report will analyze both problems and discuss how stochastic programming can aid strategic planning under uncertainty in industrial and emergency contexts.

Uploaded by

cqp1310
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Stochastic Programming-1

This document describes a stochastic programming assignment involving two problems: 1) optimizing manufacturing production to meet uncertain demand, and 2) developing emergency response strategies under uncertainty. For the first problem, students employ a two-stage stochastic linear programming model to determine an optimal production plan that balances costs and responsiveness to demand scenarios. For the second problem, algorithmic solutions based on stochastic programming are used to optimize resource allocation and evacuation routes amid unpredictable emergencies. The report will analyze both problems and discuss how stochastic programming can aid strategic planning under uncertainty in industrial and emergency contexts.

Uploaded by

cqp1310
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

VIETNAM NATIONAL UNIVERSITY, HO CHI MINH CITY

UNIVERSITY OF TECHNOLOGY
FACULTY OF COMPUTER SCIENCE AND ENGINEERING

MATHEMATICAL MODELING (CO2011)

Assignment (Semester: 231, Duration: 06 weeks)


“Stochastic Programming and Applications”

Advisor: Nguyen Van Minh Man, Mahidol University.

Students: Truong Tuan Kiet - 2252411.


Nguyen Anh Kiet - 2252403.
Phung Gia Minh Khoi - 2252381.
Nguyen Thi Quoc Nguyen - 2252549.

HO CHI MINH CITY, DECEMBER 2023


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

Member list & Workload

No. Fullname Student ID Problems Percentage of work

1 Truong Tuan Kiet 2252411 - Problem 1: Industry - 25%


Manufacturing

2 Nguyen Anh Kiet 2252403 - Problem 1: Industry - 25%


Manufacturing

3 Phung Gia Minh Khoi 2252381 - SLP-EPDR: Algorithmic 25%


Solutions

4 Nguyen Thi Quoc Nguyen 2252549 - SLP-EPDR: Algorithmic 25%


Solutions

Assignment for Discrete Structures for Computing - Academic year 2023 - 2024 Page 1/25
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

Contents
1 Introduction 3

2 Problem 1: Industry - Manufacturing 4


2.1 Problem statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2 Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.3 Results and Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3.1 First-Stage Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3.2 Second-Stage Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3.3 Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.4 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

3 Problem 2: SLP-EPDR: Algorithmic Solutions 9


3.1 Introduction - why use 2-stage stochastic . . . . . . . . . . . . . . . . . . . . . . 9
3.2 Model description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.3 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.4 Experiment design using successive path algorithm . . . . . . . . . . . . . . . . . 13
3.4.1 Minimum-cost flow problem . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.4.2 Time-dependent min-cost flow problem . . . . . . . . . . . . . . . . . . . 17
3.5 Verify the effectiveness of the SUCCESSIVE SHORTEST PATH ALGORITHM
algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

4 Discussion 22
4.1 Integrative Analysis of Manufacturing and Emergency Planning . . . . . . . . . . 22
4.2 Challenges and Opportunities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.3 Implications and Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.4 Concluding Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

5 Conclusion 23

Assignment for Discrete Structures for Computing - Academic year 2023 - 2024 Page 2/25
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

1 Introduction
The complex interplay of uncertain variables in the realms of industrial manufacturing and
emergency response planning poses significant challenges for decision-makers. It is in this context
that stochastic programming becomes indispensable, offering a robust and nuanced framework
for optimization amidst uncertainty. This framework not only accommodates variability but also
provides a structured approach to decision-making that can significantly mitigate risk. Our report
delves into two core applications of stochastic programming: the optimization of manufacturing
processes in the face of uncertain demand, and the development of responsive strategies for
emergency planning and disaster recovery.
The first part of our analysis addresses a pivotal aspect of industrial operations—the pro-
duction planning conundrum faced by manufacturers. Herein, we employ a two-stage stochastic
linear programming model (2-SLPWR) to navigate the complexities of aligning production with
fluctuating demand. This model offers a profound insight into how strategic planning, un-
derpinned by robust mathematical modeling, can effectively anticipate and accommodate the
randomness of consumer behavior and market trends. Through a comprehensive simulation
of scenarios and meticulous computational analysis, we elucidate the derivation of an optimal
solution that balances cost-efficiency with responsiveness to market dynamics.
Concurrently, the exigencies of emergency management present a scenario where the stakes
are elevated, and the need for precision and foresight is acute. In this domain, our study shifts
focus to Stochastic Linear Programming with Emergency Planning and Disaster Recovery (SLP-
EPDR), a field where the optimization of resources and routing can have far-reaching implications
on community safety and recovery. Algorithmic solutions rooted in stochastic programming pro-
vide a canvas for developing strategies that optimize evacuation routes, resource allocation, and
contingency planning, all within a framework that accommodates the inherent unpredictability
of emergencies.
By undertaking this dual analysis, our report seeks to cast light on the comprehensive ca-
pabilities of stochastic programming. We explore the theoretical underpinnings that inform this
field of study, as well as the practical implications of its application. The aim is to present a
holistic view of how stochastic programming can serve as a linchpin in the strategic planning of
both industrial and emergency scenarios, ensuring that decisions are data-driven, rigorously an-
alyzed, and strategically sound. Through this exploration, we underscore the value of stochastic
programming as an essential tool in the arsenal of modern decision-making.
In synthesizing these perspectives, the report will navigate through the nuanced facets of
stochastic programming, from the granular details of mathematical modeling to the broad strokes
of strategic application. We will dissect the challenges posed by uncertainty, explore the strategies
devised to confront these challenges and evaluate the outcomes of our analyses. By doing so, we
hope to demonstrate the indelible impact of stochastic programming on efficient decision-making
and its potential to transform theoretical models into actionable strategies with tangible benefits.

Assignment for Discrete Structures for Computing - Academic year 2023 - 2024 Page 3/25
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

2 Problem 1: Industry - Manufacturing


2.1 Problem statement
At the heart of industrial manufacturing lies the quest to synchronize production with
demand, a task complicated by the inherent uncertainty that characterizes modern supply chains.
Manufacturers face the predicament of predicting customer demand, which is influenced by
factors often outside their control, such as economic shifts, competitor actions, and market
trends. Inaccurate forecasts can lead to two primary adverse outcomes: excess inventory when
production overshoots demand, incurring storage and capital costs, or stockouts when production
falls short, leading to lost sales and eroded customer trust.
This report addresses the manufacturing optimization problem by acknowledging the stochas-
tic nature of demand. We confront the challenge of determining the optimal number of units
to produce for a set of products where the future demand is not known with certainty. The
problem is exacerbated by the need to make decisions regarding production and inventory be-
fore the actual demand is realized, necessitating a model that can handle multiple scenarios and
outcomes.
The subsequent methodology section will introduce a two-stage stochastic programming
model as a solution to this problem. This model is designed to make initial production decisions
under uncertainty, followed by adjustments as actual demand data becomes available. The
objective is to minimize the expected total cost, which includes not only the costs of production
and inventory but also the costs associated with the inability to meet demand.
Through this approach, we aim to provide a framework that enables manufacturers to make
informed decisions that balance the competing objectives of cost minimization and service level
maximization in an uncertain world.

2.2 Methodology
The methodology employed to address the manufacturing optimization problem under uncer-
tainty is rooted in two-stage stochastic programming. This section delineates the step-by-step
process of formulating and implementing the model, as well as the rationale behind choosing this
particular approach.

Model Formulation
The two-stage stochastic programming model consists of two decision points: the first stage
(here-and-now) before the uncertainty is revealed and the second stage (wait-and-see) after the
uncertainty is realized. The model is formulated as follows:

1. Decision Variables:

Assignment for Discrete Structures for Computing - Academic year 2023 - 2024 Page 4/25
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

• First-Stage Variables: These represent the quantities of each product to be produced


and parts to be ordered before the demand is known.
• Second-Stage Variables: These are contingent upon the realized demand and represent
the adjustments to production and inventory levels.

2. Objective Function: The objective is to minimize the expected total cost, which is the
sum of the production, inventory holding, and stockout costs across all possible demand
scenarios.

3. Constraints:

• Production constraints ensure that the production amount does not exceed the plant’s
capacity.
• Inventory balance constraints ensure that inventory levels are maintained appropri-
ately, accounting for the initial stock, production output, and realized demand.
• Demand fulfillment constraints ensure that customer demand is met to the extent
possible.

The flowchart below illustrates the sequential decision-making process in the two-stage
stochastic programming model.

Assignment for Discrete Structures for Computing - Academic year 2023 - 2024 Page 5/25
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

Initialize
Model

First-Stage
Decision

Generate
Scenarios

Second-
no Stage
Decision

Is solution
optimal?

yes

Stop

Figure 1: Schematic of the Two-Stage Stochastic Programming Model

4. Scenario Generation: A set of scenarios is generated to represent the possible states of


future demand. Each scenario is assigned a probability based on historical data or market
analysis.

5. Data Collection and Preparation: Historical demand data is collected to inform the
demand probability distributions. Costs associated with production, inventory, and stock-

Assignment for Discrete Structures for Computing - Academic year 2023 - 2024 Page 6/25
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

outs are compiled from company records or industry standards.

In addressing the manufacturing optimization problem, the two-stage stochastic program-


ming approach is formalized through a series of mathematical expressions that guide the decision-
making process. The core of the methodology is captured in the following key equations:
The second part of the objective function, which accounts for pre-ordering costs and the
expected cost of the optimal production plan, is given by:

min z T c − sT y (1)

subject to the constraints of inventory balance and demand fulfillment, where c and s are cost
coefficient vectors, and z and y are decision variables representing the production plan and
inventory levels, respectively.
Additionally, the optimization problem is encapsulated by the following model:

min bT x + Q(x) − hT z + lT y (2)


x,y,z

where Q(x) = ED|z [g(x, D)] is the expected cost function conditioned on the realization of de-
mand D, and h and l represent the vectors of selling price and salvage value per unit, respectively.

Implementation
The model is implemented using a linear programming solver within a Python environment,
leveraging the PuLP library. The implementation involves:

1. Data Input: The demand scenarios, cost parameters, and initial inventory levels are input
into the model.

2. Solver Execution: The model is solved for each scenario, with the solver providing the
optimal first-stage decisions immediately and the optimal second-stage decisions once the
demand scenario is known.

3. Solution Analysis: The solutions across all scenarios are analyzed to determine the expected
costs and the robustness of the production plan.

Model Execution
The model is executed using a sample data set to validate its performance. The results are then
compared to a baseline model, which uses a deterministic approach to production planning.
By using this two-stage stochastic programming approach, the methodology allows for more
resilient and cost-effective decision-making in the face of demand uncertainty, compared to tra-
ditional deterministic models.

Assignment for Discrete Structures for Computing - Academic year 2023 - 2024 Page 7/25
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

2.3 Results and Analysis


The implementation of the two-stage stochastic programming model yielded optimal solutions
for both stages of the decision-making process under the given scenarios. The results are as
follows:

2.3.1 First-Stage Results

The first-stage model, which is concerned with initial production decisions before the realization
of demand, has resulted in an optimal objective value of $1013.625. The optimized decision
variables for ordering parts or producing products are as follows:

• x[0] = 18.0,

• x[1] = 15.0,

• x[2] = 18.0,

• x[3] = 18.0,

• x[4] = 20.0.

This indicates the quantities to be ordered or produced initially, without the knowledge of exact
future demand.

2.3.2 Second-Stage Results

Upon the realization of demand in two different scenarios, the second-stage model adapted the
initial decisions accordingly.

• In Scenario 1, the model achieved an objective value of -646.0. The optimal production
values adjusted after the demand realization were [4.0, 1.0, 2.625, 0.0, 0.0, 1.125, 0.0, 0.0],
with some products not requiring any adjustment and others being increased.

• In Scenario 2, the model reached an objective value of -659.5. The optimal values for
production adjustments were [6.25, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], which again shows
variation in adjustments across different products.

The negative objective values represent the net cost savings compared to a scenario where no
production adjustment is possible. The results clearly indicate the efficacy of the two-stage
stochastic programming approach, where the adaptability to demand uncertainty can lead to
significant cost reductions.

Assignment for Discrete Structures for Computing - Academic year 2023 - 2024 Page 8/25
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

2.3.3 Analysis

The results from the two-stage stochastic programming model demonstrate the model’s ability
to provide a flexible and cost-effective solution for manufacturing under uncertainty. The first-
stage decisions lay the groundwork for a proactive approach to production planning, while the
second-stage decisions allow for reactive adjustments, ensuring that production is closely aligned
with the actual demand.
The model’s performance in both scenarios suggests that it can effectively mitigate the risks
associated with demand uncertainty, leading to more efficient use of resources and reduced costs.
The cost savings observed in both scenarios highlight the potential for improved profitability
through the application of such advanced optimization techniques.
Overall, the analysis suggests that incorporating stochastic elements into production plan-
ning can provide a significant strategic advantage in the highly competitive and uncertain envi-
ronment of manufacturing.

2.4 Conclusion
The application of two-stage stochastic programming to the manufacturing optimization problem
has demonstrated the potential for significant improvements in cost management and service level
performance. The results of this study suggest that incorporating uncertainty into production
planning is not only feasible but also advantageous in today’s volatile manufacturing landscape.

3 Problem 2: SLP-EPDR: Algorithmic Solutions


3.1 Introduction - why use 2-stage stochastic
When a disaster happens, it can be split into 2 stages: pre-disaster and post-disaster, in
which the pre-disaster will be considered as the first stage of stochastic programming and the
post-disaster will be the second. In the first stage, the plan is premade without the random
variable. On the other hand, the second stage is constructed with consideration of uncertain
variables: travel times and capacities. Then we will use the Lagrange relaxation method to
split into 2 subproblems: min-cost flow model and its time-dependent case. In general, the
subproblems are considered as the upper and lower bounds and can be solved using successive
shortest-path algorithms.

In summary, finding the subgradient optimization will reduce the gap between the 2 bounds
and lead to the objective final solution. The main purpose is to plan before the disaster happens
- the optimal solution to stage 1 is to know which is the best plan to test all the uncertainty that
can happen in stage 2.8.

Assignment for Discrete Structures for Computing - Academic year 2023 - 2024 Page 9/25
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

3.2 Model description

Decision Variable Definition


xij the flow on link (i, j)
s
yij (t) the flow on link (i, j) in scenario s at time t

Table 1: Decision Variables Definition

We will find a way to minimize the time travel of the flow from the supply node to the
demand node. If there exist multiple paths at the same time, we choose the path with maximum
capacities. The xij in the first stage has to satisfy the balance constraint the out-degree =
in-degree:
X X
xij − xji = di (3)
(i,j)∈A (j,i)∈A

where di is a parameter with the following definition:





 v, if i = s

di = −v, if i = t



0, otherwise

Meanwhile, the flow on each link must also satisfy the capacity constraint:

0 ≤ xij ≤ uij , ∀(i, j) ∈ A (4)

In which the v means the out-degree and −v is in-degree.

Assignment for Discrete Structures for Computing - Academic year 2023 - 2024 Page 10/25
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

Then the adaptive plan for the second stage is made using this model:

 X X S
µs · Q(Y, s)



 min Pij xij +



 (i,j)∈A s=1


s. t.





 X X




 x ij − xji = di , ∀i ∈ V
 (i,j)∈A
 (j,i)∈A



0 ≤ xij ≤ uij , ∀(i, j) ∈ A










 in which,
 X
csij (t) · yij
s

 Q(Y, s) = min

(t)
(i,j)∈A (5)






 s. t.

 X X
s s
yij (t) − yji (t) = dsi (t), ∀i ∈ V,







 (i,j)∈A (j,i)∈A


t ∈ {0, . . . , T }, s = 1, . . . , S





s
(t) ≤ usij (t),

0 ≤ yij ∀(i, j) ∈ A,






t ∈ {0, . . . , T }, s = 1, . . . , S





 X
s
yij (t) = xij , ∀(i, j) ∈ A, s = 1, . . . , S





t≤T

Given the substantial complexity of this model, it presents significant challenges in terms of
resolution. Therefore, it is prudent to decompose it into two distinct subproblems, which can be
addressed using the method of Successive Shortest Path Algorithm.

3.3 Implementation
Below is the implementation of the successive path algorithm:

1. Initialize the graph with zero flow x ← 0, and each node with v.

2. Choose a supply node (s) with v > 0 and a demand node (d) with v < 0. (If one of them
doesn’t exist, terminate the program).

3. Find the residual path from s to d with positive capacity.

a) Calculate the total travel time of all the possible approaches from s to d. If there are
no existing links but reverse links, we travel that link.
b) If a loop with negative flow exists, terminate the program with an error.
c) Choose the path that has minimum travel time and the highest capacity.

Assignment for Discrete Structures for Computing - Academic year 2023 - 2024 Page 11/25
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

4. Calculate the amount of flow ∆ that can be sent on this path, which is the lowest capacity
of any edge on the path.

5. Update the flow, subtract the capacity of the forward links by ∆. By the time, add the
capacity ∆ of the reverse links. If the reverse link doesn’t exist, create a new edge with
negative travel time and the reverse direction.

6. Reduce the supply by ∆ and increase the demand by ∆.

7. Increase flow for every edge in the path.

8. Return to step 2.

Here is the argument report for Successive Shortest Path:

• b(n): beginning supply value v for each node.

• c(n): the shortest path from some node n to v in A(x) with respect to each edge’s travel
time.

• R(x): residual graph.

1. Initialize the graph with zero flow x_ij = 0, for all (i, j) in A
2. Set v(n) = b(n) for all n in V
3. Initialize E = {e in V : v(e) > 0} and D = {e in V : v(e) < 0}
4. While E is not empty
a. Pick a node k in E and l in D
b. Compute c(k): shortest time cost of the paths from k to l in A(x)
with respect to edges’ travel time
c. Let R(x) be a path that has the minimum time cost from k to l.
d. Let u = min{e(k), -e(l), min{u_r(v, w) : (v, w) in R(x)}}
e. Send u units of flow on the residual path R(x)
f. Update x_ij, C(x), U_ij(x), A(x), E, D
5. End while

Here are also some notes for the algorithm. The reversible path is for the case if there
are no existing links with positive travel time, but reversible links, we travel that link to undo
previous flows. Then, we can continue. If there are some supply or demand nodes without any
positive links, the graph has no solution. In other words, it is impossible to satisfy all of the
transportation from the supply source to the demand source.

Assignment for Discrete Structures for Computing - Academic year 2023 - 2024 Page 12/25
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

3.4 Experiment design using successive path algorithm


3.4.1 Minimum-cost flow problem

In the first stage of the Stochastic Programming problem, we meet the fixed scenario with
the same capacity and time travel, without uncertainty in the future. We set up an experimental
example with 9 nodes and 12 links at an example:

Figure 2: Graph 1

In order to verify the correctness of the successive shortest path algorithm, we can use this
algorithm to solve the Min-cost flow problem in a square 3 × 3 graph.

Figure 3: Illustrate first iteration

Assignment for Discrete Structures for Computing - Academic year 2023 - 2024 Page 13/25
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

For the first iteration, we initialize the graph with zero flow. Then, we can see that node 1
is a supply value node with value v = 10, and node 9 is a demand node with value −v = −10.
After that, we calculate the travel time and the capacity of every possible path from node 1 to
node 9.

No. Path Time Capacity


1 1→2→3→6→9 230 5
2 1→2→5→6→9 160 3
3 1→2→5→8→9 150 2
4 1→4→5→6→9 220 3
5 1→4→5→8→9 210 2
6 1→4→7→8→9 220 4

Table 2: Possible path for the first iteration

Among those paths, the route that has the lowest travel time is 3. The capacity of the path
is 2, which is the edge between node 5 and node 6. Therefore, we can transmit 2 supply values
to the demand node. Subtract a value of 2 to supply node 1, and add 2 to demand node 9.

Then, for each edge in the graph, we subtract 2 from the capacity. Also, we create the
reverse links that have negative travel time, capacity value is 2, and reverse the direction.

The total travel time for transmitting 2 supply values along the path is 300.

Figure 4: Illustrate the second iteration

Assignment for Discrete Structures for Computing - Academic year 2023 - 2024 Page 14/25
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

No. Path Time Capacity


1 1→2→3→6→9 230 3
2 1→2→5→6→9 160 1
3 1→4→5→6→9 220 3
4 1→4→7→8→9 220 3

Table 3: Possible path for the second iteration

In this iteration, we choose path 2 for a minimum time.

Total travel time is 160

Figure 5: Illustrate the third iteration

No. Path Time Capacity


1 1→2→3→6→9 230 2
2 1→4→5→6→9 220 2
3 1→4→7→8→9 220 3

Table 4: Possible path for the third iteration

In this iteration, both the second and third paths have the same time, but the third path
has a higher capacity. We choose the third path to supply the highest value.

Total travel time is 660

Assignment for Discrete Structures for Computing - Academic year 2023 - 2024 Page 15/25
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

Figure 6: Illustrate the fourth iteration

No. Path Time Capacity


1 1→2→3→6→9 230 2
2 1→4→5→6→9 220 2

Table 5: Possible path for the fourth iteration

In this iteration, we choose the second path for the minimum time.

Total travel time is 440.

Figure 7: Illustrate the fifth iteration

Assignment for Discrete Structures for Computing - Academic year 2023 - 2024 Page 16/25
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

No. Path Time Capacity


1 1→2→3→6→9 230 2

Table 6: Possible path for the fifth iteration

In this iteration, we only can choose the first path.

Total travel time is 460.

Figure 8: Result

We receive the following output:

The total travel time for all flows is 2020.

The maximum travel time of 1 supply is 230 (path 1 → 2 → 3 → 6 → 9 )

3.4.2 Time-dependent min-cost flow problem

In the second stage, several scenarios include randomness affecting the graph’s properties,
like capacity and weight. The second stage Stochastic Programming involves calculating the best
flow to adopt for every scenario happening in the future.
For a simple demonstration of the assignment, we will only consider 2 scenarios:
Scenario 1: only use graph 1, with µ1 = 50
˜ 50, change to apply graph 2, with µ2 = 50%
Scenario 2: Firstly use graph 1, after T=
Below is the second scenario of the graph at T=
˜ 50

Assignment for Discrete Structures for Computing - Academic year 2023 - 2024 Page 17/25
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

Figure 9: Graph 2

Fortunately, the min-cost flow problem can also be solved with Successive Short Path algo-
rithm embedded in the Python library; to be more specific, networkx library. We utilize Python
to quickly solve the problem.
After drawing the graph and using “nx.capacity scaling” function, we received the following
result:
FlowCost 2800
FlowDict {2: {3: 4, 5: 1},
4: {5: 1, 7: 4},
1: {2: 0, 4: 0},
3: {6: 4},
5: {6: 1, 8: 1},
6: {9: 5},
7: {8: 4},
8: {9: 5},
9: {}
This means the flow for the second scenario is the following:

Assignment for Discrete Structures for Computing - Academic year 2023 - 2024 Page 18/25
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

Figure 10: Result of the second scenario

We receive the following output:


Total travel time for all flows: 3140
Maximum travel time of 1 supply: 370 (path 1 → 4 → 7 → 8 → 9 )
And finally, we receive the average flow best suited for 2 scenarios:
This flow has the total cost in graph 1 is 2095, and in graph 2 is 3080. Therefore, the average
total cost of the following flow is 2587.5.

Figure 11: Result of sub-problem 2

Assignment for Discrete Structures for Computing - Academic year 2023 - 2024 Page 19/25
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

However, sometimes the Successive Shortest Path algorithm can return a wrong answer.
The algorithm can only consider one scenario at a time, and it does not consider the randomness
element when dealing with second-stage stochastic programming problems. Hence, the result is
not optimal.
Let’s consider the following example:

Figure 12: Graph 3 and the result of Example 3 in the first-stage problem

The shortest path from the demand node to the supply node for graph 3 in the first-stage
time-cost problem is 210, which is 1 → 4 → 5 → 8 → 9 (1). We can easily calculate that the
total time cost for the following paths in the problem is 2310.

Figure 13: Graph 4 and the result of Example 3 in the second-stage problem using Successive
shortest path algorithm

Assignment for Discrete Structures for Computing - Academic year 2023 - 2024 Page 20/25
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

In the second-stage problem, we start applying graph 5 at T=


˜ 50. This means that there
will be 4 units in node 2, and 6 units in node 4. The path (1) now gives 70 + 100 + 160 = 330.
The total cost in this scenario is 2520.

Figure 14: Graph 5 and the result of Example 3 in second-stage problem in other solution

However, if we consider another approach between the demand and supply node, especially
1 → 2 → 5 → 8 → 9 (2), we notice that in the 2nd-stage problem, the path only costs 80 + 60
+ 160 = 300. This means that path (2) is more efficient than path (1) 10%.
Therefore, we bring 6 units in node 2 and 4 units in node 4. The total time cost in this case
is 2480. This is 1,61% better than the output from the Successive shortest path algorithm.
Hence, we can observe that an optimal solution in sub-problem 1 cannot help provide an
optimal solution in sub-problem 2. As a result, to solve the problem, we need to use another
algorithm that considers all of the possible uncertainties. One of the possible approaches is the
Lagrangian relaxation algorithm.

3.5 Verify the effectiveness of the SUCCESSIVE SHORTEST PATH


ALGORITHM algorithm
The successive shortest path algorithm implies a natural characterization of minimum-cost
flows if and only if it satisfies 3 conditions: Firstly it has to be inside the feasible set, secondly
it must satisfy the balanced function and lastly the residual graph contains no negative cost
cycles. Ford-Fulkerson by itself does not say how an augmenting path is to be found. If there is
more than one augmenting path, the algorithm does not state which is to be chosen. So, In each
iteration of the algorithm, we can find the shortest O(VA) time using the Bellman-Ford shortest
path algorithm, but also we could use Dijkstra’s algorithms to compute the shortest path, but
augmenting along a path of positive-cost edges introduces residual edges with negative costs, we
can not use Dijkstra’s algorithm in later iterations.

Assignment for Discrete Structures for Computing - Academic year 2023 - 2024 Page 21/25
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

Assuming the capacity of each edge is an integer, then each augmentation decreases the
total absolute balance B by a positive integer, and therefore by at least 1. It follows that the
cycle canceling algorithm halts after at most B iterations and thus runs in O(VAB) time.
Keep in mind that the successive path algorithm addresses only a single scenario, meaning
that in the context of two-stage stochastic programming, the derived solution may be inaccurate
as it fails to account for all possible scenarios.

3.6 Conclusion
In conclusion, this project has presented an approach to evaluate disaster through 2 stages
of stochastic programming. This method allows an adaptable framework that works well with
uncertainties and the dynamic nature of disaster scenarios.
The primary object of this report is to discuss the practical model for the road network
model, which is made to consider the behavior of the process by considering various aspects such
as travel times and capacities. These experimental models served as a crucial testing ground,
allowing us to analyze the effectiveness of the min-cost flow algorithm.

4 Discussion
The exploration of stochastic programming within the realms of industrial manufacturing
and emergency planning has yielded profound insights into the versatility and efficacy of the
approach. This discussion aims to integrate the findings from both Problem 1: Industry - Manu-
facturing and Problem 2: SLP-EPDR: Algorithmic Solutions, highlighting the interdependencies
and the distinct challenges addressed by each.

4.1 Integrative Analysis of Manufacturing and Emergency Planning


The application of the two-stage stochastic linear programming model (2-SLPWR) in the
manufacturing context has illustrated the critical importance of pre-emptive strategy formula-
tion. The optimal solutions derived for production planning underscore the value of predictive
modeling in managing and harnessing the inherent uncertainties of market demands. The ability
to simulate various demand scenarios and adapt production accordingly can lead to significant
cost savings, reduced waste, and improved operational efficiency.
Conversely, the algorithmic approach to emergency planning and disaster recovery has
emphasized the necessity of responsiveness and adaptability in high-pressure scenarios. The
SLP-EPDR’s focus on optimizing evacuation routes and resource allocation during emergencies
demonstrates a different facet of stochastic programming. Here, the immediacy of decision-
making, coupled with the critical nature of the outcomes, places an additional layer of complexity
on the modeling process.

Assignment for Discrete Structures for Computing - Academic year 2023 - 2024 Page 22/25
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

4.2 Challenges and Opportunities


Throughout the process of solving these problems, several challenges arose, including the
computational complexity of large-scale simulations and the difficulty in accurately modeling
random events. However, these challenges also presented opportunities for learning and inno-
vation. For example, the use of advanced computational tools and algorithms has not only
facilitated more efficient problem-solving but has also opened up new avenues for research into
more sophisticated models.
The contrast in the nature of decisions—’here-and-now’ for manufacturing and ’wait-and-
see’ for emergency planning—has also brought to light the importance of flexibility in approach
and methodology. The adaptability of stochastic programming to cater to both types of decisions
reflects its broad applicability and potential for cross-disciplinary integration.

4.3 Implications and Future Work


The implications of our findings are twofold. Firstly, in an industrial setting, companies
can leverage stochastic programming to enhance their strategic planning and gain a competitive
edge. Secondly, for emergency management, authorities can implement these models to improve
preparedness and response, potentially saving lives and resources.
For future work, there is considerable scope for refining the models used in this study.
Incorporating more detailed real-world data, exploring the use of machine learning to predict
random events more accurately, and developing user-friendly software to bring these powerful
models to a broader audience are some of the areas that hold promise. Additionally, extending the
application of these models to other areas such as supply chain management, financial planning,
and healthcare logistics could prove beneficial.

4.4 Concluding Remarks


In conclusion, this report has not only addressed specific problems in manufacturing and
emergency planning but has also contributed to a broader understanding of the strategic value of
stochastic programming. As industries and public services continue to grapple with uncertainty,
the tools and techniques discussed herein will undoubtedly play a pivotal role in shaping the
future of decision-making in complex environments.

5 Conclusion
This report has meticulously examined the intricate role of stochastic programming in two
critical sectors: industrial manufacturing and emergency planning. Through the lens of two-stage
stochastic linear programming (2-SLPWR) and Stochastic Linear Programming with Emergency
Planning and Disaster Recovery (SLP-EPDR), we have unearthed the profound impact of this
mathematical approach in navigating the uncertainties inherent in these fields.

Assignment for Discrete Structures for Computing - Academic year 2023 - 2024 Page 23/25
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

In the case of industrial manufacturing, the report has demonstrated the profound benefits
of employing stochastic programming for production planning. The adaptability offered by this
approach allows for a more resilient operation, capable of adjusting to market fluctuations and
demand uncertainties with remarkable efficiency. The optimal production strategies deduced
from the 2-SLPWR model underscore the potential for reducing operational costs, optimizing
inventory levels, and consequently, bolstering the robustness of supply chains.
Concurrently, the foray into emergency planning via the SLP-EPDR model has revealed the
criticality of rapid and informed decision-making in the face of disasters. The model’s efficacy
in optimizing evacuation routes and resource deployment highlights the lifesaving potential of
stochastic programming. By enabling emergency responders to anticipate various crisis scenar-
ios and respond with precision, the SLP-EPDR model stands as a testament to the value of
preparedness and pre-emptive strategy.
The challenges encountered during the analysis, from data simulation to computational
limitations, have further reinforced the importance of continuous improvement and innovation
in the field of stochastic programming. It is clear that as computational capabilities evolve, so
too will the sophistication and accuracy of these models.
Looking ahead, the application of stochastic programming is poised to extend far beyond the
realms explored in this report. The principles and methodologies outlined here hold significant
promise for a diverse array of sectors facing uncertainty. As the world becomes increasingly
interconnected and dynamic, the demand for advanced decision-making tools like stochastic
programming will only grow.
In conclusion, the findings of this report contribute to a burgeoning body of knowledge that
underscores the versatility and necessity of stochastic programming. Whether applied to the
methodical demands of manufacturing or the urgent needs of emergency response, stochastic
programming offers a strategic advantage that is both quantifiable and invaluable. It stands not
only as a testament to the power of mathematical modeling but also as an indispensable ally in
the quest for operational excellence and societal safety.

Assignment for Discrete Structures for Computing - Academic year 2023 - 2024 Page 24/25
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

References
[1] A. Shapiro, D. Dentcheva, and A. Ruszczynski, Lectures on stochastic programming: mod-
eling and theory. SIAM, 2021.

[2] S. W. Wallace and W. T. Ziemba, Applications of stochastic programming. SIAM, 2005.

[3] L. Wang, “A two-stage stochastic programming framework for evacuation planning in dis-
aster responses,” Computers & Industrial Engineering, vol. 145, p. 106458, 2020.

[4] A. Shapiro, A. Philpott, A tutorial on stochastic programming, 2007.

Assignment for Discrete Structures for Computing - Academic year 2023 - 2024 Page 25/25

You might also like