2The Shortest Path Model For a given network find the path of minimum distance, time, or cost from a starting point, the start node, to a destination, the terminal node.Problem definitionThere are n nodes, beginning with start node 1 and ending with terminal node n.Bi-directional arcs connect connected nodes i and j with nonnegative distances, dijFind the path of minimum total distance that connects node 1 to node n.
3FAIRWAY VAN LINESDetermine the shortest route from Seattle to El Paso over the following network of highways.
4Seattle Butte Boise Cheyenne Portland Salt Lake City Bakersfield 1Seattle2Butte599497Boise69118042034Cheyenne3454325Portland6440Salt Lake City893BakersfieldLas Vegas43262155472808577Albuquerque290910116Tucson50011Phoenix314268CommentIn case some arcs are bi-directional, create twodirected arcs in two opposite directions, betweenthe same two nodes.12403El Paso
5FAIRWAY VAN LINES – The Linear Programming Model Decision variablesObjective = Minimize S dijXij
62 Subject to the following constraints: Butte Seattle 1 Boise 3 4 5992497Boise18034345Salt Lake City432Portland6[The number of highways traveled out of Seattle (the start node)] = 1 X12 + X13 + X14 = 1In a similar manner:[The number of highways traveled into El Paso (terminal node)] = 1 X9,12 + X10,12 + X11,12 = 1[The number of highways used to travel into a city] = [The number of highways traveled leaving the city]. For example, in Boise (node 4):X14 + X34 = X46.Non-negativity constraints
8FAIRWAY VAN LINES – The Network Model The Dijkstra’s algorithm:Find the shortest distance from the “START” to each other node, in the order of the closest nodes to the “START”.Once the shortest route to the m closest node is determined, the (m+1) closest can be easily determined.This algorithm finds the shortest route from the start to all the nodes in the network.
9An illustration of the Dijkstra’s algorithm (See mathematical formulation of the algorithm in Supplement CD 5).
10SLC. SLC + = BUTTE BOISE. SEAT. … and so on until the whole network 420CHY.691+=11191290BUT599POR180497BOIBUTTE599180497345SLC+=842BOIBOISE.SEAT.+BOI432Bakersville602=612782… and so on until thewhole networkis covered.POR.BAKERSVILLE
11Dijkstra’s algorithm - continued When all the network is covered, the shortest route from START to every other node can be identified.Trace the path that leads to each node by backtracking from each node toward node START.
12The Maximal Flow Problem Problem definitionThere is a source node (labeled 1), from which the network flow emanates.There is a terminal node (labeled n), into which all network flow is eventually deposited.There are n - 2 intermediate nodes (labeled 2, 3,…,n-1), where the node inflow is equal to the node outflow.There are capacities Cij for flow on the arc from node i to node j, and capacities Cji for the opposite direction.
13The Maximal Flow Problem Objective The objective is to find the maximum total flow out of node 1 that can flow into node n without exceeding the capacities on the arcs.
14UNITED CHEMICAL COMPANY United Chemical produces pesticides and lawn care products.Poisonous chemicals needed for the production process are held in a huge drum.A network of pipes and valves regulates the chemical flow from the drum to different production areas.The safety division must plan a procedure to empty the drum as fast as possible into a safety tub in the disposal area, using a network of pipes and valves.
15UNITED CHEMICAL COMPANY The plan must determine:which valves to open and shutWhat is the estimated time fortotal discharge
17Data 1 8 7 3 6 1 10 3 2 4 10 2 Chemical Drum Safe Tub 1 4 2 12 8 4 Maximum flow from 2 to 4 is 8872Data36110316724102ChemicalDrumSafe Tub14321285Maximum flow from 6 to 3 is 4
18UNITED CHEMICAL COMPANY – The Linear Programming Model Decision variablesXij - the flow from node i to node j on the arc that connects these two nodesObjective function – Maximize the flow out of node 1: Max X12 + X13
19UNITED CHEMICAL COMPANY – The Linear Programming Model ConstraintsThe constraint on each intermediate node is: Flow out from the node – flow into the node = 0Node 2: X23 +X24 + X26 - X12 - X32 = 0Node 3: X32 +X35 + X36 - X13 - X23 - X63 = 0Node 4: X46 + X47 - X24 - X64 = 0Node 5: X56 + X57 - X35 - X = 0Node 6: X63 +X64 +X65 + X67 - X26 - X36 - X46 -X56 = 02
21UNITED CHEMICAL COMPANY – Spreadsheet galõesgalões/minuto100/17 = 5,88 minutospara retirar todo o produto827914536
22The role of cuts in a maximum flow network The value of the maximum flow = the sum of the capacities of the minimum cut.This is a minimal cut,and the flow = 17 ismaximalCorte: linha sobre os arcos da rede que separa nó fonte do nó destinoCap = 30This is not a minimal cut48Capacidade do Corte: soma das capacidades dos arcos cortados pela linha do corte2310671321762414108Rede com as capacidades nos arcos23512Cap = 17
23The Traveling Salesman Problem Problem definitionThere are m nodes.Unit cost Cij is associated with utilizing arc (i,j)Find the cycle that minimizes the total cost required to visit all the nodes exactly once.
24The Traveling Salesman Problem Importance:Variety of scheduling application can be solved as a traveling salesmen problem.Examples:Ordering drill position on a drill press.School bus routing.Military bombing sorties.The problem has theoretical importance because it represents a class of difficult problems known as NP-hard problems.
25The Traveling Salesman Problem ComplexityBoth writing the mathematical model and solving it are cumbersome (a problem with 20 cities requires over 500,000 linear constraints.)50 cidades requerem 500 trilhões de restrições lineares120 cidades requerem restrições lineares !!
26THE FEDERAL EMERGENCY MANAGEMENT AGENCY A visit must be made to four local offices of FEMA, going out from and returning to the same main office in Northridge, Southern California.Data (simétrico) Travel time (min) between offices
29FEMA - Traveling Salesman Solution approachesEnumeration of all possible cycles.This results in (m-1)! cycles to enumerate. Se a rede for simétrica serão (m – 1)!/2 ciclos.Only small problems can be solved with this approach.A combination of the Assignment problem and the Branch and Bound technique.Problem with up to m=20 nodes can be efficiently solved with this approach.
30FEMA – full enumeration Possible cyclesCycle Total Cost1. H-O1-O2-O3-O4-H 2102. H-O1-O2-O4-O3-H3. H-O1-O3-O2-O3-H4. H-O1-O3-O4-O2-H5. H-O1-O4-O2-O3-H6. H-O1-O4-O3-O2-H7. H-O2-O3-O1-O4-H8. H-O2-O1-O3-O4-H9. H-O2-O4-O1-O3-H10. H-O2-O1-O4-O3-H11. H-O3-O1-O2-O4-H12. H-O3-O1-O2-O4-H 260MinimumFor this problem we have (5-1)! / 2 = 12 cycles. Symmetrical problems need to enumerate only (m-1)! / 2 cycles.
31FEMA – optimal solution 402325355040150445653080HomeTempo total ótimo = 195 minutos
32FEMA – The Assignment problem approach Refer to the nodes designated “From” as “Workers” nodes.Refer to nodes designated by “To” as “Jobs” nodes.Assign “Workers” to “Jobs” at minimum cost.Variáveis de Decisão: Xij = número de vezes que o arco do nó i ao nó j é usado no ciclo. Assim, Xij = 1 (se o arco está no ciclo) ou 0 (arco não está no ciclo).Restrições no Modelo da Designação: soma dos arcos que saem de um nó tipo “Worker” = 1; soma dos arcos que chegam em em nó tipo “Job” = 1.
34FEMA – The assignment solution O3 – O4 – O3Sub-tour402325355040150445653080O1 – O2 – H – O1Sub-tourHome
35FEMA – The assignment solution We can prevent the situation of sub-tours by adding certain constraints.Exemplo: Seja o nó 5 = Home (H), assimX52 + X21 + X15 2 evita que o sub-tour H-O2-O1-H seja utilizado.X12 + X23 + X34 + X41 3 evita que o sub-tour O1-O2-O3-O4-O1 seja utilizado.This makes the problem extremely large.Another approach, that combines the Assignment model with the Branch and Bound solution methodology can efficiently solve problems up to m = 20 nodes.
36The Minimal Spanning Tree This problem arises when all the nodes of a given network must be connected to one another, without any loop.The minimal spanning tree approach is appropriate for problems for which redundancy is expensive, or the flow along the arcs is considered instantaneous.
37THE METROPOLITAN TRANSIT DISTRICT The City of Vancouver is planning the development of a new light rail transportation system.The system should link 8 residential and commercial centers.The Metropolitan Transit District needs to select the set of lines that will connect all the centers at a minimum total cost.
38METROPOLITAN TRANSIT – Network presentation The network describes:feasible lines that have been draftedminimum possible cost for taxpayers per line.
3955North SideUniversity350530BusinessDistrict393833434West Side45132828433526East SideCityCenterShoppingCenter41403744367South Side
40NETWORK PRESENTATION 55 North Side University 3 50 5 30 Business District394383334West Side45132828433526East SideCityCenterShoppingCenter41403744367South Side
41THE METROPOLITAN TRANSIT DISTRICT Solution - a network approach (See Supplement CD 5)The algorithm that solves this problem is a very trivial greedy procedure. Two versions of the algorithm are described.The algorithm – version 1:Start by selecting the smallest arc, and adding it to a set of selected arcs (currently contains only the first arc).At each iteration, add the next smallest arc to the set of selected arcs, unless it forms a cycle.Finish when all nodes are connected.
42THE METROPOLITAN TRANSIT DISTRICT The algorithm – version 2:Start by selecting the smallest arc creating the set of connected arcs.At each iteration add the smallest unselected arc that has a connection to the connected set, but do not create a cycle.Finish when all nodes are connectedSee demonstration of version 2 next
43Loop Loop Loop Loop Loop Loop Loop Loop Loop Loop Loop Loop Loop Loop Aplicação do Alg 255University3505North Side3030BusinessDistrictLoopLoopLoop39Loop3333Loop438LoopLoop34LoopLoopLoopLoopWest Side45LoopLoop32321LoopLoopLoop82828433526East SideCityCenterShoppingCenter4140374436Continuar até conectar todos os nós7South Side
44OPTIMAL SOLUTION Total Cost = $236 million University 3 5 North Side 30BusinessDistrict438West Side3218283526East SideCityCenterShoppingCenter37Total Cost = $236 million367South Side