OSCM OptDSM M6 Nonlinear Programming
OSCM OptDSM M6 Nonlinear Programming
Seokjun Youn
([email protected])
Today’s Plan
Lecture 6: Nonlinear Programming (cont’d)
• Reading: OptDSM_Ch8_Nonlinear Programming_Reading.pdf
1. The Challenges of Nonlinear Programming (Sec 8.1)
2. NLP with Decreasing Marginal Returns: Wyndor (Sec 8.2)
3. NLP with Decreasing Marginal Returns: Portfolio Selection (Sec 8.2)
4. Separable Programming (Sec 8.3)
5. Difficult Nonlinear Programming Problems (Sec 8.4)
6. Evolutionary Solver and Genetic Algorithms (Sec 8.5)
Next Class
Lecture 6: Nonlinear Programming (cont’d)
Learning Objectives: Nonlinear Programming (NLP)
3
1. The Challenges of Nonlinear Programming
Examples of Linear and Nonlinear Formulas
Data cells are located in D1:D6 and changing cells are in C1:C6.
5
The Challenges of Nonlinear Programming
• Nonlinear programming is used to model nonproportional relationships
between activity levels and the overall measure of performance, whereas
linear programming assumes a proportional relationship.
• Constructing the nonlinear formula(s) needed for a nonlinear programming
model is considerably more difficult than developing the linear formulas
used in linear programming.
• Solving a nonlinear programming model is often much more difficult (if it is
possible at all) than solving a linear programming model.
6
The Challenge of Nonproportional Relationships
• Proportionality Assumption of Linear Programming: The contribution of each
activity to the value of the objective function is proportional to the level of the
activity. In other words, the term in the objective function involving this
activity consists of a coefficient times the decision variable.
• Nonlinear programming problems arise when any activity has a
nonproportional relationship where the contribution of the activity to the
measure of performance is not proportional to the level of the activity.
7
Profit Graphs for Wyndor Glass Co.
(Proportional Relationship)
8
Profit Graphs with Nonproportional
Relationships
9
Profit Graphs with Nonproportional
Relationships
10
Constructing a Nonlinear Formula
11
Insert Scatter Plot
2
3
4
1
5
8 12
Format Trendline Dialog Box
Double-click
the trendline
on chart
13
The Trendline (Quadratic Equation)
14
Solving Nonlinear Programming Models
Consider the following model in algebraic form:
15
Solver Solution Starting with x = 0
16
Solver Solution Starting with x = 3 & x = 4.7
17
The Profit Graph
𝟎𝟎. 𝟓𝟓𝒙𝒙𝟓𝟓 − 𝟔𝟔𝒙𝒙𝟒𝟒 + 𝟐𝟐𝟐𝟐. 𝟓𝟓𝒙𝒙𝟑𝟑 − 𝟑𝟑𝟑𝟑𝒙𝒙𝟐𝟐 + 𝟐𝟐𝟐𝟐𝟐𝟐
18
Local Maxima and Minima
Definition: Suppose that 𝑓𝑓 is a function and 𝐷𝐷(𝑓𝑓) is the domain of 𝑓𝑓.
Let 𝑎𝑎 ∈ 𝐷𝐷(𝑓𝑓). We say that 𝑓𝑓(𝑎𝑎) is a Local Maximum Value on 𝒇𝒇 or a Local
Maxima if 𝑓𝑓(𝑎𝑎) ≥ 𝑓𝑓(𝑥𝑥) when 𝑥𝑥 is near 𝑎𝑎.
Similarly, we say that 𝑓𝑓(𝑎𝑎) is a Local Minimum Value on 𝒇𝒇 or a Local
Minima if 𝑓𝑓(𝑎𝑎) ≤ 𝑓𝑓(𝑥𝑥) when 𝑥𝑥 is near 𝑎𝑎.
19
Global Maxima and Minima
Definition: Suppose that 𝑓𝑓 is a function and 𝐷𝐷(𝑓𝑓) is the domain of 𝑓𝑓.
Let 𝑎𝑎 ∈ 𝐷𝐷(𝑓𝑓). We say that 𝑓𝑓(𝑎𝑎) is the Global (Absolute) Maximum on 𝒇𝒇 or
the Global (Absolute) Maxima if 𝑓𝑓(𝑎𝑎) ≥ 𝑓𝑓(𝑥𝑥) for all other 𝑥𝑥 ∈ 𝐷𝐷(𝑓𝑓).
Similarly, we say that 𝑓𝑓(𝑎𝑎) is the Global (Absolute) Minimum on 𝒇𝒇 or the
Global (Absolute) Minima if 𝑓𝑓(𝑎𝑎) ≤ 𝑓𝑓(𝑥𝑥) for all other 𝑥𝑥 ∈ 𝐷𝐷(𝑓𝑓).
20
2. NLP with Decreasing Marginal Returns:
Wyndor
21
Original Wyndor Glass Co. Spreadsheet
22
Wyndor Glass with Marketing Costs
Market research indicates that Wyndor could sell small numbers of doors
and windows with no advertising. However, extensive advertising would
be required to sell all that could be produced.
A curve-fitting procedure was used to estimate the weekly marketing
costs required to sustain a production rate of D doors and W windows:
2 2
• Marketing costs for windows = $66 𝑊𝑊
3
23
Wyndor Glass with Marketing Costs
The gross profit per door sold is about $375, and the gross profit per
window is about $700. Therefore, the net profits are as follows:
•
Net profit for doors = $375D - $25D2
2 2
Net profit for windows = $700W - $66 𝑊𝑊
3
Thus, the revised objective function is
2 2 2
Maximize Profit = $375D - 25D + $700W - ($66 )W
3
Question:
Considering the nonlinear marketing costs, how many doors and
windows should Wyndor produce? 24
Profit Graphs for Doors and Windows
Weekly
profit
($)
1,800
1,600
Weekly
profit
($) 1,400
1,200 1,200
1,000 1,000
800 800
600 600
400 400
200 200
0 2 4 D 0 2 4 6 W
Production rate for doors Production rate for windows 25
Spreadsheet Formulation
26
Graphical Display of Nonlinear Formulation
W
(3 3 , 4 5 ) = optimal solution
14 28
Profit = $2,800
3 Feasible Profit = $2,708
region
Profit = $2,600
Profit = $2,500
2
0 1 2 3 4 5 D
Production rate for doors
The curves are objective function curves for some sample values of Profit. 27
3. NLP with Decreasing Marginal Returns:
Portfolio Selection
28
Portfolio Selection
It is now common practice for professional managers of large stock portfolios to
use computer models based on nonlinear programming to guide them.
Investors are concerned about both the expected return and the risk.
One way of formulating their approach is as a nonlinear version of a cost-benefit
trade-off problem:
• Minimize Risk
subject to Expected return ≥ Minimum acceptable level.
Question:
What is the portfolio that will minimize the risk subject to achieving at least
an 18% expected return?
29
Data for Stocks
𝑛𝑛 𝑛𝑛
Note: 𝑉𝑉𝑉𝑉𝑉𝑉 � 𝑎𝑎𝑖𝑖 𝑋𝑋𝑖𝑖 = � 𝑎𝑎𝑖𝑖2 𝑉𝑉𝑉𝑉𝑉𝑉 𝑋𝑋𝑖𝑖 + 2 � 𝑎𝑎𝑖𝑖 𝑎𝑎𝑗𝑗 𝐶𝐶𝐶𝐶𝐶𝐶(𝑋𝑋𝑖𝑖 , 𝑋𝑋𝑗𝑗 )
𝑖𝑖=1 𝑖𝑖=1 1≤𝑖𝑖≤𝑗𝑗≤𝑛𝑛
30
Algebraic Formulation
and
S1 ≥ 0, S2 ≥ 0, S3 ≥ 0.
31
Spreadsheet Model 1
32
Agenda
Announcement
Quiz 4: Mar 28, Please study:
• Lecture Note 5: Integer Programming Models
• Lecture Note 6: Non-linear Programming Models
Homework 4, Due: Apr 2, 11:59 pm
• Including the reading on “Routing Optimization for Waste Management”
Today’s Plan
Lecture 6: Nonlinear Programming (cont’d)
• Reading: OptDSM_Ch8_Nonlinear Programming_Reading.pdf
1. The Challenges of Nonlinear Programming (Sec 8.1)
2. NLP with Decreasing Marginal Returns: Wyndor (Sec 8.2)
3. NLP with Decreasing Marginal Returns: Portfolio Selection (Sec 8.2)
4. Separable Programming (Sec 8.3)
5. Difficult Nonlinear Programming Problems (Sec 8.4)
6. Evolutionary Solver and Genetic Algorithms (Sec 8.5)
Next Class
Lecture 6: Nonlinear Programming (cont’d)
4. Separable Programming
34
Wyndor Glass When Overtime is Needed
• Wyndor Glass has accepted a special order for hand-crafted goods to be made in plants 1
and 2 throughout the next four months.
• Filling this order will require borrowing certain employees from the work crews of regular
products.
• The remaining workers will need to work overtime to utilize the full production capacity
of each plant’s machinery for the regular products.
• The original constraints of Hours Used ≤ Hours Available are still valid. However, the
objective function will need to be modified because of the additional cost of using
overtime work.
• In particular, because of the additional cost, the profit per unit will be reduced for those
units that require overtime.
36
Profit Graphs for Doors and Windows
Weekly
profit
($)
1,800
1,500
Weekly
profit
($)
1,100
900
0 3 4 D 0 3 6 W
Production rate for doors Production rate for windows 37
The Separable Programming Technique
• For each activity that violates the proportionality assumption, separate its profit graph
into parts, with a line segment in each part.
• Then, instead of using a single decision variable to represent the level of each such
activity, introduce a separate new decision variable for each line segment on that
activity’s profit graph.
• Since the proportionality assumption holds for these new decision variables,
formulate a linear programming model in terms of these variables.
39
Separable Programming with Smooth
Profit Graphs
40
Advantages of Separable Programming
Solver can readily solve nonlinear problems that have decreasing marginal
returns, with the advantage that no approximation is needed.
However, the separable programming approach also has certain advantages:
• Converting the problem into a linear programming problem tends to make it
quicker to solve, which can be very helpful for large problems.
• A linear programming formulation makes available Solver’s Sensitivity
Report.
• Separable programming only requires estimating the profit from each
activity at a few points. Therefore, it is not necessary to use a curve fitting
method to estimate the formula for the profit graph.
41
Wyndor Problem with Both Overtime Costs
and Nonlinear Marketing Costs
The previous spreadsheet model does not include nonlinear marketing costs.
Recall that the curve-fitting procedure was used to estimate the weekly
marketing costs required to sustain a production rate of D doors and W
windows:
Question:
Considering both overtime costs and nonlinear marketing costs, how
many doors and windows should Wyndor produce?
42
Data for Wyndor with Overtime Costs and
Nonlinear Marketing Costs
Maximum
Maximum Maximum Gross Gross
Weekly Gross Unit
Weekly Weekly Unit Profit Unit
Product Production Marketing
Production Production in Regular Profit in
in Regular Costs
in Overtime in Total Time Overtime
Time
Doors 3 1 4 $375 $275 $25D2
$25 D squared
66 and
2 22
Windows 3 3 6 700 300 66 3W
over W
3
squared
43
Weekly Profit from Producing Doors
44
Weekly Profit from Producing Windows
45
Weekly Profit from Producing Windows
46
Profit Graphs for Doors and Windows
47
Separable Programming Spreadsheet Model
48
Nonlinear Programming Spreadsheet Model
49
5. Difficult Nonlinear Programming Problems
50
Difficult Nonlinear Programming Problems
Even if a model has a nonlinear objective function, so long as the model has
certain properties (e.g., linear constraints, decreasing marginal returns), the Solver
can easily find an optimal solution.
In some cases separable programming can be used to model a nonlinear problem
in such a way that linear programming can be used.
However, if a problem has increasing marginal returns, or nonlinear functions in
the constraints, or disconnected profit graphs, finding a solution is often much
more difficult.
• Such problems may have many local optima.
• Solver can get stuck at local optima, rather than finding the global optimum.
One approach with such problems is to solve the problem many times, each time
starting with a different initial solution.
• Solver’s Multi-Start option can do this automatically. 51
Using Multistart to Try Different
Random Starting Points
52
6. Evolutionary Solver and Genetic Algorithms
53
Evolutionary Solver and Genetic Algorithms
• Evolutionary Solver uses an entirely different approach than the
standard Solver to search for an optimal solution for a model.
• The philosophy of Evolutionary Solver is based on genetics, evolution
and the survival of the fittest. Hence, this type of algorithm is sometimes
called a genetic algorithm.
• The standard Solver starts with a single solution, and then moves in
directions that will improve this solution. Evolutionary Solver begins by
randomly generating a whole population of solutions.
• After generating the population, Evolutionary Solver creates a new
generation by pairing off solutions in the population to create
“offspring”, combining some elements from each parent.
54
Evolutionary Solver and Genetic Algorithms
• Among solutions in the population, some will be good (or “fit”) and some
will be bad (or “unfit”), as measured by evaluating the objective function.
Borrowing from the principles of evolution and survival of the fittest, the
“fit” members are allowed to reproduce more frequently than the unfit
members.
• Another key feature is mutation. Like gene mutation in biology,
Evolutionary Solver will occasionally make a random change in a member
of the population. This helps the algorithm get unstuck if it is getting
trapped near a local optimum. E.g.,
Question: What mix of these five stocks will yield a portfolio that is
likely to beat the market in the future? 56
Spreadsheet Model
57
Evolutionary Solver Spreadsheet Solution
58
Agenda
Announcement
Quiz 4: Mar 28:
• Lecture Note 5: Integer Programming Models
• Lecture Note 6: Non-linear Programming Models
Today’s Plan
Lecture 6: Nonlinear Programming (cont’d)
• Reading: OptDSM_Ch8_Nonlinear Programming_Reading.pdf
1. The Challenges of Nonlinear Programming (Sec 8.1)
2. NLP with Decreasing Marginal Returns: Wyndor (Sec 8.2)
3. NLP with Decreasing Marginal Returns: Portfolio Selection (Sec 8.2)
4. Separable Programming (Sec 8.3)
5. Difficult Nonlinear Programming Problems (Sec 8.4)
6. Evolutionary Solver and Genetic Algorithms (Sec 8.5)
Next Class
Lecture 7: Decision Analysis under Uncertainty
Evolutionary Solver Spreadsheet Solution
60
Excel Solver Dialog Box
61
Excel Solver Dialog Box
A) I only
B) II only
C) III only
D) Only II and III
E) I, II, and III
63
Tour of American League Ballparks
• After completing her MBA from the Foster School of Business in Seattle, Becky
Thomas would like to tour the United States.
• She would like to see a major league baseball game in every American League city.
• She will then return to Seattle to start a job in the fall.
https://www.ballparksofbaseball.com/american-league/
https://en.wikipedia.org/wiki/List_of_current_Major_League_Baseball_stadiums#:~:text=There%20ar
e%2030%20stadiums%20in,Rangers%2C%20which%20opened%20in%202020
64
Traveling Salesman Problem (TSP)
• Problem Statement
• Given 𝑛𝑛 cities and cost of traveling from any city to any other city, find the
cheapest round-trip such that each city is visited exactly once returning to the
starting city (i.e., finding the least weight Hamiltonian cycle*).
65
Traveling Salesman Problem (TSP)
• How difficult is it to solve this problem?
• To get a quick idea of the complexity of the problem, we can say that any TSP path will
be a listing of the N cities in some order.
• How many possible orderings are there?
• Given a starting city (we can choose any city since it will be somewhere on the path)
there are N − 1 choices for the second city, in the path, N −2 choices for the third city in
the path, and so on, leaving (N −1)! factorial possible paths: (N − 1)! = (N − 1) · (N − 2) ·
(N − 3) · . . . · 1.
• Actually, this will generate paths which are circularly symmetric, so they constitute the
same path. For example, listing a 4 city Hamiltonian cycle as 1-2-3-4-1 is identical to the
cycle 1-4-3-2-1.
𝑵𝑵−𝟏𝟏 !
• The actual number of distinct paths is
𝟐𝟐
𝑵𝑵−𝟏𝟏 !
N=15 cities. =43,589,145,600 distinct routes are possible.
𝟐𝟐
66
If the TSP is so hard, why bother?
• The TSP has many practical applications:
• Manufacturing: an industrial robot that drills holes in printed circuit boards.
• Communication: planning new telecommunication networks.
• Transportation: school bus routes, service calls, delivering meals, ...
• Structure of crystals, etc.
67
(Optional) TSP Solution Approaches
Is there any hope for getting reasonable solutions for the TSP?
68
https://en.wikipedia.org/wiki/Simulated_annealing
(Optional) TSP Solution Approaches
• While good solutions may be obtained using heuristics/metaheuristics, it is
difficult to prove if those solutions are optimal.
• Perhaps there is a way that is smarter than brute force and gives the optimal
solution, e.g., Branch-and-Bound Algorithm.
69
(Optional) TSP Solution Approaches
• Branch-and-Bound Algorithm
• In 1993 Bixby, Applegate, Chvatal, and Cook found a solution for 3,038 cities using the
Branch-and-Bound technique, a world record at the time! The computations were
done on 50 SGI workstations, and took a year and a half.
• The same researchers went on to find the optimal path for 13,509 cities in 1998!
Required 5 “CPU-years”
• Modern advanced algorithms and computational power can handle much larger
problems efficiently. 70
Tour of American League Ballparks
𝑵𝑵−𝟏𝟏 !
N=15 cities. =43,589,145,600 distinct routes.
𝟐𝟐
71
Unsolved Spreadsheet Model for Tour
of American League Ballparks
72
The alldifferent Constraint
73
Solved Spreadsheet Model for
Tour of American League Ballparks
74
Advantages of Evolutionary Solver
Evolutionary Solver has two significant advantages over the standard Solver
for solving difficult nonlinear programming problems:
• The complexity of the objective function does not matter. As long as the
function can be evaluated for a given candidate solution (to determine the
level of fitness), it does not matter if the function has kinks, discontinuities,
or many local optima.
• By evaluating whole populations of candidate solutions, Evolutionary
Solver keeps from getting trapped at a local optimum. Even if the whole
population evolves toward a locally optimal solution, mutation allows the
possibility of getting unstuck.
75
Disadvantages of Evolutionary Solver
However, Evolutionary Solver is not a panacea.
• It can take much longer that standard Solver to find a final solution.
• Evolutionary Solver does not perform well on models that have many
constraints.
• Evolutionary Solver is a random process. Running it again on the same
model usually will yield a different solution.
• The best solution found is typically not optimal (although it may be very
close).
76
Solver’s Various Solving Method’s
• Simplex LP (the Linear Solver) used to solve linear and BIP problems.
• GRG Nonlinear (the Nonlinear Solver) used to solve nonlinear problems.
• Evolutionary (the Evolutionary Solver) used to solve difficult nonlinear
problems.
77
NLP Summary
• A nonlinear optimization problem is any optimization problem in which at least
one term in the objective function or a constraint is nonlinear.
78
NLP Summary
• Multiple Local Optima
• Nonlinear optimization problems can have multiple local optimal solutions, in which
case we want to find the best local optimum.
• Nonlinear problems with multiple local optima are difficult to solve and pose a
serious challenge for optimization software.
• In these cases, the software can get “stuck” and terminate at a local optimum.
• There can be a severe penalty for finding a local optimum that is not a global
optimum.
• Developing algorithms capable of finding the global optimum is currently a very
active research area.
(− X ) − 10 X − X 3 − Y 5 e( − X ) − e( −( X +1) −Y )
−(Y +1)
( 5 )
2 2
f ( X , Y ) = 3 (1 − X ) e
2 2
2 2
−Y 2
/3
79
Instant Quiz
One reason that a manager may choose to use a nonlinear model to analyze a
problem is:
80