Create Presentation
Download Presentation

Download Presentation
## ENM 503 Lesson 7 – Discrete Models

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -

**I am very discrete.**ENM 503Lesson 7 – Discrete Models Combinatorial Problems and their Solutions**The Lineup**• The General Problem • The Transportation Problem • The Assignment Problem • The Knapsack Problem • The Traveling Salesman Problem • The Postman problem**The General IP Problem**Why this is just a linear program with integer restrictions on the variables.**Combinatorial Optimization Problems**• Optimization problem having a finite number of discrete solutions. • One solution approach is to explicitly generate and evaluate all possible solutions • Explicit enumeration • Consider an IP problem with 100 variables where xj = 0, 1, 2, …, 50; j = 1,2, …, 100 • number of possible solutions = 51100 • Explicit enumeration not possible • Implicit enumeration – attempt to account for all possible solution without enumerating all of them**An Integer Program**lattice points max z = x1 + 5x2 subj to: x1 + 10x2 20 x12 x1, x2 are integers x2 . . 2 . . 1 2 x1 1**round (2,2)**infeasible Why not just round the LP solution? max z = x1 + 5x2 subj to: x1 + 10x220 x12 x1, x2 are integers x2 . . 2 . . LP solution x1 = 2, x2 = 9/5 z* = 11 1 2 x1 1 Animated**optimal IP**solution x1 = 0, x2 = 2 z = 10 feasible rounded solution x1 = 2, x2 = 1 z = 7 Rounding doesn’t always work! max z = x1 + 5x2 subj to: x1 + 10x220 x12 x1, x2 are integers x2 . . LP solution x1 = 2, x2 = 9/5 z* = 11 2 . . 1 2 x1 1 Animated**An IP Example**Max z = 4.8x1 + 6.1x2 + 4.5x3 + 5.2x4 subj. to: x1 + x2 + x3 + x4 200 2.3x1 + 4.5x2 + 6.8x3 + 2.5x4 150 11.3x1 + 10.5x2 + 9.3x3 + 11.6x4 400 3.4x1 + 5.3x2 + 2.1x3 + 1.8x4 125 x1, x2, x3, x4 = 0, 1, 2, …**x1**x2 x3 x4 unit profit 4.8 6.1 4.5 5.2 Max variables 0 16.10839 5.788014 15.2615 203.667 sumprod RHS Const 1 1 1 1 1 37.1579 <= 50 Const 2 2.3 4.5 6.8 2.5 150 <= 150 Const 3 11.3 10.5 9.3 11.6 400 <= 400 Const 4 3.4 5.3 2.1 1.8 125 <= 125 x1 x2 x3 x4 unit profit 4.8 6.1 4.5 5.2 Max variables 0 16 6 15 202.6 sumprod RHS Const 1 1 1 1 1 37 <= 50 Const 2 2.3 4.5 6.8 2.5 150.3 <= 150 Const 3 11.3 10.5 9.3 11.6 397.8 <= 400 Const 4 3.4 5.3 2.1 1.8 124.4 <= 125 x1 x2 x3 x4 unit profit 4.8 6.1 4.5 5.2 Max variables 0 17 0 19 202.5 sumprod RHS Const 1 1 1 1 1 36 <= 50 Const 2 2.3 4.5 6.8 2.5 124 <= 150 Const 3 11.3 10.5 9.3 11.6 398.9 <= 400 Const 4 3.4 5.3 2.1 1.8 124.3 <= 125 The Solutions LP Solution rounded LP Solution IP Solution**x1**x2 x3 x4 unit profit 4.8 6.1 4.5 5.2 Max variables 0 16 5 15 198.1 sumprod RHS Const 1 1 1 1 1 36 <= 50 Const 2 2.3 4.5 6.8 2.5 143.5 <= 150 Const 3 11.3 10.5 9.3 11.6 388.5 <= 400 Const 4 3.4 5.3 2.1 1.8 122.3 <= 125 x1 x2 x3 x4 unit profit 4.8 6.1 4.5 5.2 Max variables 0 17 0 19 202.5 sumprod RHS Const 1 1 1 1 1 36 <= 50 Const 2 2.3 4.5 6.8 2.5 124 <= 150 Const 3 11.3 10.5 9.3 11.6 398.9 <= 400 Const 4 3.4 5.3 2.1 1.8 124.3 <= 125 Feasible Rounding feasible rounded LP Solution IP Solution**I heard that this is really good!**The Assignment Problem Assign n workers to n tasks**Some Applications**• workers to tasks • jobs to machines • facilities to locations • Truck drivers to customer pick-up points • Umpire crews to baseball games • Judges to court dockets • State inspectors to construction sites • Weapons to targets These are some terrific applications.**time**task1 task2 task3 task4 w1 12 13 10 11 w2 10 12 14 10 w3 14 11 15 12 A problem • Three workers are to be assigned to one of 4 distinct tasks. Each worker can perform each task in a different time. The objective is to minimize the total time to complete the assigned tasks. worker task times We need to add a dummy worker.**The Knapsack Problem**A total of m items whose weights are a1, a2, …, am are available for packing a knapsack. The total weight to be packed cannot exceed b. The objective is to pack as many items as possible.**Value**weight Value weight Value weight x1 0 8.5 x1 1 8.5 x1 0 8.5 x2 1 3.7 x2 1 3.7 x2 0 3.7 x3 1 1.9 x3 1 1.9 x3 1 1.9 x4 1 2.8 x4 1 2.8 x4 1 2.8 x5 1 4.7 x5 1 4.7 x5 1 4.7 x6 0 6.9 x6 0 6.9 x6 1 6.9 x7 0 8.7 x7 0 8.7 x7 0 8.7 x8 1 3.3 x8 1 3.3 x8 1 3.3 x9 0 5.8 x9 0 5.8 x9 1 5.8 x10 0 9.1 x10 0 9.1 x10 0 9.1 x11 0 7.9 x11 0 7.9 x11 0 7.9 x12 0 5.4 x12 1 5.4 x12 1 5.4 x13 1 4.1 x13 1 4.1 x13 1 4.1 x14 1 3.8 x14 0 3.8 x14 1 3.8 x15 0 6.7 x15 0 6.7 x15 0 6.7 x16 0 5.4 x16 0 5.4 x16 1 5.4 x17 0 8.5 x17 0 8.5 x17 0 8.5 x18 0 6.4 x18 0 6.4 x18 0 6.4 x19 1 3.4 x19 1 3.4 x19 1 3.4 x20 1 2.2 x20 1 2.2 x20 1 2.2 sum 9 29.9 sum 10 40 sum 12 49.7 <= <= <= 30 40 50 An Example – solver binary solution**New and Improved Knapsack Problem**Let cj = cost of the ith item wj = weight of the jth item vj = volume of the jth item It is comforting to know my load is optimal!**cost**Value weight 10.3 x1 0 8.5 21.3 x2 1 3.7 45.8 x3 1 1.9 11.7 x4 1 2.8 9.8 x5 0 4.7 5.7 x6 0 6.9 17.3 x7 0 8.7 14.2 x8 1 3.3 22.9 x9 0 5.8 31.7 x10 0 9.1 40.5 x11 1 7.9 38.1 x12 1 5.4 7.8 x13 0 4.1 11.4 x14 0 3.8 37.1 x15 1 6.7 40.3 x16 1 5.4 20.2 x17 0 8.5 15.6 x18 0 6.4 9.4 x19 0 3.4 12.8 x20 1 2.2 sum 9 39.3 total cost = 261.8 <= 40 Example – new and improved**Let’s count the number of solutions…**You should know that Johnny. It is 230 or 1,073,741,824 solutions if you include the infeasible ones as well. Dad, how many solutions are there for the knapsack problem if I have 30 items to consider?**You got to know the territory!**The Traveling Salesman Problem There once was a farmer’s daughter…**Traveling Salesman Problem**A salesman must visit each of n cities once and only once returning to his starting city. What route should be followed so that the total distance (cost or time) traveled is minimized? My secretary always finds for me, the minimum distance itinerary. Itinerary Dayton Cincinnati Denver New York Atlanta Chicago Boston San Francisco Wapakoneta (n-1)! possible routes**A From-to Matrix**distances in miles**Traveling on a network**5 B C 2 5 11 A E 7 3 4 D G 8 6 F A solution is a permutation! 6! = 720 routes**A Traveling Salesman Problem**P. Rose, currently unemployed, has hit upon the following scheme for making some money. He will guide a group of people on a tour of all National League baseball parks. The tour will start and end in Cincinnati. What route should he follow in order to minimize total distances (costs)?**Distances between parks in miles**ATL CHI CIN HOU LA MON NY PHI PIT STL SD SF ATL 702 454 842 2396 1196 864 772 714 554 2363 2679 CHI 702 324 1093 2136 764 845 764 459 294 2184 2187 CIN 454 324 1137 2180 798 664 572 284 338 2228 2463 HOU 842 1093 1137 1616 1857 1706 1614 1421 799 1521 2021 LA 2396 2136 2180 1616 2900 2844 2752 2464 1842 95 405 MON 1196 764 798 1857 2900 396 424 514 1058 2948 2951 NYK 864 845 664 1706 2844 396 92 386 1002 2892 3032 PHI 772 764 572 1614 2752 424 92 305 910 2800 2951 PIT 714 459 284 1421 2464 514 386 305 622 2512 2646 STL 554 294 338 799 1842 1058 1002 910 622 1890 2125 SD 2363 2184 2228 1521 95 2948 2892 2800 2512 1890 500 SF 2679 2187 2463 2021 405 2951 3032 2951 2646 2125 500**Heuristics -algorithm development**I need a good heuristic to solve this problem. P. Rose Joe Engineer Heuristic: A procedure for solving problems by an intuitive approach in which the structure of the problem can be interpreted and exploited intelligently to obtain a reasonable solution.**Nearest Neighbor Heuristic – a greedy heuristic algorithm**ATL CHI CIN HOU LA MON NY PHI PIT STL SD SF ATL 702 454 842 2396 1196 864 772 714 554 2363 2679 CHI 702 324 1093 2136 764 845 764 459 294 2184 2187 CIN 454 324 1137 2180 798 664 572 284 338 2228 2463 HOU 842 1093 1137 1616 1857 1706 1614 1421 799 1521 2021 LA 2396 2136 2180 1616 2900 2844 2752 2464 1842 95 405 MON 1196 764 798 1857 2900 396 424 514 1058 2948 2951 NYK 864 845 664 1706 2844 396 92 386 1002 2892 3032 PHI 772 764 572 1614 2752 424 92 305 910 2800 2951 PIT 714 459 284 1421 2464 514 386 305 622 2512 2646 STL 554 294 338 799 1842 1058 1002 910 622 1890 2125 SD 2363 2184 2228 1521 95 2948 2892 2800 2512 1890 500 SF 2679 2187 2463 2021 405 2951 3032 2951 2646 2125 500**SNF**NYK CHI PIT PHI LAX STL CIN SND ATL HOU MON DISTANCE = 8015 MILES**SNF**NYK CHI PIT PHI LAX STL CIN SND ATL HOU MON X X DISTANCE = 8015 MILES OPTIMUM = 7577 MILES**Other Applications**• manufacture of circuit boards • assembly line reconfiguration • mixing paints colors in vats • searching for stars**The Chinese Postman Problem**A study in the optimal delivery of the postal mail**The problem defined**• The Chinese postman problem concerns a postman who has to deliver mail to houses along each of the streets in a particular housing estate, and wants to minimize the distance that has to be walked. • The problem was first considered by the Chinese mathematician Mei-ko Kwan in the1960s. • Based on this Alan Goldman suggested the name "Chinese Postman problem" to Jack Edmonds when Edmonds was in Goldman's Operations Research group at the U.S. National Bureau of Standards (now NIST). Edmonds appreciated its "catchiness" and adopted it.**More of the Chinese Postman Problem**Given a network with distances assigned to each arc, find the minimum distance walk that walks each arc at least once and returns to the starting node. I get tired walking this route. It is too long. 5 B C 2 5 11 A E 7 3 4 D G 8 6 F**The Bridges of Königsberg**• Königsberg (Kaliningrad) was a city in Prussia situated on the Pregel River, which served as the residence of the dukes of Prussia in the 16th century. • The river Pregel flowed through the town, creating an island. Seven bridges spanned the various branches of the river, as shown.**Graph Theory and the Bridges of Königsberg**• A famous problem concerning Königsberg was whether it was possible to take a walk through the town in such a way as to cross over every bridge once, and only once. An example of a failed attempt to take such a walking tour is shown below. How many bridges must I cross?**Now comes Euler**• This problem was first solved by the Swiss mathematician Leonhard Euler who invented the branch of mathematics now known as graph theory in the process of his solution. • Euler's approach was to regard the spots of land (there are 4 of them) as points to be visited, and the bridges as paths between those points. The mathematical essentials of the map of Königsberg can then be reduced to the following diagram, which is an example of what is called a graph:**Leonhard Euler**• Euler was the most prolific writer of mathematics of all time. He made large bounds forward in the study of modern analytic geometry and trigonometry where he was the first to consider sin, cos etc. as functions rather than as chords. • He made decisive and formative contributions to geometry, calculus and number theory. He integrated Leibniz's differential calculus and Newton's method of fluxions into mathematical analysis. He introduced beta and gamma functions, and integrating factors for differential equations. • He studied continuum mechanics, lunar theory, the three body problem, elasticity, acoustics, the wave theory of light, hydraulics, and music. He laid the foundation of analytical mechanics. Born: 15 April 1707 in Basel, SwitzerlandDied: 18 Sept 1783 in St Petersburg, Russia**Network Terminology**• Graph – a finite set of points (vertices or nodes) together with a finite set of connecting links called edges (arcs or branches). • Each edge connects two different vertices • Path – a sequence of edges in a graph where consecutive edges have the same vertex. • Circuit – a path which starts and ends at the same vertex • Euler circuit – a circuit in which each edge of the graph is used exactly once**Euler's Solution**• When a vertex is "visited" in the middle of the process of tracing a graph, there must be an edge coming into the vertex, and another edge leaving it; and so the order of the vertex must be an even number. • This must be true for all but at most two of the vertices--the one you start at, and the one you end at • A connected graph is traversible if and only if it has at most two vertices of odd order. (the starting and ending vertices may be the same, in which case the order of every vertex must be even.) • The Königsberg graph shows that there are more than two vertices of odd order, and so the desired walking tour of Königsberg is impossible.**Euler Solution**• If there are no odd nodes in the network, the network is certainly traversable. • The minimum distance is the sum of the arc distances and any Eulerian trail is an acceptable shortest route, so the problem is trivial. • If a Euler circuit does not exist, then the problem is to find a circuit that covers all the edges of a given graph with the minimum number of duplications. • If v0 is the number of odd-ordered vertices, then no fewer than v0 / 2 additional edges are necessary.**Other Applications**• delivery mail, newspaper, door-to-door soliciting • trash pickup • snow plowing and salting streets, street cleaning • railroad track inspections and maintenance • meter reading • school bus routes**Play ball! Now it’s your turn.**The Department of Engineering Management & Systems has proudly presented Discrete Models and Methods