370 likes | 616 Views
Optimization. from Prof. Goldsman’s lecture notes. Outline. What is a Model? Operation Research Optimization Example Shortest Path Introduction to Modeling. What is a Model?. Abstraction, representation Infinitely many models of the same reality Often a model is created for a purpose
E N D
Optimization from Prof. Goldsman’s lecture notes
Outline • What is a Model? • Operation Research • Optimization Example • Shortest Path • Introduction to Modeling
What is a Model? • Abstraction, representation • Infinitely many models of the same reality • Often a model is created for a purpose • A good model discards the irrelevant • A good model retains what is crucial • Often we believe we understand something better after modeling it • We trust a model if it gives accurate predictions (qualitative or quantitative)
Note that… • When you want to create a model… • Collect the necessary data • Distinguish between the model input and model output • Lengthy notes are worthless • KISS Rule
Operation Research • Higher level of theoretical and mathematical orientation • Categorization of Operation Research: • Wants to model the problem • Encounter the problems of estimating the values of the parameters • Parameters may not be constant over time • 2 Approaches: • Forget the fact that they are RV and use the model w/o RV taken into consideration –Deterministic Approach • Use model w/ RV –Probabilistic Approach
180 a c 20 200 100 t S 40 100 150 b d 70 80 Optimization Example • Shortest Path of Auto Travel Routes • Distances are in miles
180 a c 20 200 100 t S 40 100 150 b d 70 80 Shortest Path (Cont’d) • Optimal Solution has length 270 miles • But it did not go to node d and a
180 a c 20 200 100 t S 40 100 150 b d 70 80 Shortest Path (Cont’d) • Algorithm actually finds a tree giving shortest paths from s to everynode in graph
Shortest Path: Definitions • Graph G= (V,E) • V: vertex set, contains special vertices s and t • E: edge set • Costs Cij on edges (i, j) in E • Cij >= 0 • no cycles with negative total cost • Cost of a path = sum of edge costs • Objective: find min cost path from s to t
Shortest Path (Cont’d) A Mathematical Problem An Optimization Problem It has: • A set of possible solutions (paths from s to t) • An objective function (min the sum of edge costs) • An algorithmthat correctly and quickly solves cases of the shortest path problem, provided that • The instances satisfy Cij >= 0 • The instances are not too huge
Example • Goal: use a car for 4 years at min cost
Example (Cont’d) • Vertices of graph need not represent physical locations • V= {0,1,2,3,4} • time 0, 1,...,4 in years • Seek least expensive path from 0 to 4 • Edge cost from i to j: cost of buying a car at time i, using it, and selling it at time j • for each edge, pick cheapest alternative (new or used)
0 2 3 4 1 Buy at 0 sell at 1 Buy at 1, sell at 2 Buy at time 0, keep 2 years, sell at time 2 Example (Cont’d) • Keep the new car for 1 year: 5000 • Keep the used car for 1 year: 3000 • Keep the new car for 2 years: 8000 • Keep the used car for 2 years: 7000
Example (Cont’d) • Continue and find the shortest path • Note that: shortest path does allow directed graph • i.e. you cannot go from node 2 to node 1 at a cost of 3000
Data Math Problem (Optimization Model) Algorithm Real problem Conceptual Model Solution to Math Problem Optimization Model Usage
What is A Successful Model? • Models must fit the real problem Realism and Generality • Able to solve the model Solvability and Tractability
Modeling FAQ • Tradeoff betweenrealismand solvability • Good modelers know … • Different models limitations • Fitting a model into a wider range of real problems • Fitting a real problem into a model • Advanced modelers know how to … • Solve a wider range of models • Extend the range of cases that can be solved with software tools
Optimization Models Spectrum Networks LP Convex QP IP NLP Shortest Path Min Span Tree Max Flow Assignment Transportation Min Cost Flow portfolio optimization blending planning logistics scheduling chemical processes materials design production/distribution flow of materials
Mathematical Programming • Linear Programming • Nonlinear Programming • Integer Programming • Binary Programming • Quadratic Programming • Geometric Programming • Dynamic Programming • Mixed Integer Programming
Mathematical Programming (Cont’d) • Three important characteristics: • Decision Variables • Objective Function • Constraints • Solving: • Graphically • Simplex
A Piece of Cake Example Farmer Jones must determine how many acres of corn and wheat to plant this year. An acre of wheat yields 25 bushels of wheat and requires 10 hours of labor per week. an acre of corn yields 10 bushels of corn and requires 4 hours of labor per week. All wheat can be sold at $4 a bushel and all corn can be sold at $3 a bushel. Seven acres of land and 40 hours per week of labor are available. Government regulations require that at least 30 bushels of corn can be produced during the current year. Formulate an LP whose solution will tell Farmer Jones how to maximize the total revenue from wheat and corn. Find the solution using graphical method.
Assignment Problem • Assignment Problem • Simplest and easiest • Def: there are N items or services available at N locations and N other locations that require one and only one of these N items or services • Example: 4 types of product and 4 machines. Each machine can only produce one type of products. • Objective: assign jobs to machines that will minimize the total cost
Assignment Problem (Cont’d) • For unbalanced assignment problems • Add dummy rows or columns • Set the cost of these rows or columns to be all zeros
Solving Assignment Problem Using Hungarian Method • Subtract the smallest number in each row from every entry in that row • Subtract the smallest number in each column from every entry in that column • A zero cost assignment (if it can be made) is optimal. If not, complete the Hungarian Method • Draw the min # of horizontal and vertical lines (no diagonals) that intersect all the zeros • Subtract the smallest uncrossed number from every other uncrossed number and add it to all elements where the vertical and horizontal lines intersect • If a zero cost assignment can be made, it is optimal • O’w repeat steps 4 and 5 until one can be made
Draw the min # of horizontal and vertical lines (no diagonals) that intersect all the zeros Subtract the smallest uncrossed number from every other uncrossed number and add it to all elements where the vertical and horizontal lines intersect Solving Assignment Problem (Cont’d) Smallest no = 1 Row 4 & 5: Subtract 1 Intersection: add 1
If a zero cost assignment can be made optimal Solution? 4-1, 2-2, 3-3, 1-4, 5-5 Solving Assignment Problem (Cont’d)
Hungarian Method: Max • Objective: maximize • Note that max f(x) = min –f(x) • Solve: • Replace all the cost elements by their negative • Continue w/ the minimization procedure
Replace all the cost elements by their negative Subtract the smallest number in each row from every entry in that row (perform similar calculation for column) Hungarian Method: Max (Cont’d) Find the smallest number per row Find the smallest number per column
Transportation Problem • There are M sources with something available and N destinations needing something • Difference: • Assignment Problem: f(x): x y • Transportation problem: f(x): x y1, y2,…,yn f(x): x1, x2,…,xm y
Transportation Problem (Cont’d) Mathematical Formulation: ai = number of units available at i bj = #units needed at j cij = cost to ship 1 unit from i to j xij = #units shipped from source i to destination j
More Example • Smallco, Inc. Smallco, Inc. manufactures two products, wooden toy cars and wooden toy trucks, made from mahogany. The profit margin for the two toys is $1.10 and $0.70, respectively. Based on careful market analysis, it appears that Smallco can sell about 2000 of each toy each week. However, Smallco can only obtain a limited amount of mahogany, roughly 3000 board-feet per week. Producing either toy requires 1 board foot of wood. What is the best mix of toys for Smallco to produce if the goal is to maximize total profit margin?
More Example (Cont’d) • What is the objective? • What can be controlled? • How do the decisions affect the objective? • What limits the decisions? • The LP model is … • Solve it!
Example… Again Dorial Auto manufactures luxury cars and trucks. The company believes that its most likely customers are high-income women and men. To reach these groups, Dorial Auto has embarked on an ambitious TV advertising campaign, and has decided to purchase 1-minute ad spots on two types of programs; comedy shows and football games. Each comedy commercial is seen by 7 million high-income women and 2 million high-income man. A 1-minute comedy spot costs $50,000 and a 1-minute football spot costs $100,000. Dorial wants to reach at least 28 million high-income women and 24 million high-income man. How should Dorian buy commercial time to reach their target at the lowest possible cost?
Model With Discrete Variables • Model with specific (discrete) values, is not a linear programming model • Types: • Integer Programming • Mixed Integer Programming • Binary Integer Programming
Model With Discrete Variables (Cont’d) • When do you need discrete variables? • Continuous problems • “yes/no” aspects to the decision • “How many” not “How much” • How to model it? • Non-obvious “trick” • Treat each linear function as a separate cost function, with its own “variable” • Associate a binary variable with each of the linear function • Enforce the requirement that you cannot do this if you don’t have this (TRICK)
Model With Discrete Variables (Cont’d) • It is tricky • It is not obvious and most of us (including myself) would have a hard time “inventing” this ourselves • Can be very difficult to solve • Example: selecting among investment alternatives, designing supply chains, sourcing products, production/inventory planning, crew scheduling, vehicle routing, etc