Содержание
- 2. MATLAB Linear Programming © 2010-2013 Greg Reese. All rights reserved
- 3. Optimization Optimization - finding value of a parameter that maximizes or minimizes a function with that
- 4. Optimization Optimization Can have multiple parameters Can have multiple functions Parameters can appear linearly or nonlinearly
- 5. Linear programming Linear programming Most often used kind of optimization Tremendous number of practical applications "Programming"
- 6. Linear programming A feasible program is a solution to a linear programming problem and that satisfies
- 7. Linear programming Many important problems in economics and management can be solved by linear programming Some
- 8. Linear programming DIET PROBLEM You are given a group of foods, their nutritional values and costs.
- 9. Linear programming BLENDING PROBLEM Closely relate to diet problem Given quantities and qualities of available oils,
- 10. Linear programming TRANSPORTATION PROBLEM You are given a group of ports or supply centers of a
- 11. Linear programming WAREHOUSE PROBLEM You are given a warehouse of known capacity and initial stock size.
- 12. Linear programming Mathematical formulation The variables x1, x2, ... xn satisfy the inequalities and x1 ≥0,
- 13. Linear programming Mathematical matrix formulation Find the value of x that minimizes (maximizes) fTx given that
- 14. Linear programming General procedure Restate problem in terms of equations and inequalities Rewrite in matrix and
- 15. Linear programming Example - diet problem My son's diet comes from the four basic food groups
- 16. Linear programming Example - diet problem
- 17. Linear programming Example - diet problem What are unknowns? x1 = number of brownies to eat
- 18. Linear programming Example - diet problem Objective is to minimize cost of food. Total daily cost
- 19. Linear programming Example - diet problem Therefore, need to minimize
- 20. Linear programming Example - diet problem Constraint 1 - calorie intake at least 500 Calories from
- 21. Linear programming Example - diet problem Constraint 2 - chocolate intake at least 6 oz Chocolate
- 22. Linear programming Example - diet problem Constraint 3 - sugar intake at least 10 oz Sugar
- 23. Linear programming Example - diet problem Constraint 4 - fat intake at least 8 oz Fat
- 24. Linear programming Example - diet problem Finally, we assume that the amounts eaten are non-negative, i.e.,
- 25. Linear programming Example - diet problem Putting it all together, we have to minimize subject to
- 26. Linear programming Example - diet problem In matrix notation, want to where
- 27. Linear programming MATLAB solves linear programming problem where x, b, beq, lb, and ub are vectors
- 28. Linear programming MATLAB linear programming solver is linprog(), which you can call various ways: x =
- 29. Linear programming Example - diet problem Us: MATLAB: Note two differences:
- 30. Linear programming Example - diet problem ISSUE 1 - We have Ax ≥ b but need
- 31. Linear programming Example - diet problem x = linprog(f,A,b,Aeq,beq,lb,ub) We'll actually call x = linprog(f,A,b,Aeq,beq,lb) If
- 32. Linear programming Example - diet problem Follow along now >> A = -[ 400 200 150
- 33. Linear programming Example - diet problem Optimal solution is x = [ 0 3 1 0
- 34. Linear programming Example - diet problem A constraint is binding if both sides of the constraint
- 35. Linear programming Example - diet problem How many calories, and how much chocolate, sugar and fat
- 36. Linear programming Example - diet problem Because it's common to want to know the value of
- 37. Linear programming Special kinds of solutions Usually a linear programming problem has a unique (single) optimal
- 38. Linear programming Can tell about the solution MATLAB finds by using third output variable: [x fval
- 39. Linear programming Try It Solve the following problem and display the optimal solution, the value of
- 40. Linear programming Try It First multiply second equation by -1 to get Then, with objective function
- 41. Linear programming Try It >> A = [ 1 -1; -2 -1 ]; >> b =
- 42. Linear programming Try It IMPORTANT - linprog() tries to minimize the objective function. If you want
- 43. Linear programming Try It >> [x fval exitflag] = linprog( -f, A, b, [],[], lb )
- 44. Linear programming Try It A farmer has 10 acres to plant in wheat and rye. He
- 45. Linear programming Try It Decision variables x is number of acres of wheat to plant y
- 46. Linear programming Try It Constraints "he has only $1200 to spend and each acre of wheat
- 47. Linear programming Try It Constraints "the farmer has to get the planting done in 12 hours
- 48. Linear programming Try It Objective function "... the profit is $500 per acre of wheat and
- 49. Linear programming Try It Put it together Constraints: Objective function:
- 50. Linear programming Try It Rename x to x1 and y to x2 Change x + y
- 51. Linear programming Try It Write in matrix form Maximize Maximize
- 52. Linear programming Try It Find solution that maximizes profit. Display both >> A = [ 1
- 53. Linear programming Try It - blending problem Alloy Mixture Optimization (minimize expenses) There are four metals
- 54. Linear programming Try It - blending problem Decision variables x1 is fraction of total alloy that
- 55. Linear programming Try It - blending problem Density constraints Alloy density must be at least 5950
- 56. Linear programming Try It - blending problem Carbon constraints Carbon concentration must be at least 0.1
- 57. Linear programming Try It - blending problem Phosphor constraints Phosphor concentration must be at least 0.1
- 58. Linear programming Try It - blending problem Constraints Since only the four metals will make up
- 59. Linear programming Try It - blending problem Objective function Cost per kg
- 60. Linear programming Try It - blending problem Put it together Constraints: (Convert ≥ to ≤) Objective
- 61. Linear programming Try It - blending problem Write in matrix form Minimize
- 62. Linear programming Try It - blending problem >> A = [-6500 -5800 -6200 -5900; 6500 5800
- 63. Linear programming Try It - blending problem >> [x fval] = linprog( f, A, b, Aeq,
- 64. MATLAB Linear Programming Questions?
- 66. Скачать презентацию