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

Optimization_Part9

Uploaded by

Kathan Raval
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

Optimization_Part9

Uploaded by

Kathan Raval
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

Supply Chain Networks

1
Some Illustrative Applications
• Design of an offshore pipeline network to transport natural gas from the source to
distribution points with the objective of minimizing the cost of constructing the pipeline.
• Determination of the shortest route between two cities in an existing network of roads in
order to minimize transportation costs.
• Determination of the maximum capacity (in tons per year) of a pipeline network.
• Determination of the time schedule (start and completion dates) for the activities of a
construction project.

2
Some Illustrative Applications
A pharmaceutical company needs to deliver temperature-sensitive vaccines from their
central cold storage to multiple hospitals:
• Network nodes: Storage facilities, transfer points, hospitals
• Edge weights: Distance, time, or composite cost (fuel + time + refrigeration)
• Constraints: Maximum time due to cold chain requirements
• Objective: Minimize total delivery time/cost while maintaining temperature control

3
Some Illustrative Applications
A beverage distributor making daily deliveries to retail stores:
• Network nodes: Distribution centre and retail stores
• Edge weights: Travel time between locations including traffic patterns
• Constraints: Vehicle capacity, delivery time windows
• Objective: Minimize total route distance while serving all stores
• Additional considerations: Loading/unloading times, store opening hours

4
Some Illustrative Applications
An automotive parts manufacturer shipping through multiple transportation modes:
• Source: Manufacturing plants
• Sink: Assembly plants
• Nodes: Intermediate warehouses and cross-dock facilities
• Edge capacities: Transportation mode limitations
• Truck routes: Maximum daily truckloads
• Rail connections: Weekly railcar capacity
• Ocean freight: Container ship scheduling
• Constraints: Storage capacity at warehouses
• Objective: Maximize parts flow to assembly plants while respecting all capacity constraints

5
only. A directed network has all directed arcs.
A path is a set of arcs joining two distinct nodes, p
the network. For example, in Figure 6.1, arcs (1, 2), (2, 3
between nodes 1 and 5. A path forms a cycle or a loop
itself through other nodes. In Figure 6.1, arcs (2, 3), (3, 4
A network is said to be connected if every two d
What is a network? least one path. The network in Figure 6.1 demonstrates
a cycle-free connected network comprised of a subset o
𝑉 = 1, 2, 3, 4, 5
• A network consists of a tree
set of links all the nodes of the network. Figure 6.2 prov
nodes (or vertices) linked by arcs 𝐸 = { 1, 2 , 1, 3 , 2, 3 , 2, 5 , 3, 4 , 3, 5 , 4, 2 , (4, 5)}
(or edges).
spanning tree from the network in Figure 6.1.
• The notation for describing a
network is (𝑁, 𝐴), where 𝑁 is the 1 3 5
set of nodes, and 𝐴 is the set of
arcs (or alternatively, (𝑉, 𝐸) where
𝑉 is the set of vertices and 𝐸 is the Figure 6
set of edges). 2 4
Example

Figure 6.2
6
Examples of a tree and a spanning tree

1 3 1 3
Networks
• Flow
• Associated with each network is a flow (e.g., oil products flow in a pipeline and automobile traffic
flow in highways).
• The maximum flow in a network can be finite or infinite, depending on the capacity of its arcs.

• Direction
• An arc is said to be directed or oriented if it allows positive flow in one direction only. A directed
network has all directed arcs.

• Path
• A path is a set of arcs joining two distinct nodes, passing through other nodes in the network.
• A path forms a cycle or a loop if it connects a node back to itself through other nodes

7
itselfInthrough
through other nodes. other
Figure 6.1, nodes.
arcs (2, 3),In(3,
Figure 6.1,
4), and (4,arcs (2, 3),a (3,
2) form 4), and (4, 2) form a cycle.
cycle.
A network is said to be A connected
network isifsaidevery be connected
to two if every
distinct nodes are two
linkeddistinct
by at nodes are linked b
least one
one path. The network path. The
in Figure network in Figure
6.1 demonstrates 6.1 demonstrates
this type of network. Athis is of network. A tr
treetype
le-free connected network
a cycle-free comprised
connected of anetwork
subset of all the nodes,
comprised and a spanning
of a subset of all the nodes, and a span
inks all the nodestree
of the
linksnetwork. Figure of
all the nodes 6.2the
provides
network.examples of aprovides
Figure 6.2 tree andexamples
a of a tree a
ning tree from the spanning
network in Figure
tree from6.1.
the network in Figure 6.1.

1 3 1 5 3 5
Networks
Figure 6.1 Figure 6.1
2 4 2
• A network is said to be connected if every two distinct 4
nodes are linked by at least one path. (The
Example of (N, A) Network Example of (N, A) Network
network shown on the earlier slide is a connected network.)
e 6.2 • A tree Figure 6.2 connected network comprised of a subset of all the nodes, and a spanning
is a cycle-free
ples of a tree andtree
a spanning
links
Examplestreenodes
all the of the
of a tree network.
and a spanning tree

1 3 11 33 1 5 3 5

Tree Spanning Tree


2 22 4 2 4
Tree Spanning tree
Tree Spanning tree
8
The Shortest Route Problem
• We wish to determine the shortest route between any two nodes 𝑠 and 𝑡 in an 𝑛-node
network.
• We assume that one unit of flow enters the network at node 𝑠 and leaves at node 𝑡.
• Define the following:

1 if arc i, j is on the shortest route


𝑥!" = amount of 5low in arc 𝑖, 𝑗 = =
0 otherwise
𝑐!" = length of arc (𝑖, 𝑗)

9
The Shortest Route Problem
Minimize Total Distance 𝑍 = > 𝑐!# ⋅ 𝑥!# Minimize the total path cost.
!,# ∈ &

1 if 𝑖 = 𝑠 Flow conservation constraint for each node: The


> 𝑥!# − > 𝑥#! = C−1 if 𝑖 = 𝑡 flow into any node (except source and target)
#: !,# ∈ & #: #,! ∈ & 0 otherwise must equal the flow out of the node.

10
Maximal Flow Model
• Nodes (or edges) have capacities – how much resource (such as water, data, or traffic) can
flow through that edge/node.
• Find the greatest possible flow of a resource through a network from a designated source
node to a sink node, without violating capacity constraints on the edges of the network.
• Applications
• Transportation Networks – maximizing traffic flow through roads while avoiding congestion.
• Data Networks – maximizing data transfer between servers.
• Supply Chains – optimizing the flow of goods from suppliers to consumers.
• Electrical Networks – maximizing the current flow in power grids.

11
The objective is to maximize
LP Formulation of the Maximize > 𝑥(# or
the total flow into the sink (𝑡)
Maximize > 𝑥!) or equivalently the total flow
Maximal Flow Problem # ! out of the source (𝑠)

Capacity constraint: the flow through


0 ≤ 𝑥!# ≤ 𝐶!# , ∀(𝑖, 𝑗) ∈ 𝐸 the edge must be less than its
capacity.
Let 𝑥!" be the flow on edge 𝑖, 𝑗
Flow conservation: at every node 𝑖 ≠
and 𝐶!" be the capacity of edge > 𝑥#! = > 𝑥!* , ∀𝑖 ≠ 𝑠, 𝑡 𝑠, 𝑡, the inflow equals the outflow
# *
𝑖, 𝑗 .

> 𝑥(# − > 𝑥*( = Net flow at 𝑠


# *
Flow balance: for the source and
target (𝑠, 𝑡)

> 𝑥!) − > 𝑥)* = Net flow at 𝑡


! *

12
Illustration

Source (s): 1

Sink/Target (t): 5

13
# AMPL Code for Maximal Flow Problem

# Sets
set NODES; # Set of nodes
set ARCS within (NODES cross NODES); # Set of arcs (i, j)

# Parameters
param capacity {ARCS} >= 0; # Capacity of each arc
param source symbolic; # Source node
param sink symbolic; # Sink node

# Variables
var flow {ARCS} >= 0; # Flow on each arc

# Objective - maximize flow into the sink


maximize TotalFlow:
sum {i in NODES: (i, sink) in ARCS} flow[i, sink];

# Constraints - Flow conservation at intermediate nodes


subject to FlowConservation {j in NODES diff {source, sink}}:
sum {(i, j) in ARCS} flow[i, j] = sum {(j, k) in ARCS} flow[j, k];

subject to CapacityConstraints {(i, j) in ARCS}:


flow[i, j] <= capacity[i, j]; # Flow does not exceed capacity of each arc
14
### DATA ### RUN
data;
reset;
# Define nodes
set NODES := 1 2 3 4 5; model maximal_flow.mod;
data maximal_flow.dat;
# Define arcs with capacities
set ARCS := option solver gurobi;
(1, 2) (1, 3) solve;
(2, 3) (2, 4) (2, 5)
(3, 4) (3, 5) display flow;
(4, 5); display TotalFlow;

param capacity :=
[1, 2] 15
[1, 3] 10
[2, 3] 5
[2, 4] 10
[2, 5] 5
[3, 4] 10
[3, 5] 10
[4, 5] 15;

# Specify source and sink


param source := 1;
param sink := 5; 15
15
Solution

Source (s): 1
10 5
10
Sink/Target (t): 5

Maximal flow = ? 10
15

16
Solution
Gurobi 11.0.2: optimal solution; objective 25
3 simplex iterations
flow :=
1 2 15
1 3 10
2 3 5
2 4 10
2 5 0
3 4 5
3 5 10
4 5 15
;

TotalFlow = 25

17
The Traveling Salesman Problem
• Find the shortest possible route for a salesman who needs to visit a specified set of cities
exactly once and return to the starting point.
• The goal is to minimize the total travel distance or cost while adhering to the constraint
of visiting each city only once.
• TSP is computationally complex, classified as an NP-hard problem, meaning that there is
no known polynomial-time algorithm to solve all instances of TSP optimally.

18
Difference between the TSP and the Shortest Route Problem
Aspect Traveling Salesman Problem (TSP) Shortest Path Problem

Goal Find a complete tour visiting all nodes once. Find the shortest route between two nodes.

Scope Global (entire graph is involved). Local (focuses on a subset of the graph).

Type of Output A cycle (closed path). A path (open path).

Complexity NP-hard (hard to solve efficiently). Polynomial-time solvable (tractable).

No such constraint; only start and end


Constraint Visit every node exactly once.
matters.

19
Formulation
• Set of Nodes: 𝑁 (the cities).
• Distances (𝑑!" ): is the distance (cost) between node 𝑖 and node 𝑗, where 𝑖, 𝑗 ∈ 𝑁.

• Decision Variable (𝑥!" ): A binary variable that equals 1 if the salesman travels from
node 𝑖 to node 𝑗, and 0 otherwise.
• 𝑢! : A continuous variable used for subtour elimination.

20
Formulation
Minimize > > 𝑑!# ⋅ 𝑥!# Minimize the total distance travelled.
!∈+ #∈+

> 𝑥!# = 1, ∀𝑖 ∈𝑁 The salesman leaves each city (node) exactly once.
#∈+,#,!

> 𝑥!# = 1, ∀𝑗 ∈𝑁 The salesman enters each city (node) exactly once.
!∈+, !,#
Subtour elimination: The variable 𝑢! is used to represent the
position of node 𝑖 in the tour. If the edge 𝑥!" = 1, then node 𝑗
𝑢! − 𝑢# + 𝑁 ⋅ 𝑥!# ≤ 𝑁 − 1, ∀ 𝑖, 𝑗 ∈ 𝑁, 𝑖 ≠ 𝑗
must come after node 𝑖, and the difference (𝑢! − 𝑢" ) must be less
than or equal to ∣ 𝑁 ∣ −1. This ensures that no cycles smaller than
the full tour can be formed. |𝑁| is the number of nodes.

21
Solve the TSP for this network

22
# Sets
set NODES; # Set of nodes (1, 2, 3, 4, 5) AMPL Model for the TSP
set ARCS within {NODES, NODES}; # Set of directed edges (i, j)

# Parameters
param dist {ARCS} >= 0; # Distance between nodes (i, j)
param num_nodes := card(NODES); # number of nodes is the cardinality of the set NODES

# Variables
var x {ARCS} binary; # Binary decision variable: 1 if arc (i,j) is selected, 0 otherwise
var u {NODES} >= 0; # Subtour elimination variables

# Objective: Minimize the total distance of the tour


minimize Total_Distance:
sum {i in NODES, j in NODES: (i, j) in ARCS} dist[i, j] * x[i, j];

# Each node must be entered exactly once


subject to Enter_Once {j in NODES}:
sum {i in NODES: (i, j) in ARCS} x[i, j] = 1;

# Each node must be exited exactly once


subject to Exit_Once {i in NODES}:
sum {j in NODES: (i, j) in ARCS} x[i, j] = 1;

# Subtour elimination constraints prevent smaller loops within the solution


subject to Subtour_Elimination {i in NODES, j in NODES: i != j and (i, j) in ARCS}:
u[i] - u[j] + num_nodes * x[i, j] <= num_nodes - 1;

23
AMPL Data for the TSP
data;

# Define the nodes


set NODES := 1 2 3 4 5;

# Define the arcs with distances


param: ARCS: dist :=
1 2 15
1 3 10 Run the solver and display the solution
2 3 5
2 4 10 reset;
2 5 5
3 4 10 model tsp.mod;
3 5 10 data tsp.dat;
4 5 15;
option solver gurobi;
solve;

# Displays the selected arcs in the optimal


# solution
display {i in NODES, j in NODES: (i, j) in ARCS and x[i, j] = 1} x[i,j];
display Total_Distance;

24
TSP Variants
• Vehicle Routing Problem (VRP) – multiple • CVRP with time windows and
vehicles are available pickup/delivery (CVRPTWPD)

• Multiple depot VRP (MDVRP) • Split delivery VRP

• Capacitated VRP (CVRP) • VRP with penalties for dropping visits

• CVRP with time windows (CVRPTW) • Vehicle rescheduling problem

25

You might also like