Date post: | 01-Jan-2016 |
Category: |
Documents |
Upload: | benecia-urban |
View: | 37 times |
Download: | 2 times |
1
15053 Thursday May 16
Review of 15053
Handouts Lecture Notes
2
Overview of Problem Types
Nonlinear Programming
ldquoEasyrdquo Nonlinear Programming
Linear Programming
Integer Programming
Network Flows
ldquoHardrdquo Nonlinear Programming
Dynamic programming
3
Overview of Problem Types
Nonlinear Programming
ldquoEasyrdquo Nonlinear Programming
ldquoHardrdquo Nonlinear Programming
Integer Programming
Network Flows
Linear Programming
Dynamic programming
4
Why the focus on linear programming
bull Linear programming illustrates much of what is important about modeling
bull Linear programming is a very useful tool in optimization
bull We can solve linear programs very efficientlybull The state-of-the-art integer programming techniques
rely on linear programmingbull Linear Programming is the best way of teaching abo
ut performance guarantees and dualitybull Linear programming is very helpful for understandin
g other optimization approaches
5
Topics through midterm 2
bull Linear programming ndashFormulations ndashGeometry ndashThe simplex algorithm ndashSensitivity Analysis ndashDuality Theorybull Network Optimizationbull Integer programming ndashformulations ndashBampB ndashCutting planes
6
Topics covered in the Final Exam
bull Linear Programming Formulations
bull Integer Programming Formulations
bull Nonlinear Programming
bull Dynamic Programming
bull Heuristics
7
Rest of this lecture
bull A very brief overview of the topics covered since the 2ndmidterm
bull Slides drawn from lectures
bull If you have questions about the topics covered ask them as I go along
bull I need to reserve time at the end for Sloan course evaluations
8
What is a non-linear program
bull maximize
Subject to
bull A non-linear program is permitted to have non-linear constraints or objectives
bull A linear program is a special case of non-linear programming
9
Portfolio Selection Example
bull When trying to design a financial portfolio investors seek to simultaneously minimize risk and maximize return
bull Risk is often measured as the variance of the total return a nonlinear function
bull FACT
10
Portfolio Selection (contrsquod)
bull Two Methods are commonly used ndashMin Risk st Expected Return geBound ndashMax Expected Return -θ (Risk) where θreflects the tradeoff between r
eturn and risk
11
Regression and estimating βReturn on Stock A vs Market Return
The value βis the slope of the regression line Here it is around 6 (lower expected gain than the market and lower risk)
12
Local vs Global Optima
Defrsquon Let xbe a feasible solution then
ndashxis a global max_if f(x) gef(y) for every feasible y
ndashxis a local max_if f(x) ge f(y) for every feasible ysufficiently close to x(ie xj-ε le yjlexj+ εfor all jand some small ε)
There may be several locally optimal solutions
13
Convex Functions
Convex Functions
f(λy + (1-λ)z) le λf(y) + (1-λ)f(z)
for every yand zand for 0le λ le1
eg f((y+z)2) le f(y)2 + f(z)2
We say ldquostrictrdquo convexity if sign is ldquoltrdquo for 0lt λ lt1
Line joining any pointsIs above the curve
14
Concave Functions
Concave Functions f(λy + (1-λ)z) ge λf(y) + (1-λ)f(z)
for every yand zand for 0le λ le1
eg f((y+z)2) ge f(y)2 + f(z)2
We say ldquostrictrdquo convexity if sign is ldquogtrdquo for 0lt λ lt1
15
Convexity and Extreme Pointsxy
We say that a set Sis convex if for every two points xand yin S and for every real number λin [01] λx + (1-λ)y εS
The feasible region of a linear program is convex
We say that an element w εSis an extreme point(vertexcorner point) if wis not the midpoint of any line segment contained in S
16
Local Maximum (Minimum) Property
bull A local max of a concave function on a convex feasible region is also a global max
bull A local min of a convex function on a convex feasible region is also a global min
bull Strict convexity or concavity implies that the global optimum isunique
bull Given this we can efficiently solve ndashMaximization Problems with a concave obje
ctive function and linear constraints ndashMinimization Problems with a convex object
ive function and linear constraints
17
Where is the optimal solution
Note the optimal solution is not at a corner pointIt is where the isocontour first hits the feasible region
18
Another example
X
Minimize(x-8)2+ (y-8)2
Then the global unconstrained minimum
is also feasible
The optimal solution is not on the boundary of the feasible region
19
Finding a local maximum using Fibonacci Search
Where the maximum may be
Length of search Interval 3
20
The search finds a local maximum but not necessarily a global maximum
21
Approximating a non-linear function of 1 variable the λmethody
Choose different values of xto
approximate the x-axis
Approximate using piecewise linear
segments
22
More on theλmethody
Suppose that for ndash3 lex le-1
Then we approximate f(x) as λ1(-20) + λ2(-7 13)
we represent x has λ1(-3) + λ2(-1) where λ1 + λ2= 1 and λ1 λ2ge0
23
Approximating a non-linear objective function for a minimization NLP
original problem minimize Suppose that where
bull Approximate f(y) minimize
ndash Note when given a choice of representing y in alternative ways the LP will choose one that leads to the least objective value for the approximation
24
For minimizing a convex function the λ-method automatically satisfies the
additional adjacency property
+ adjacency condition+ other constraints
25
Dynamic programming
bull Suppose that there are 50 matches on a table and the person who picks up the last match wins At each alternating turn my opponent or I can pick up 1 2 or 6 matches Assuming that I go first how can I be sure of winning the game
26
Determining the strategy using DP
bull n = number of matches left (n is the statestage) bull g(n) = 1 if you can force a win at n matches g(n) = 0 otherwise g(n) = optimal value functionAt each statestage you can make one of three decision
s take 1 2 or 6 matchesbull g(1) = g(2) = g(6) = 1 (boundary conditions)bull g(3) = 0 g(4) = g(5) = 1 (why)The recursionbull g(n) = 1 if g(n-1) = 0 or g(n-2) = 0 or g(n-6) = 0 g(n) = 0 otherwisebull Equivalently g(n) = 1 ndashmin (g(n-1) g(n-2) g(n-6))
27
Dynamic Programming in General
bull Break up a complex decision problem into a sequence of smaller decision subproblems
bull Stages one solves decision problems one ldquostagerdquo at a time Stages often can be thought of as ldquotimerdquo in most instances ndash Not every DP has stagesndash The previous shortest path problem has 6 stagesndash The match problem does not have stages
28
Dynamic Programming in General
bull States The smaller decision subproblemsare often expressed in a very compact manner The description of the smaller subproblemsis often referred to as the state ndash match problem ldquostaterdquo is the number of matches
leftbull At each state-stage there are one or more de
cisions The DP recursion determines the best decision ndash match problem how many matches to removendash shortest path example go right and up or else go
down and right
29
Optimal Capacity Expansion What is the least cost way of building plants
Cost of $15 million in any year in which a plant is built At most 3 plants a year can be built
Cum DemandCost per plant in $millions
30
Finding a topological order
Find a node with no incoming arc Label it node 1For i = 2 to n find a node with no incoming arc from an unlabeled node Label it node i
31
Find d(j) using a recursion
d(j) is the shortest length of a path from node 1 to node j
Let cij = length of arc (ij)
What is d(j) computed in terms of d(1) hellip d(j-1)
Compute f(2) hellip f(8)Example d(4) = min 3 + d(2) 2 + d(3)
32
Finding optimal paragraph layouts
bull Tex optimally decomposes paragraphs by selecting the breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
bull Tex optimally decomposes paragraphs by select-ingthe breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
2
Overview of Problem Types
Nonlinear Programming
ldquoEasyrdquo Nonlinear Programming
Linear Programming
Integer Programming
Network Flows
ldquoHardrdquo Nonlinear Programming
Dynamic programming
3
Overview of Problem Types
Nonlinear Programming
ldquoEasyrdquo Nonlinear Programming
ldquoHardrdquo Nonlinear Programming
Integer Programming
Network Flows
Linear Programming
Dynamic programming
4
Why the focus on linear programming
bull Linear programming illustrates much of what is important about modeling
bull Linear programming is a very useful tool in optimization
bull We can solve linear programs very efficientlybull The state-of-the-art integer programming techniques
rely on linear programmingbull Linear Programming is the best way of teaching abo
ut performance guarantees and dualitybull Linear programming is very helpful for understandin
g other optimization approaches
5
Topics through midterm 2
bull Linear programming ndashFormulations ndashGeometry ndashThe simplex algorithm ndashSensitivity Analysis ndashDuality Theorybull Network Optimizationbull Integer programming ndashformulations ndashBampB ndashCutting planes
6
Topics covered in the Final Exam
bull Linear Programming Formulations
bull Integer Programming Formulations
bull Nonlinear Programming
bull Dynamic Programming
bull Heuristics
7
Rest of this lecture
bull A very brief overview of the topics covered since the 2ndmidterm
bull Slides drawn from lectures
bull If you have questions about the topics covered ask them as I go along
bull I need to reserve time at the end for Sloan course evaluations
8
What is a non-linear program
bull maximize
Subject to
bull A non-linear program is permitted to have non-linear constraints or objectives
bull A linear program is a special case of non-linear programming
9
Portfolio Selection Example
bull When trying to design a financial portfolio investors seek to simultaneously minimize risk and maximize return
bull Risk is often measured as the variance of the total return a nonlinear function
bull FACT
10
Portfolio Selection (contrsquod)
bull Two Methods are commonly used ndashMin Risk st Expected Return geBound ndashMax Expected Return -θ (Risk) where θreflects the tradeoff between r
eturn and risk
11
Regression and estimating βReturn on Stock A vs Market Return
The value βis the slope of the regression line Here it is around 6 (lower expected gain than the market and lower risk)
12
Local vs Global Optima
Defrsquon Let xbe a feasible solution then
ndashxis a global max_if f(x) gef(y) for every feasible y
ndashxis a local max_if f(x) ge f(y) for every feasible ysufficiently close to x(ie xj-ε le yjlexj+ εfor all jand some small ε)
There may be several locally optimal solutions
13
Convex Functions
Convex Functions
f(λy + (1-λ)z) le λf(y) + (1-λ)f(z)
for every yand zand for 0le λ le1
eg f((y+z)2) le f(y)2 + f(z)2
We say ldquostrictrdquo convexity if sign is ldquoltrdquo for 0lt λ lt1
Line joining any pointsIs above the curve
14
Concave Functions
Concave Functions f(λy + (1-λ)z) ge λf(y) + (1-λ)f(z)
for every yand zand for 0le λ le1
eg f((y+z)2) ge f(y)2 + f(z)2
We say ldquostrictrdquo convexity if sign is ldquogtrdquo for 0lt λ lt1
15
Convexity and Extreme Pointsxy
We say that a set Sis convex if for every two points xand yin S and for every real number λin [01] λx + (1-λ)y εS
The feasible region of a linear program is convex
We say that an element w εSis an extreme point(vertexcorner point) if wis not the midpoint of any line segment contained in S
16
Local Maximum (Minimum) Property
bull A local max of a concave function on a convex feasible region is also a global max
bull A local min of a convex function on a convex feasible region is also a global min
bull Strict convexity or concavity implies that the global optimum isunique
bull Given this we can efficiently solve ndashMaximization Problems with a concave obje
ctive function and linear constraints ndashMinimization Problems with a convex object
ive function and linear constraints
17
Where is the optimal solution
Note the optimal solution is not at a corner pointIt is where the isocontour first hits the feasible region
18
Another example
X
Minimize(x-8)2+ (y-8)2
Then the global unconstrained minimum
is also feasible
The optimal solution is not on the boundary of the feasible region
19
Finding a local maximum using Fibonacci Search
Where the maximum may be
Length of search Interval 3
20
The search finds a local maximum but not necessarily a global maximum
21
Approximating a non-linear function of 1 variable the λmethody
Choose different values of xto
approximate the x-axis
Approximate using piecewise linear
segments
22
More on theλmethody
Suppose that for ndash3 lex le-1
Then we approximate f(x) as λ1(-20) + λ2(-7 13)
we represent x has λ1(-3) + λ2(-1) where λ1 + λ2= 1 and λ1 λ2ge0
23
Approximating a non-linear objective function for a minimization NLP
original problem minimize Suppose that where
bull Approximate f(y) minimize
ndash Note when given a choice of representing y in alternative ways the LP will choose one that leads to the least objective value for the approximation
24
For minimizing a convex function the λ-method automatically satisfies the
additional adjacency property
+ adjacency condition+ other constraints
25
Dynamic programming
bull Suppose that there are 50 matches on a table and the person who picks up the last match wins At each alternating turn my opponent or I can pick up 1 2 or 6 matches Assuming that I go first how can I be sure of winning the game
26
Determining the strategy using DP
bull n = number of matches left (n is the statestage) bull g(n) = 1 if you can force a win at n matches g(n) = 0 otherwise g(n) = optimal value functionAt each statestage you can make one of three decision
s take 1 2 or 6 matchesbull g(1) = g(2) = g(6) = 1 (boundary conditions)bull g(3) = 0 g(4) = g(5) = 1 (why)The recursionbull g(n) = 1 if g(n-1) = 0 or g(n-2) = 0 or g(n-6) = 0 g(n) = 0 otherwisebull Equivalently g(n) = 1 ndashmin (g(n-1) g(n-2) g(n-6))
27
Dynamic Programming in General
bull Break up a complex decision problem into a sequence of smaller decision subproblems
bull Stages one solves decision problems one ldquostagerdquo at a time Stages often can be thought of as ldquotimerdquo in most instances ndash Not every DP has stagesndash The previous shortest path problem has 6 stagesndash The match problem does not have stages
28
Dynamic Programming in General
bull States The smaller decision subproblemsare often expressed in a very compact manner The description of the smaller subproblemsis often referred to as the state ndash match problem ldquostaterdquo is the number of matches
leftbull At each state-stage there are one or more de
cisions The DP recursion determines the best decision ndash match problem how many matches to removendash shortest path example go right and up or else go
down and right
29
Optimal Capacity Expansion What is the least cost way of building plants
Cost of $15 million in any year in which a plant is built At most 3 plants a year can be built
Cum DemandCost per plant in $millions
30
Finding a topological order
Find a node with no incoming arc Label it node 1For i = 2 to n find a node with no incoming arc from an unlabeled node Label it node i
31
Find d(j) using a recursion
d(j) is the shortest length of a path from node 1 to node j
Let cij = length of arc (ij)
What is d(j) computed in terms of d(1) hellip d(j-1)
Compute f(2) hellip f(8)Example d(4) = min 3 + d(2) 2 + d(3)
32
Finding optimal paragraph layouts
bull Tex optimally decomposes paragraphs by selecting the breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
bull Tex optimally decomposes paragraphs by select-ingthe breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
3
Overview of Problem Types
Nonlinear Programming
ldquoEasyrdquo Nonlinear Programming
ldquoHardrdquo Nonlinear Programming
Integer Programming
Network Flows
Linear Programming
Dynamic programming
4
Why the focus on linear programming
bull Linear programming illustrates much of what is important about modeling
bull Linear programming is a very useful tool in optimization
bull We can solve linear programs very efficientlybull The state-of-the-art integer programming techniques
rely on linear programmingbull Linear Programming is the best way of teaching abo
ut performance guarantees and dualitybull Linear programming is very helpful for understandin
g other optimization approaches
5
Topics through midterm 2
bull Linear programming ndashFormulations ndashGeometry ndashThe simplex algorithm ndashSensitivity Analysis ndashDuality Theorybull Network Optimizationbull Integer programming ndashformulations ndashBampB ndashCutting planes
6
Topics covered in the Final Exam
bull Linear Programming Formulations
bull Integer Programming Formulations
bull Nonlinear Programming
bull Dynamic Programming
bull Heuristics
7
Rest of this lecture
bull A very brief overview of the topics covered since the 2ndmidterm
bull Slides drawn from lectures
bull If you have questions about the topics covered ask them as I go along
bull I need to reserve time at the end for Sloan course evaluations
8
What is a non-linear program
bull maximize
Subject to
bull A non-linear program is permitted to have non-linear constraints or objectives
bull A linear program is a special case of non-linear programming
9
Portfolio Selection Example
bull When trying to design a financial portfolio investors seek to simultaneously minimize risk and maximize return
bull Risk is often measured as the variance of the total return a nonlinear function
bull FACT
10
Portfolio Selection (contrsquod)
bull Two Methods are commonly used ndashMin Risk st Expected Return geBound ndashMax Expected Return -θ (Risk) where θreflects the tradeoff between r
eturn and risk
11
Regression and estimating βReturn on Stock A vs Market Return
The value βis the slope of the regression line Here it is around 6 (lower expected gain than the market and lower risk)
12
Local vs Global Optima
Defrsquon Let xbe a feasible solution then
ndashxis a global max_if f(x) gef(y) for every feasible y
ndashxis a local max_if f(x) ge f(y) for every feasible ysufficiently close to x(ie xj-ε le yjlexj+ εfor all jand some small ε)
There may be several locally optimal solutions
13
Convex Functions
Convex Functions
f(λy + (1-λ)z) le λf(y) + (1-λ)f(z)
for every yand zand for 0le λ le1
eg f((y+z)2) le f(y)2 + f(z)2
We say ldquostrictrdquo convexity if sign is ldquoltrdquo for 0lt λ lt1
Line joining any pointsIs above the curve
14
Concave Functions
Concave Functions f(λy + (1-λ)z) ge λf(y) + (1-λ)f(z)
for every yand zand for 0le λ le1
eg f((y+z)2) ge f(y)2 + f(z)2
We say ldquostrictrdquo convexity if sign is ldquogtrdquo for 0lt λ lt1
15
Convexity and Extreme Pointsxy
We say that a set Sis convex if for every two points xand yin S and for every real number λin [01] λx + (1-λ)y εS
The feasible region of a linear program is convex
We say that an element w εSis an extreme point(vertexcorner point) if wis not the midpoint of any line segment contained in S
16
Local Maximum (Minimum) Property
bull A local max of a concave function on a convex feasible region is also a global max
bull A local min of a convex function on a convex feasible region is also a global min
bull Strict convexity or concavity implies that the global optimum isunique
bull Given this we can efficiently solve ndashMaximization Problems with a concave obje
ctive function and linear constraints ndashMinimization Problems with a convex object
ive function and linear constraints
17
Where is the optimal solution
Note the optimal solution is not at a corner pointIt is where the isocontour first hits the feasible region
18
Another example
X
Minimize(x-8)2+ (y-8)2
Then the global unconstrained minimum
is also feasible
The optimal solution is not on the boundary of the feasible region
19
Finding a local maximum using Fibonacci Search
Where the maximum may be
Length of search Interval 3
20
The search finds a local maximum but not necessarily a global maximum
21
Approximating a non-linear function of 1 variable the λmethody
Choose different values of xto
approximate the x-axis
Approximate using piecewise linear
segments
22
More on theλmethody
Suppose that for ndash3 lex le-1
Then we approximate f(x) as λ1(-20) + λ2(-7 13)
we represent x has λ1(-3) + λ2(-1) where λ1 + λ2= 1 and λ1 λ2ge0
23
Approximating a non-linear objective function for a minimization NLP
original problem minimize Suppose that where
bull Approximate f(y) minimize
ndash Note when given a choice of representing y in alternative ways the LP will choose one that leads to the least objective value for the approximation
24
For minimizing a convex function the λ-method automatically satisfies the
additional adjacency property
+ adjacency condition+ other constraints
25
Dynamic programming
bull Suppose that there are 50 matches on a table and the person who picks up the last match wins At each alternating turn my opponent or I can pick up 1 2 or 6 matches Assuming that I go first how can I be sure of winning the game
26
Determining the strategy using DP
bull n = number of matches left (n is the statestage) bull g(n) = 1 if you can force a win at n matches g(n) = 0 otherwise g(n) = optimal value functionAt each statestage you can make one of three decision
s take 1 2 or 6 matchesbull g(1) = g(2) = g(6) = 1 (boundary conditions)bull g(3) = 0 g(4) = g(5) = 1 (why)The recursionbull g(n) = 1 if g(n-1) = 0 or g(n-2) = 0 or g(n-6) = 0 g(n) = 0 otherwisebull Equivalently g(n) = 1 ndashmin (g(n-1) g(n-2) g(n-6))
27
Dynamic Programming in General
bull Break up a complex decision problem into a sequence of smaller decision subproblems
bull Stages one solves decision problems one ldquostagerdquo at a time Stages often can be thought of as ldquotimerdquo in most instances ndash Not every DP has stagesndash The previous shortest path problem has 6 stagesndash The match problem does not have stages
28
Dynamic Programming in General
bull States The smaller decision subproblemsare often expressed in a very compact manner The description of the smaller subproblemsis often referred to as the state ndash match problem ldquostaterdquo is the number of matches
leftbull At each state-stage there are one or more de
cisions The DP recursion determines the best decision ndash match problem how many matches to removendash shortest path example go right and up or else go
down and right
29
Optimal Capacity Expansion What is the least cost way of building plants
Cost of $15 million in any year in which a plant is built At most 3 plants a year can be built
Cum DemandCost per plant in $millions
30
Finding a topological order
Find a node with no incoming arc Label it node 1For i = 2 to n find a node with no incoming arc from an unlabeled node Label it node i
31
Find d(j) using a recursion
d(j) is the shortest length of a path from node 1 to node j
Let cij = length of arc (ij)
What is d(j) computed in terms of d(1) hellip d(j-1)
Compute f(2) hellip f(8)Example d(4) = min 3 + d(2) 2 + d(3)
32
Finding optimal paragraph layouts
bull Tex optimally decomposes paragraphs by selecting the breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
bull Tex optimally decomposes paragraphs by select-ingthe breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
4
Why the focus on linear programming
bull Linear programming illustrates much of what is important about modeling
bull Linear programming is a very useful tool in optimization
bull We can solve linear programs very efficientlybull The state-of-the-art integer programming techniques
rely on linear programmingbull Linear Programming is the best way of teaching abo
ut performance guarantees and dualitybull Linear programming is very helpful for understandin
g other optimization approaches
5
Topics through midterm 2
bull Linear programming ndashFormulations ndashGeometry ndashThe simplex algorithm ndashSensitivity Analysis ndashDuality Theorybull Network Optimizationbull Integer programming ndashformulations ndashBampB ndashCutting planes
6
Topics covered in the Final Exam
bull Linear Programming Formulations
bull Integer Programming Formulations
bull Nonlinear Programming
bull Dynamic Programming
bull Heuristics
7
Rest of this lecture
bull A very brief overview of the topics covered since the 2ndmidterm
bull Slides drawn from lectures
bull If you have questions about the topics covered ask them as I go along
bull I need to reserve time at the end for Sloan course evaluations
8
What is a non-linear program
bull maximize
Subject to
bull A non-linear program is permitted to have non-linear constraints or objectives
bull A linear program is a special case of non-linear programming
9
Portfolio Selection Example
bull When trying to design a financial portfolio investors seek to simultaneously minimize risk and maximize return
bull Risk is often measured as the variance of the total return a nonlinear function
bull FACT
10
Portfolio Selection (contrsquod)
bull Two Methods are commonly used ndashMin Risk st Expected Return geBound ndashMax Expected Return -θ (Risk) where θreflects the tradeoff between r
eturn and risk
11
Regression and estimating βReturn on Stock A vs Market Return
The value βis the slope of the regression line Here it is around 6 (lower expected gain than the market and lower risk)
12
Local vs Global Optima
Defrsquon Let xbe a feasible solution then
ndashxis a global max_if f(x) gef(y) for every feasible y
ndashxis a local max_if f(x) ge f(y) for every feasible ysufficiently close to x(ie xj-ε le yjlexj+ εfor all jand some small ε)
There may be several locally optimal solutions
13
Convex Functions
Convex Functions
f(λy + (1-λ)z) le λf(y) + (1-λ)f(z)
for every yand zand for 0le λ le1
eg f((y+z)2) le f(y)2 + f(z)2
We say ldquostrictrdquo convexity if sign is ldquoltrdquo for 0lt λ lt1
Line joining any pointsIs above the curve
14
Concave Functions
Concave Functions f(λy + (1-λ)z) ge λf(y) + (1-λ)f(z)
for every yand zand for 0le λ le1
eg f((y+z)2) ge f(y)2 + f(z)2
We say ldquostrictrdquo convexity if sign is ldquogtrdquo for 0lt λ lt1
15
Convexity and Extreme Pointsxy
We say that a set Sis convex if for every two points xand yin S and for every real number λin [01] λx + (1-λ)y εS
The feasible region of a linear program is convex
We say that an element w εSis an extreme point(vertexcorner point) if wis not the midpoint of any line segment contained in S
16
Local Maximum (Minimum) Property
bull A local max of a concave function on a convex feasible region is also a global max
bull A local min of a convex function on a convex feasible region is also a global min
bull Strict convexity or concavity implies that the global optimum isunique
bull Given this we can efficiently solve ndashMaximization Problems with a concave obje
ctive function and linear constraints ndashMinimization Problems with a convex object
ive function and linear constraints
17
Where is the optimal solution
Note the optimal solution is not at a corner pointIt is where the isocontour first hits the feasible region
18
Another example
X
Minimize(x-8)2+ (y-8)2
Then the global unconstrained minimum
is also feasible
The optimal solution is not on the boundary of the feasible region
19
Finding a local maximum using Fibonacci Search
Where the maximum may be
Length of search Interval 3
20
The search finds a local maximum but not necessarily a global maximum
21
Approximating a non-linear function of 1 variable the λmethody
Choose different values of xto
approximate the x-axis
Approximate using piecewise linear
segments
22
More on theλmethody
Suppose that for ndash3 lex le-1
Then we approximate f(x) as λ1(-20) + λ2(-7 13)
we represent x has λ1(-3) + λ2(-1) where λ1 + λ2= 1 and λ1 λ2ge0
23
Approximating a non-linear objective function for a minimization NLP
original problem minimize Suppose that where
bull Approximate f(y) minimize
ndash Note when given a choice of representing y in alternative ways the LP will choose one that leads to the least objective value for the approximation
24
For minimizing a convex function the λ-method automatically satisfies the
additional adjacency property
+ adjacency condition+ other constraints
25
Dynamic programming
bull Suppose that there are 50 matches on a table and the person who picks up the last match wins At each alternating turn my opponent or I can pick up 1 2 or 6 matches Assuming that I go first how can I be sure of winning the game
26
Determining the strategy using DP
bull n = number of matches left (n is the statestage) bull g(n) = 1 if you can force a win at n matches g(n) = 0 otherwise g(n) = optimal value functionAt each statestage you can make one of three decision
s take 1 2 or 6 matchesbull g(1) = g(2) = g(6) = 1 (boundary conditions)bull g(3) = 0 g(4) = g(5) = 1 (why)The recursionbull g(n) = 1 if g(n-1) = 0 or g(n-2) = 0 or g(n-6) = 0 g(n) = 0 otherwisebull Equivalently g(n) = 1 ndashmin (g(n-1) g(n-2) g(n-6))
27
Dynamic Programming in General
bull Break up a complex decision problem into a sequence of smaller decision subproblems
bull Stages one solves decision problems one ldquostagerdquo at a time Stages often can be thought of as ldquotimerdquo in most instances ndash Not every DP has stagesndash The previous shortest path problem has 6 stagesndash The match problem does not have stages
28
Dynamic Programming in General
bull States The smaller decision subproblemsare often expressed in a very compact manner The description of the smaller subproblemsis often referred to as the state ndash match problem ldquostaterdquo is the number of matches
leftbull At each state-stage there are one or more de
cisions The DP recursion determines the best decision ndash match problem how many matches to removendash shortest path example go right and up or else go
down and right
29
Optimal Capacity Expansion What is the least cost way of building plants
Cost of $15 million in any year in which a plant is built At most 3 plants a year can be built
Cum DemandCost per plant in $millions
30
Finding a topological order
Find a node with no incoming arc Label it node 1For i = 2 to n find a node with no incoming arc from an unlabeled node Label it node i
31
Find d(j) using a recursion
d(j) is the shortest length of a path from node 1 to node j
Let cij = length of arc (ij)
What is d(j) computed in terms of d(1) hellip d(j-1)
Compute f(2) hellip f(8)Example d(4) = min 3 + d(2) 2 + d(3)
32
Finding optimal paragraph layouts
bull Tex optimally decomposes paragraphs by selecting the breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
bull Tex optimally decomposes paragraphs by select-ingthe breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
5
Topics through midterm 2
bull Linear programming ndashFormulations ndashGeometry ndashThe simplex algorithm ndashSensitivity Analysis ndashDuality Theorybull Network Optimizationbull Integer programming ndashformulations ndashBampB ndashCutting planes
6
Topics covered in the Final Exam
bull Linear Programming Formulations
bull Integer Programming Formulations
bull Nonlinear Programming
bull Dynamic Programming
bull Heuristics
7
Rest of this lecture
bull A very brief overview of the topics covered since the 2ndmidterm
bull Slides drawn from lectures
bull If you have questions about the topics covered ask them as I go along
bull I need to reserve time at the end for Sloan course evaluations
8
What is a non-linear program
bull maximize
Subject to
bull A non-linear program is permitted to have non-linear constraints or objectives
bull A linear program is a special case of non-linear programming
9
Portfolio Selection Example
bull When trying to design a financial portfolio investors seek to simultaneously minimize risk and maximize return
bull Risk is often measured as the variance of the total return a nonlinear function
bull FACT
10
Portfolio Selection (contrsquod)
bull Two Methods are commonly used ndashMin Risk st Expected Return geBound ndashMax Expected Return -θ (Risk) where θreflects the tradeoff between r
eturn and risk
11
Regression and estimating βReturn on Stock A vs Market Return
The value βis the slope of the regression line Here it is around 6 (lower expected gain than the market and lower risk)
12
Local vs Global Optima
Defrsquon Let xbe a feasible solution then
ndashxis a global max_if f(x) gef(y) for every feasible y
ndashxis a local max_if f(x) ge f(y) for every feasible ysufficiently close to x(ie xj-ε le yjlexj+ εfor all jand some small ε)
There may be several locally optimal solutions
13
Convex Functions
Convex Functions
f(λy + (1-λ)z) le λf(y) + (1-λ)f(z)
for every yand zand for 0le λ le1
eg f((y+z)2) le f(y)2 + f(z)2
We say ldquostrictrdquo convexity if sign is ldquoltrdquo for 0lt λ lt1
Line joining any pointsIs above the curve
14
Concave Functions
Concave Functions f(λy + (1-λ)z) ge λf(y) + (1-λ)f(z)
for every yand zand for 0le λ le1
eg f((y+z)2) ge f(y)2 + f(z)2
We say ldquostrictrdquo convexity if sign is ldquogtrdquo for 0lt λ lt1
15
Convexity and Extreme Pointsxy
We say that a set Sis convex if for every two points xand yin S and for every real number λin [01] λx + (1-λ)y εS
The feasible region of a linear program is convex
We say that an element w εSis an extreme point(vertexcorner point) if wis not the midpoint of any line segment contained in S
16
Local Maximum (Minimum) Property
bull A local max of a concave function on a convex feasible region is also a global max
bull A local min of a convex function on a convex feasible region is also a global min
bull Strict convexity or concavity implies that the global optimum isunique
bull Given this we can efficiently solve ndashMaximization Problems with a concave obje
ctive function and linear constraints ndashMinimization Problems with a convex object
ive function and linear constraints
17
Where is the optimal solution
Note the optimal solution is not at a corner pointIt is where the isocontour first hits the feasible region
18
Another example
X
Minimize(x-8)2+ (y-8)2
Then the global unconstrained minimum
is also feasible
The optimal solution is not on the boundary of the feasible region
19
Finding a local maximum using Fibonacci Search
Where the maximum may be
Length of search Interval 3
20
The search finds a local maximum but not necessarily a global maximum
21
Approximating a non-linear function of 1 variable the λmethody
Choose different values of xto
approximate the x-axis
Approximate using piecewise linear
segments
22
More on theλmethody
Suppose that for ndash3 lex le-1
Then we approximate f(x) as λ1(-20) + λ2(-7 13)
we represent x has λ1(-3) + λ2(-1) where λ1 + λ2= 1 and λ1 λ2ge0
23
Approximating a non-linear objective function for a minimization NLP
original problem minimize Suppose that where
bull Approximate f(y) minimize
ndash Note when given a choice of representing y in alternative ways the LP will choose one that leads to the least objective value for the approximation
24
For minimizing a convex function the λ-method automatically satisfies the
additional adjacency property
+ adjacency condition+ other constraints
25
Dynamic programming
bull Suppose that there are 50 matches on a table and the person who picks up the last match wins At each alternating turn my opponent or I can pick up 1 2 or 6 matches Assuming that I go first how can I be sure of winning the game
26
Determining the strategy using DP
bull n = number of matches left (n is the statestage) bull g(n) = 1 if you can force a win at n matches g(n) = 0 otherwise g(n) = optimal value functionAt each statestage you can make one of three decision
s take 1 2 or 6 matchesbull g(1) = g(2) = g(6) = 1 (boundary conditions)bull g(3) = 0 g(4) = g(5) = 1 (why)The recursionbull g(n) = 1 if g(n-1) = 0 or g(n-2) = 0 or g(n-6) = 0 g(n) = 0 otherwisebull Equivalently g(n) = 1 ndashmin (g(n-1) g(n-2) g(n-6))
27
Dynamic Programming in General
bull Break up a complex decision problem into a sequence of smaller decision subproblems
bull Stages one solves decision problems one ldquostagerdquo at a time Stages often can be thought of as ldquotimerdquo in most instances ndash Not every DP has stagesndash The previous shortest path problem has 6 stagesndash The match problem does not have stages
28
Dynamic Programming in General
bull States The smaller decision subproblemsare often expressed in a very compact manner The description of the smaller subproblemsis often referred to as the state ndash match problem ldquostaterdquo is the number of matches
leftbull At each state-stage there are one or more de
cisions The DP recursion determines the best decision ndash match problem how many matches to removendash shortest path example go right and up or else go
down and right
29
Optimal Capacity Expansion What is the least cost way of building plants
Cost of $15 million in any year in which a plant is built At most 3 plants a year can be built
Cum DemandCost per plant in $millions
30
Finding a topological order
Find a node with no incoming arc Label it node 1For i = 2 to n find a node with no incoming arc from an unlabeled node Label it node i
31
Find d(j) using a recursion
d(j) is the shortest length of a path from node 1 to node j
Let cij = length of arc (ij)
What is d(j) computed in terms of d(1) hellip d(j-1)
Compute f(2) hellip f(8)Example d(4) = min 3 + d(2) 2 + d(3)
32
Finding optimal paragraph layouts
bull Tex optimally decomposes paragraphs by selecting the breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
bull Tex optimally decomposes paragraphs by select-ingthe breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
6
Topics covered in the Final Exam
bull Linear Programming Formulations
bull Integer Programming Formulations
bull Nonlinear Programming
bull Dynamic Programming
bull Heuristics
7
Rest of this lecture
bull A very brief overview of the topics covered since the 2ndmidterm
bull Slides drawn from lectures
bull If you have questions about the topics covered ask them as I go along
bull I need to reserve time at the end for Sloan course evaluations
8
What is a non-linear program
bull maximize
Subject to
bull A non-linear program is permitted to have non-linear constraints or objectives
bull A linear program is a special case of non-linear programming
9
Portfolio Selection Example
bull When trying to design a financial portfolio investors seek to simultaneously minimize risk and maximize return
bull Risk is often measured as the variance of the total return a nonlinear function
bull FACT
10
Portfolio Selection (contrsquod)
bull Two Methods are commonly used ndashMin Risk st Expected Return geBound ndashMax Expected Return -θ (Risk) where θreflects the tradeoff between r
eturn and risk
11
Regression and estimating βReturn on Stock A vs Market Return
The value βis the slope of the regression line Here it is around 6 (lower expected gain than the market and lower risk)
12
Local vs Global Optima
Defrsquon Let xbe a feasible solution then
ndashxis a global max_if f(x) gef(y) for every feasible y
ndashxis a local max_if f(x) ge f(y) for every feasible ysufficiently close to x(ie xj-ε le yjlexj+ εfor all jand some small ε)
There may be several locally optimal solutions
13
Convex Functions
Convex Functions
f(λy + (1-λ)z) le λf(y) + (1-λ)f(z)
for every yand zand for 0le λ le1
eg f((y+z)2) le f(y)2 + f(z)2
We say ldquostrictrdquo convexity if sign is ldquoltrdquo for 0lt λ lt1
Line joining any pointsIs above the curve
14
Concave Functions
Concave Functions f(λy + (1-λ)z) ge λf(y) + (1-λ)f(z)
for every yand zand for 0le λ le1
eg f((y+z)2) ge f(y)2 + f(z)2
We say ldquostrictrdquo convexity if sign is ldquogtrdquo for 0lt λ lt1
15
Convexity and Extreme Pointsxy
We say that a set Sis convex if for every two points xand yin S and for every real number λin [01] λx + (1-λ)y εS
The feasible region of a linear program is convex
We say that an element w εSis an extreme point(vertexcorner point) if wis not the midpoint of any line segment contained in S
16
Local Maximum (Minimum) Property
bull A local max of a concave function on a convex feasible region is also a global max
bull A local min of a convex function on a convex feasible region is also a global min
bull Strict convexity or concavity implies that the global optimum isunique
bull Given this we can efficiently solve ndashMaximization Problems with a concave obje
ctive function and linear constraints ndashMinimization Problems with a convex object
ive function and linear constraints
17
Where is the optimal solution
Note the optimal solution is not at a corner pointIt is where the isocontour first hits the feasible region
18
Another example
X
Minimize(x-8)2+ (y-8)2
Then the global unconstrained minimum
is also feasible
The optimal solution is not on the boundary of the feasible region
19
Finding a local maximum using Fibonacci Search
Where the maximum may be
Length of search Interval 3
20
The search finds a local maximum but not necessarily a global maximum
21
Approximating a non-linear function of 1 variable the λmethody
Choose different values of xto
approximate the x-axis
Approximate using piecewise linear
segments
22
More on theλmethody
Suppose that for ndash3 lex le-1
Then we approximate f(x) as λ1(-20) + λ2(-7 13)
we represent x has λ1(-3) + λ2(-1) where λ1 + λ2= 1 and λ1 λ2ge0
23
Approximating a non-linear objective function for a minimization NLP
original problem minimize Suppose that where
bull Approximate f(y) minimize
ndash Note when given a choice of representing y in alternative ways the LP will choose one that leads to the least objective value for the approximation
24
For minimizing a convex function the λ-method automatically satisfies the
additional adjacency property
+ adjacency condition+ other constraints
25
Dynamic programming
bull Suppose that there are 50 matches on a table and the person who picks up the last match wins At each alternating turn my opponent or I can pick up 1 2 or 6 matches Assuming that I go first how can I be sure of winning the game
26
Determining the strategy using DP
bull n = number of matches left (n is the statestage) bull g(n) = 1 if you can force a win at n matches g(n) = 0 otherwise g(n) = optimal value functionAt each statestage you can make one of three decision
s take 1 2 or 6 matchesbull g(1) = g(2) = g(6) = 1 (boundary conditions)bull g(3) = 0 g(4) = g(5) = 1 (why)The recursionbull g(n) = 1 if g(n-1) = 0 or g(n-2) = 0 or g(n-6) = 0 g(n) = 0 otherwisebull Equivalently g(n) = 1 ndashmin (g(n-1) g(n-2) g(n-6))
27
Dynamic Programming in General
bull Break up a complex decision problem into a sequence of smaller decision subproblems
bull Stages one solves decision problems one ldquostagerdquo at a time Stages often can be thought of as ldquotimerdquo in most instances ndash Not every DP has stagesndash The previous shortest path problem has 6 stagesndash The match problem does not have stages
28
Dynamic Programming in General
bull States The smaller decision subproblemsare often expressed in a very compact manner The description of the smaller subproblemsis often referred to as the state ndash match problem ldquostaterdquo is the number of matches
leftbull At each state-stage there are one or more de
cisions The DP recursion determines the best decision ndash match problem how many matches to removendash shortest path example go right and up or else go
down and right
29
Optimal Capacity Expansion What is the least cost way of building plants
Cost of $15 million in any year in which a plant is built At most 3 plants a year can be built
Cum DemandCost per plant in $millions
30
Finding a topological order
Find a node with no incoming arc Label it node 1For i = 2 to n find a node with no incoming arc from an unlabeled node Label it node i
31
Find d(j) using a recursion
d(j) is the shortest length of a path from node 1 to node j
Let cij = length of arc (ij)
What is d(j) computed in terms of d(1) hellip d(j-1)
Compute f(2) hellip f(8)Example d(4) = min 3 + d(2) 2 + d(3)
32
Finding optimal paragraph layouts
bull Tex optimally decomposes paragraphs by selecting the breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
bull Tex optimally decomposes paragraphs by select-ingthe breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
7
Rest of this lecture
bull A very brief overview of the topics covered since the 2ndmidterm
bull Slides drawn from lectures
bull If you have questions about the topics covered ask them as I go along
bull I need to reserve time at the end for Sloan course evaluations
8
What is a non-linear program
bull maximize
Subject to
bull A non-linear program is permitted to have non-linear constraints or objectives
bull A linear program is a special case of non-linear programming
9
Portfolio Selection Example
bull When trying to design a financial portfolio investors seek to simultaneously minimize risk and maximize return
bull Risk is often measured as the variance of the total return a nonlinear function
bull FACT
10
Portfolio Selection (contrsquod)
bull Two Methods are commonly used ndashMin Risk st Expected Return geBound ndashMax Expected Return -θ (Risk) where θreflects the tradeoff between r
eturn and risk
11
Regression and estimating βReturn on Stock A vs Market Return
The value βis the slope of the regression line Here it is around 6 (lower expected gain than the market and lower risk)
12
Local vs Global Optima
Defrsquon Let xbe a feasible solution then
ndashxis a global max_if f(x) gef(y) for every feasible y
ndashxis a local max_if f(x) ge f(y) for every feasible ysufficiently close to x(ie xj-ε le yjlexj+ εfor all jand some small ε)
There may be several locally optimal solutions
13
Convex Functions
Convex Functions
f(λy + (1-λ)z) le λf(y) + (1-λ)f(z)
for every yand zand for 0le λ le1
eg f((y+z)2) le f(y)2 + f(z)2
We say ldquostrictrdquo convexity if sign is ldquoltrdquo for 0lt λ lt1
Line joining any pointsIs above the curve
14
Concave Functions
Concave Functions f(λy + (1-λ)z) ge λf(y) + (1-λ)f(z)
for every yand zand for 0le λ le1
eg f((y+z)2) ge f(y)2 + f(z)2
We say ldquostrictrdquo convexity if sign is ldquogtrdquo for 0lt λ lt1
15
Convexity and Extreme Pointsxy
We say that a set Sis convex if for every two points xand yin S and for every real number λin [01] λx + (1-λ)y εS
The feasible region of a linear program is convex
We say that an element w εSis an extreme point(vertexcorner point) if wis not the midpoint of any line segment contained in S
16
Local Maximum (Minimum) Property
bull A local max of a concave function on a convex feasible region is also a global max
bull A local min of a convex function on a convex feasible region is also a global min
bull Strict convexity or concavity implies that the global optimum isunique
bull Given this we can efficiently solve ndashMaximization Problems with a concave obje
ctive function and linear constraints ndashMinimization Problems with a convex object
ive function and linear constraints
17
Where is the optimal solution
Note the optimal solution is not at a corner pointIt is where the isocontour first hits the feasible region
18
Another example
X
Minimize(x-8)2+ (y-8)2
Then the global unconstrained minimum
is also feasible
The optimal solution is not on the boundary of the feasible region
19
Finding a local maximum using Fibonacci Search
Where the maximum may be
Length of search Interval 3
20
The search finds a local maximum but not necessarily a global maximum
21
Approximating a non-linear function of 1 variable the λmethody
Choose different values of xto
approximate the x-axis
Approximate using piecewise linear
segments
22
More on theλmethody
Suppose that for ndash3 lex le-1
Then we approximate f(x) as λ1(-20) + λ2(-7 13)
we represent x has λ1(-3) + λ2(-1) where λ1 + λ2= 1 and λ1 λ2ge0
23
Approximating a non-linear objective function for a minimization NLP
original problem minimize Suppose that where
bull Approximate f(y) minimize
ndash Note when given a choice of representing y in alternative ways the LP will choose one that leads to the least objective value for the approximation
24
For minimizing a convex function the λ-method automatically satisfies the
additional adjacency property
+ adjacency condition+ other constraints
25
Dynamic programming
bull Suppose that there are 50 matches on a table and the person who picks up the last match wins At each alternating turn my opponent or I can pick up 1 2 or 6 matches Assuming that I go first how can I be sure of winning the game
26
Determining the strategy using DP
bull n = number of matches left (n is the statestage) bull g(n) = 1 if you can force a win at n matches g(n) = 0 otherwise g(n) = optimal value functionAt each statestage you can make one of three decision
s take 1 2 or 6 matchesbull g(1) = g(2) = g(6) = 1 (boundary conditions)bull g(3) = 0 g(4) = g(5) = 1 (why)The recursionbull g(n) = 1 if g(n-1) = 0 or g(n-2) = 0 or g(n-6) = 0 g(n) = 0 otherwisebull Equivalently g(n) = 1 ndashmin (g(n-1) g(n-2) g(n-6))
27
Dynamic Programming in General
bull Break up a complex decision problem into a sequence of smaller decision subproblems
bull Stages one solves decision problems one ldquostagerdquo at a time Stages often can be thought of as ldquotimerdquo in most instances ndash Not every DP has stagesndash The previous shortest path problem has 6 stagesndash The match problem does not have stages
28
Dynamic Programming in General
bull States The smaller decision subproblemsare often expressed in a very compact manner The description of the smaller subproblemsis often referred to as the state ndash match problem ldquostaterdquo is the number of matches
leftbull At each state-stage there are one or more de
cisions The DP recursion determines the best decision ndash match problem how many matches to removendash shortest path example go right and up or else go
down and right
29
Optimal Capacity Expansion What is the least cost way of building plants
Cost of $15 million in any year in which a plant is built At most 3 plants a year can be built
Cum DemandCost per plant in $millions
30
Finding a topological order
Find a node with no incoming arc Label it node 1For i = 2 to n find a node with no incoming arc from an unlabeled node Label it node i
31
Find d(j) using a recursion
d(j) is the shortest length of a path from node 1 to node j
Let cij = length of arc (ij)
What is d(j) computed in terms of d(1) hellip d(j-1)
Compute f(2) hellip f(8)Example d(4) = min 3 + d(2) 2 + d(3)
32
Finding optimal paragraph layouts
bull Tex optimally decomposes paragraphs by selecting the breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
bull Tex optimally decomposes paragraphs by select-ingthe breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
8
What is a non-linear program
bull maximize
Subject to
bull A non-linear program is permitted to have non-linear constraints or objectives
bull A linear program is a special case of non-linear programming
9
Portfolio Selection Example
bull When trying to design a financial portfolio investors seek to simultaneously minimize risk and maximize return
bull Risk is often measured as the variance of the total return a nonlinear function
bull FACT
10
Portfolio Selection (contrsquod)
bull Two Methods are commonly used ndashMin Risk st Expected Return geBound ndashMax Expected Return -θ (Risk) where θreflects the tradeoff between r
eturn and risk
11
Regression and estimating βReturn on Stock A vs Market Return
The value βis the slope of the regression line Here it is around 6 (lower expected gain than the market and lower risk)
12
Local vs Global Optima
Defrsquon Let xbe a feasible solution then
ndashxis a global max_if f(x) gef(y) for every feasible y
ndashxis a local max_if f(x) ge f(y) for every feasible ysufficiently close to x(ie xj-ε le yjlexj+ εfor all jand some small ε)
There may be several locally optimal solutions
13
Convex Functions
Convex Functions
f(λy + (1-λ)z) le λf(y) + (1-λ)f(z)
for every yand zand for 0le λ le1
eg f((y+z)2) le f(y)2 + f(z)2
We say ldquostrictrdquo convexity if sign is ldquoltrdquo for 0lt λ lt1
Line joining any pointsIs above the curve
14
Concave Functions
Concave Functions f(λy + (1-λ)z) ge λf(y) + (1-λ)f(z)
for every yand zand for 0le λ le1
eg f((y+z)2) ge f(y)2 + f(z)2
We say ldquostrictrdquo convexity if sign is ldquogtrdquo for 0lt λ lt1
15
Convexity and Extreme Pointsxy
We say that a set Sis convex if for every two points xand yin S and for every real number λin [01] λx + (1-λ)y εS
The feasible region of a linear program is convex
We say that an element w εSis an extreme point(vertexcorner point) if wis not the midpoint of any line segment contained in S
16
Local Maximum (Minimum) Property
bull A local max of a concave function on a convex feasible region is also a global max
bull A local min of a convex function on a convex feasible region is also a global min
bull Strict convexity or concavity implies that the global optimum isunique
bull Given this we can efficiently solve ndashMaximization Problems with a concave obje
ctive function and linear constraints ndashMinimization Problems with a convex object
ive function and linear constraints
17
Where is the optimal solution
Note the optimal solution is not at a corner pointIt is where the isocontour first hits the feasible region
18
Another example
X
Minimize(x-8)2+ (y-8)2
Then the global unconstrained minimum
is also feasible
The optimal solution is not on the boundary of the feasible region
19
Finding a local maximum using Fibonacci Search
Where the maximum may be
Length of search Interval 3
20
The search finds a local maximum but not necessarily a global maximum
21
Approximating a non-linear function of 1 variable the λmethody
Choose different values of xto
approximate the x-axis
Approximate using piecewise linear
segments
22
More on theλmethody
Suppose that for ndash3 lex le-1
Then we approximate f(x) as λ1(-20) + λ2(-7 13)
we represent x has λ1(-3) + λ2(-1) where λ1 + λ2= 1 and λ1 λ2ge0
23
Approximating a non-linear objective function for a minimization NLP
original problem minimize Suppose that where
bull Approximate f(y) minimize
ndash Note when given a choice of representing y in alternative ways the LP will choose one that leads to the least objective value for the approximation
24
For minimizing a convex function the λ-method automatically satisfies the
additional adjacency property
+ adjacency condition+ other constraints
25
Dynamic programming
bull Suppose that there are 50 matches on a table and the person who picks up the last match wins At each alternating turn my opponent or I can pick up 1 2 or 6 matches Assuming that I go first how can I be sure of winning the game
26
Determining the strategy using DP
bull n = number of matches left (n is the statestage) bull g(n) = 1 if you can force a win at n matches g(n) = 0 otherwise g(n) = optimal value functionAt each statestage you can make one of three decision
s take 1 2 or 6 matchesbull g(1) = g(2) = g(6) = 1 (boundary conditions)bull g(3) = 0 g(4) = g(5) = 1 (why)The recursionbull g(n) = 1 if g(n-1) = 0 or g(n-2) = 0 or g(n-6) = 0 g(n) = 0 otherwisebull Equivalently g(n) = 1 ndashmin (g(n-1) g(n-2) g(n-6))
27
Dynamic Programming in General
bull Break up a complex decision problem into a sequence of smaller decision subproblems
bull Stages one solves decision problems one ldquostagerdquo at a time Stages often can be thought of as ldquotimerdquo in most instances ndash Not every DP has stagesndash The previous shortest path problem has 6 stagesndash The match problem does not have stages
28
Dynamic Programming in General
bull States The smaller decision subproblemsare often expressed in a very compact manner The description of the smaller subproblemsis often referred to as the state ndash match problem ldquostaterdquo is the number of matches
leftbull At each state-stage there are one or more de
cisions The DP recursion determines the best decision ndash match problem how many matches to removendash shortest path example go right and up or else go
down and right
29
Optimal Capacity Expansion What is the least cost way of building plants
Cost of $15 million in any year in which a plant is built At most 3 plants a year can be built
Cum DemandCost per plant in $millions
30
Finding a topological order
Find a node with no incoming arc Label it node 1For i = 2 to n find a node with no incoming arc from an unlabeled node Label it node i
31
Find d(j) using a recursion
d(j) is the shortest length of a path from node 1 to node j
Let cij = length of arc (ij)
What is d(j) computed in terms of d(1) hellip d(j-1)
Compute f(2) hellip f(8)Example d(4) = min 3 + d(2) 2 + d(3)
32
Finding optimal paragraph layouts
bull Tex optimally decomposes paragraphs by selecting the breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
bull Tex optimally decomposes paragraphs by select-ingthe breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
9
Portfolio Selection Example
bull When trying to design a financial portfolio investors seek to simultaneously minimize risk and maximize return
bull Risk is often measured as the variance of the total return a nonlinear function
bull FACT
10
Portfolio Selection (contrsquod)
bull Two Methods are commonly used ndashMin Risk st Expected Return geBound ndashMax Expected Return -θ (Risk) where θreflects the tradeoff between r
eturn and risk
11
Regression and estimating βReturn on Stock A vs Market Return
The value βis the slope of the regression line Here it is around 6 (lower expected gain than the market and lower risk)
12
Local vs Global Optima
Defrsquon Let xbe a feasible solution then
ndashxis a global max_if f(x) gef(y) for every feasible y
ndashxis a local max_if f(x) ge f(y) for every feasible ysufficiently close to x(ie xj-ε le yjlexj+ εfor all jand some small ε)
There may be several locally optimal solutions
13
Convex Functions
Convex Functions
f(λy + (1-λ)z) le λf(y) + (1-λ)f(z)
for every yand zand for 0le λ le1
eg f((y+z)2) le f(y)2 + f(z)2
We say ldquostrictrdquo convexity if sign is ldquoltrdquo for 0lt λ lt1
Line joining any pointsIs above the curve
14
Concave Functions
Concave Functions f(λy + (1-λ)z) ge λf(y) + (1-λ)f(z)
for every yand zand for 0le λ le1
eg f((y+z)2) ge f(y)2 + f(z)2
We say ldquostrictrdquo convexity if sign is ldquogtrdquo for 0lt λ lt1
15
Convexity and Extreme Pointsxy
We say that a set Sis convex if for every two points xand yin S and for every real number λin [01] λx + (1-λ)y εS
The feasible region of a linear program is convex
We say that an element w εSis an extreme point(vertexcorner point) if wis not the midpoint of any line segment contained in S
16
Local Maximum (Minimum) Property
bull A local max of a concave function on a convex feasible region is also a global max
bull A local min of a convex function on a convex feasible region is also a global min
bull Strict convexity or concavity implies that the global optimum isunique
bull Given this we can efficiently solve ndashMaximization Problems with a concave obje
ctive function and linear constraints ndashMinimization Problems with a convex object
ive function and linear constraints
17
Where is the optimal solution
Note the optimal solution is not at a corner pointIt is where the isocontour first hits the feasible region
18
Another example
X
Minimize(x-8)2+ (y-8)2
Then the global unconstrained minimum
is also feasible
The optimal solution is not on the boundary of the feasible region
19
Finding a local maximum using Fibonacci Search
Where the maximum may be
Length of search Interval 3
20
The search finds a local maximum but not necessarily a global maximum
21
Approximating a non-linear function of 1 variable the λmethody
Choose different values of xto
approximate the x-axis
Approximate using piecewise linear
segments
22
More on theλmethody
Suppose that for ndash3 lex le-1
Then we approximate f(x) as λ1(-20) + λ2(-7 13)
we represent x has λ1(-3) + λ2(-1) where λ1 + λ2= 1 and λ1 λ2ge0
23
Approximating a non-linear objective function for a minimization NLP
original problem minimize Suppose that where
bull Approximate f(y) minimize
ndash Note when given a choice of representing y in alternative ways the LP will choose one that leads to the least objective value for the approximation
24
For minimizing a convex function the λ-method automatically satisfies the
additional adjacency property
+ adjacency condition+ other constraints
25
Dynamic programming
bull Suppose that there are 50 matches on a table and the person who picks up the last match wins At each alternating turn my opponent or I can pick up 1 2 or 6 matches Assuming that I go first how can I be sure of winning the game
26
Determining the strategy using DP
bull n = number of matches left (n is the statestage) bull g(n) = 1 if you can force a win at n matches g(n) = 0 otherwise g(n) = optimal value functionAt each statestage you can make one of three decision
s take 1 2 or 6 matchesbull g(1) = g(2) = g(6) = 1 (boundary conditions)bull g(3) = 0 g(4) = g(5) = 1 (why)The recursionbull g(n) = 1 if g(n-1) = 0 or g(n-2) = 0 or g(n-6) = 0 g(n) = 0 otherwisebull Equivalently g(n) = 1 ndashmin (g(n-1) g(n-2) g(n-6))
27
Dynamic Programming in General
bull Break up a complex decision problem into a sequence of smaller decision subproblems
bull Stages one solves decision problems one ldquostagerdquo at a time Stages often can be thought of as ldquotimerdquo in most instances ndash Not every DP has stagesndash The previous shortest path problem has 6 stagesndash The match problem does not have stages
28
Dynamic Programming in General
bull States The smaller decision subproblemsare often expressed in a very compact manner The description of the smaller subproblemsis often referred to as the state ndash match problem ldquostaterdquo is the number of matches
leftbull At each state-stage there are one or more de
cisions The DP recursion determines the best decision ndash match problem how many matches to removendash shortest path example go right and up or else go
down and right
29
Optimal Capacity Expansion What is the least cost way of building plants
Cost of $15 million in any year in which a plant is built At most 3 plants a year can be built
Cum DemandCost per plant in $millions
30
Finding a topological order
Find a node with no incoming arc Label it node 1For i = 2 to n find a node with no incoming arc from an unlabeled node Label it node i
31
Find d(j) using a recursion
d(j) is the shortest length of a path from node 1 to node j
Let cij = length of arc (ij)
What is d(j) computed in terms of d(1) hellip d(j-1)
Compute f(2) hellip f(8)Example d(4) = min 3 + d(2) 2 + d(3)
32
Finding optimal paragraph layouts
bull Tex optimally decomposes paragraphs by selecting the breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
bull Tex optimally decomposes paragraphs by select-ingthe breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
10
Portfolio Selection (contrsquod)
bull Two Methods are commonly used ndashMin Risk st Expected Return geBound ndashMax Expected Return -θ (Risk) where θreflects the tradeoff between r
eturn and risk
11
Regression and estimating βReturn on Stock A vs Market Return
The value βis the slope of the regression line Here it is around 6 (lower expected gain than the market and lower risk)
12
Local vs Global Optima
Defrsquon Let xbe a feasible solution then
ndashxis a global max_if f(x) gef(y) for every feasible y
ndashxis a local max_if f(x) ge f(y) for every feasible ysufficiently close to x(ie xj-ε le yjlexj+ εfor all jand some small ε)
There may be several locally optimal solutions
13
Convex Functions
Convex Functions
f(λy + (1-λ)z) le λf(y) + (1-λ)f(z)
for every yand zand for 0le λ le1
eg f((y+z)2) le f(y)2 + f(z)2
We say ldquostrictrdquo convexity if sign is ldquoltrdquo for 0lt λ lt1
Line joining any pointsIs above the curve
14
Concave Functions
Concave Functions f(λy + (1-λ)z) ge λf(y) + (1-λ)f(z)
for every yand zand for 0le λ le1
eg f((y+z)2) ge f(y)2 + f(z)2
We say ldquostrictrdquo convexity if sign is ldquogtrdquo for 0lt λ lt1
15
Convexity and Extreme Pointsxy
We say that a set Sis convex if for every two points xand yin S and for every real number λin [01] λx + (1-λ)y εS
The feasible region of a linear program is convex
We say that an element w εSis an extreme point(vertexcorner point) if wis not the midpoint of any line segment contained in S
16
Local Maximum (Minimum) Property
bull A local max of a concave function on a convex feasible region is also a global max
bull A local min of a convex function on a convex feasible region is also a global min
bull Strict convexity or concavity implies that the global optimum isunique
bull Given this we can efficiently solve ndashMaximization Problems with a concave obje
ctive function and linear constraints ndashMinimization Problems with a convex object
ive function and linear constraints
17
Where is the optimal solution
Note the optimal solution is not at a corner pointIt is where the isocontour first hits the feasible region
18
Another example
X
Minimize(x-8)2+ (y-8)2
Then the global unconstrained minimum
is also feasible
The optimal solution is not on the boundary of the feasible region
19
Finding a local maximum using Fibonacci Search
Where the maximum may be
Length of search Interval 3
20
The search finds a local maximum but not necessarily a global maximum
21
Approximating a non-linear function of 1 variable the λmethody
Choose different values of xto
approximate the x-axis
Approximate using piecewise linear
segments
22
More on theλmethody
Suppose that for ndash3 lex le-1
Then we approximate f(x) as λ1(-20) + λ2(-7 13)
we represent x has λ1(-3) + λ2(-1) where λ1 + λ2= 1 and λ1 λ2ge0
23
Approximating a non-linear objective function for a minimization NLP
original problem minimize Suppose that where
bull Approximate f(y) minimize
ndash Note when given a choice of representing y in alternative ways the LP will choose one that leads to the least objective value for the approximation
24
For minimizing a convex function the λ-method automatically satisfies the
additional adjacency property
+ adjacency condition+ other constraints
25
Dynamic programming
bull Suppose that there are 50 matches on a table and the person who picks up the last match wins At each alternating turn my opponent or I can pick up 1 2 or 6 matches Assuming that I go first how can I be sure of winning the game
26
Determining the strategy using DP
bull n = number of matches left (n is the statestage) bull g(n) = 1 if you can force a win at n matches g(n) = 0 otherwise g(n) = optimal value functionAt each statestage you can make one of three decision
s take 1 2 or 6 matchesbull g(1) = g(2) = g(6) = 1 (boundary conditions)bull g(3) = 0 g(4) = g(5) = 1 (why)The recursionbull g(n) = 1 if g(n-1) = 0 or g(n-2) = 0 or g(n-6) = 0 g(n) = 0 otherwisebull Equivalently g(n) = 1 ndashmin (g(n-1) g(n-2) g(n-6))
27
Dynamic Programming in General
bull Break up a complex decision problem into a sequence of smaller decision subproblems
bull Stages one solves decision problems one ldquostagerdquo at a time Stages often can be thought of as ldquotimerdquo in most instances ndash Not every DP has stagesndash The previous shortest path problem has 6 stagesndash The match problem does not have stages
28
Dynamic Programming in General
bull States The smaller decision subproblemsare often expressed in a very compact manner The description of the smaller subproblemsis often referred to as the state ndash match problem ldquostaterdquo is the number of matches
leftbull At each state-stage there are one or more de
cisions The DP recursion determines the best decision ndash match problem how many matches to removendash shortest path example go right and up or else go
down and right
29
Optimal Capacity Expansion What is the least cost way of building plants
Cost of $15 million in any year in which a plant is built At most 3 plants a year can be built
Cum DemandCost per plant in $millions
30
Finding a topological order
Find a node with no incoming arc Label it node 1For i = 2 to n find a node with no incoming arc from an unlabeled node Label it node i
31
Find d(j) using a recursion
d(j) is the shortest length of a path from node 1 to node j
Let cij = length of arc (ij)
What is d(j) computed in terms of d(1) hellip d(j-1)
Compute f(2) hellip f(8)Example d(4) = min 3 + d(2) 2 + d(3)
32
Finding optimal paragraph layouts
bull Tex optimally decomposes paragraphs by selecting the breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
bull Tex optimally decomposes paragraphs by select-ingthe breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
11
Regression and estimating βReturn on Stock A vs Market Return
The value βis the slope of the regression line Here it is around 6 (lower expected gain than the market and lower risk)
12
Local vs Global Optima
Defrsquon Let xbe a feasible solution then
ndashxis a global max_if f(x) gef(y) for every feasible y
ndashxis a local max_if f(x) ge f(y) for every feasible ysufficiently close to x(ie xj-ε le yjlexj+ εfor all jand some small ε)
There may be several locally optimal solutions
13
Convex Functions
Convex Functions
f(λy + (1-λ)z) le λf(y) + (1-λ)f(z)
for every yand zand for 0le λ le1
eg f((y+z)2) le f(y)2 + f(z)2
We say ldquostrictrdquo convexity if sign is ldquoltrdquo for 0lt λ lt1
Line joining any pointsIs above the curve
14
Concave Functions
Concave Functions f(λy + (1-λ)z) ge λf(y) + (1-λ)f(z)
for every yand zand for 0le λ le1
eg f((y+z)2) ge f(y)2 + f(z)2
We say ldquostrictrdquo convexity if sign is ldquogtrdquo for 0lt λ lt1
15
Convexity and Extreme Pointsxy
We say that a set Sis convex if for every two points xand yin S and for every real number λin [01] λx + (1-λ)y εS
The feasible region of a linear program is convex
We say that an element w εSis an extreme point(vertexcorner point) if wis not the midpoint of any line segment contained in S
16
Local Maximum (Minimum) Property
bull A local max of a concave function on a convex feasible region is also a global max
bull A local min of a convex function on a convex feasible region is also a global min
bull Strict convexity or concavity implies that the global optimum isunique
bull Given this we can efficiently solve ndashMaximization Problems with a concave obje
ctive function and linear constraints ndashMinimization Problems with a convex object
ive function and linear constraints
17
Where is the optimal solution
Note the optimal solution is not at a corner pointIt is where the isocontour first hits the feasible region
18
Another example
X
Minimize(x-8)2+ (y-8)2
Then the global unconstrained minimum
is also feasible
The optimal solution is not on the boundary of the feasible region
19
Finding a local maximum using Fibonacci Search
Where the maximum may be
Length of search Interval 3
20
The search finds a local maximum but not necessarily a global maximum
21
Approximating a non-linear function of 1 variable the λmethody
Choose different values of xto
approximate the x-axis
Approximate using piecewise linear
segments
22
More on theλmethody
Suppose that for ndash3 lex le-1
Then we approximate f(x) as λ1(-20) + λ2(-7 13)
we represent x has λ1(-3) + λ2(-1) where λ1 + λ2= 1 and λ1 λ2ge0
23
Approximating a non-linear objective function for a minimization NLP
original problem minimize Suppose that where
bull Approximate f(y) minimize
ndash Note when given a choice of representing y in alternative ways the LP will choose one that leads to the least objective value for the approximation
24
For minimizing a convex function the λ-method automatically satisfies the
additional adjacency property
+ adjacency condition+ other constraints
25
Dynamic programming
bull Suppose that there are 50 matches on a table and the person who picks up the last match wins At each alternating turn my opponent or I can pick up 1 2 or 6 matches Assuming that I go first how can I be sure of winning the game
26
Determining the strategy using DP
bull n = number of matches left (n is the statestage) bull g(n) = 1 if you can force a win at n matches g(n) = 0 otherwise g(n) = optimal value functionAt each statestage you can make one of three decision
s take 1 2 or 6 matchesbull g(1) = g(2) = g(6) = 1 (boundary conditions)bull g(3) = 0 g(4) = g(5) = 1 (why)The recursionbull g(n) = 1 if g(n-1) = 0 or g(n-2) = 0 or g(n-6) = 0 g(n) = 0 otherwisebull Equivalently g(n) = 1 ndashmin (g(n-1) g(n-2) g(n-6))
27
Dynamic Programming in General
bull Break up a complex decision problem into a sequence of smaller decision subproblems
bull Stages one solves decision problems one ldquostagerdquo at a time Stages often can be thought of as ldquotimerdquo in most instances ndash Not every DP has stagesndash The previous shortest path problem has 6 stagesndash The match problem does not have stages
28
Dynamic Programming in General
bull States The smaller decision subproblemsare often expressed in a very compact manner The description of the smaller subproblemsis often referred to as the state ndash match problem ldquostaterdquo is the number of matches
leftbull At each state-stage there are one or more de
cisions The DP recursion determines the best decision ndash match problem how many matches to removendash shortest path example go right and up or else go
down and right
29
Optimal Capacity Expansion What is the least cost way of building plants
Cost of $15 million in any year in which a plant is built At most 3 plants a year can be built
Cum DemandCost per plant in $millions
30
Finding a topological order
Find a node with no incoming arc Label it node 1For i = 2 to n find a node with no incoming arc from an unlabeled node Label it node i
31
Find d(j) using a recursion
d(j) is the shortest length of a path from node 1 to node j
Let cij = length of arc (ij)
What is d(j) computed in terms of d(1) hellip d(j-1)
Compute f(2) hellip f(8)Example d(4) = min 3 + d(2) 2 + d(3)
32
Finding optimal paragraph layouts
bull Tex optimally decomposes paragraphs by selecting the breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
bull Tex optimally decomposes paragraphs by select-ingthe breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
12
Local vs Global Optima
Defrsquon Let xbe a feasible solution then
ndashxis a global max_if f(x) gef(y) for every feasible y
ndashxis a local max_if f(x) ge f(y) for every feasible ysufficiently close to x(ie xj-ε le yjlexj+ εfor all jand some small ε)
There may be several locally optimal solutions
13
Convex Functions
Convex Functions
f(λy + (1-λ)z) le λf(y) + (1-λ)f(z)
for every yand zand for 0le λ le1
eg f((y+z)2) le f(y)2 + f(z)2
We say ldquostrictrdquo convexity if sign is ldquoltrdquo for 0lt λ lt1
Line joining any pointsIs above the curve
14
Concave Functions
Concave Functions f(λy + (1-λ)z) ge λf(y) + (1-λ)f(z)
for every yand zand for 0le λ le1
eg f((y+z)2) ge f(y)2 + f(z)2
We say ldquostrictrdquo convexity if sign is ldquogtrdquo for 0lt λ lt1
15
Convexity and Extreme Pointsxy
We say that a set Sis convex if for every two points xand yin S and for every real number λin [01] λx + (1-λ)y εS
The feasible region of a linear program is convex
We say that an element w εSis an extreme point(vertexcorner point) if wis not the midpoint of any line segment contained in S
16
Local Maximum (Minimum) Property
bull A local max of a concave function on a convex feasible region is also a global max
bull A local min of a convex function on a convex feasible region is also a global min
bull Strict convexity or concavity implies that the global optimum isunique
bull Given this we can efficiently solve ndashMaximization Problems with a concave obje
ctive function and linear constraints ndashMinimization Problems with a convex object
ive function and linear constraints
17
Where is the optimal solution
Note the optimal solution is not at a corner pointIt is where the isocontour first hits the feasible region
18
Another example
X
Minimize(x-8)2+ (y-8)2
Then the global unconstrained minimum
is also feasible
The optimal solution is not on the boundary of the feasible region
19
Finding a local maximum using Fibonacci Search
Where the maximum may be
Length of search Interval 3
20
The search finds a local maximum but not necessarily a global maximum
21
Approximating a non-linear function of 1 variable the λmethody
Choose different values of xto
approximate the x-axis
Approximate using piecewise linear
segments
22
More on theλmethody
Suppose that for ndash3 lex le-1
Then we approximate f(x) as λ1(-20) + λ2(-7 13)
we represent x has λ1(-3) + λ2(-1) where λ1 + λ2= 1 and λ1 λ2ge0
23
Approximating a non-linear objective function for a minimization NLP
original problem minimize Suppose that where
bull Approximate f(y) minimize
ndash Note when given a choice of representing y in alternative ways the LP will choose one that leads to the least objective value for the approximation
24
For minimizing a convex function the λ-method automatically satisfies the
additional adjacency property
+ adjacency condition+ other constraints
25
Dynamic programming
bull Suppose that there are 50 matches on a table and the person who picks up the last match wins At each alternating turn my opponent or I can pick up 1 2 or 6 matches Assuming that I go first how can I be sure of winning the game
26
Determining the strategy using DP
bull n = number of matches left (n is the statestage) bull g(n) = 1 if you can force a win at n matches g(n) = 0 otherwise g(n) = optimal value functionAt each statestage you can make one of three decision
s take 1 2 or 6 matchesbull g(1) = g(2) = g(6) = 1 (boundary conditions)bull g(3) = 0 g(4) = g(5) = 1 (why)The recursionbull g(n) = 1 if g(n-1) = 0 or g(n-2) = 0 or g(n-6) = 0 g(n) = 0 otherwisebull Equivalently g(n) = 1 ndashmin (g(n-1) g(n-2) g(n-6))
27
Dynamic Programming in General
bull Break up a complex decision problem into a sequence of smaller decision subproblems
bull Stages one solves decision problems one ldquostagerdquo at a time Stages often can be thought of as ldquotimerdquo in most instances ndash Not every DP has stagesndash The previous shortest path problem has 6 stagesndash The match problem does not have stages
28
Dynamic Programming in General
bull States The smaller decision subproblemsare often expressed in a very compact manner The description of the smaller subproblemsis often referred to as the state ndash match problem ldquostaterdquo is the number of matches
leftbull At each state-stage there are one or more de
cisions The DP recursion determines the best decision ndash match problem how many matches to removendash shortest path example go right and up or else go
down and right
29
Optimal Capacity Expansion What is the least cost way of building plants
Cost of $15 million in any year in which a plant is built At most 3 plants a year can be built
Cum DemandCost per plant in $millions
30
Finding a topological order
Find a node with no incoming arc Label it node 1For i = 2 to n find a node with no incoming arc from an unlabeled node Label it node i
31
Find d(j) using a recursion
d(j) is the shortest length of a path from node 1 to node j
Let cij = length of arc (ij)
What is d(j) computed in terms of d(1) hellip d(j-1)
Compute f(2) hellip f(8)Example d(4) = min 3 + d(2) 2 + d(3)
32
Finding optimal paragraph layouts
bull Tex optimally decomposes paragraphs by selecting the breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
bull Tex optimally decomposes paragraphs by select-ingthe breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
13
Convex Functions
Convex Functions
f(λy + (1-λ)z) le λf(y) + (1-λ)f(z)
for every yand zand for 0le λ le1
eg f((y+z)2) le f(y)2 + f(z)2
We say ldquostrictrdquo convexity if sign is ldquoltrdquo for 0lt λ lt1
Line joining any pointsIs above the curve
14
Concave Functions
Concave Functions f(λy + (1-λ)z) ge λf(y) + (1-λ)f(z)
for every yand zand for 0le λ le1
eg f((y+z)2) ge f(y)2 + f(z)2
We say ldquostrictrdquo convexity if sign is ldquogtrdquo for 0lt λ lt1
15
Convexity and Extreme Pointsxy
We say that a set Sis convex if for every two points xand yin S and for every real number λin [01] λx + (1-λ)y εS
The feasible region of a linear program is convex
We say that an element w εSis an extreme point(vertexcorner point) if wis not the midpoint of any line segment contained in S
16
Local Maximum (Minimum) Property
bull A local max of a concave function on a convex feasible region is also a global max
bull A local min of a convex function on a convex feasible region is also a global min
bull Strict convexity or concavity implies that the global optimum isunique
bull Given this we can efficiently solve ndashMaximization Problems with a concave obje
ctive function and linear constraints ndashMinimization Problems with a convex object
ive function and linear constraints
17
Where is the optimal solution
Note the optimal solution is not at a corner pointIt is where the isocontour first hits the feasible region
18
Another example
X
Minimize(x-8)2+ (y-8)2
Then the global unconstrained minimum
is also feasible
The optimal solution is not on the boundary of the feasible region
19
Finding a local maximum using Fibonacci Search
Where the maximum may be
Length of search Interval 3
20
The search finds a local maximum but not necessarily a global maximum
21
Approximating a non-linear function of 1 variable the λmethody
Choose different values of xto
approximate the x-axis
Approximate using piecewise linear
segments
22
More on theλmethody
Suppose that for ndash3 lex le-1
Then we approximate f(x) as λ1(-20) + λ2(-7 13)
we represent x has λ1(-3) + λ2(-1) where λ1 + λ2= 1 and λ1 λ2ge0
23
Approximating a non-linear objective function for a minimization NLP
original problem minimize Suppose that where
bull Approximate f(y) minimize
ndash Note when given a choice of representing y in alternative ways the LP will choose one that leads to the least objective value for the approximation
24
For minimizing a convex function the λ-method automatically satisfies the
additional adjacency property
+ adjacency condition+ other constraints
25
Dynamic programming
bull Suppose that there are 50 matches on a table and the person who picks up the last match wins At each alternating turn my opponent or I can pick up 1 2 or 6 matches Assuming that I go first how can I be sure of winning the game
26
Determining the strategy using DP
bull n = number of matches left (n is the statestage) bull g(n) = 1 if you can force a win at n matches g(n) = 0 otherwise g(n) = optimal value functionAt each statestage you can make one of three decision
s take 1 2 or 6 matchesbull g(1) = g(2) = g(6) = 1 (boundary conditions)bull g(3) = 0 g(4) = g(5) = 1 (why)The recursionbull g(n) = 1 if g(n-1) = 0 or g(n-2) = 0 or g(n-6) = 0 g(n) = 0 otherwisebull Equivalently g(n) = 1 ndashmin (g(n-1) g(n-2) g(n-6))
27
Dynamic Programming in General
bull Break up a complex decision problem into a sequence of smaller decision subproblems
bull Stages one solves decision problems one ldquostagerdquo at a time Stages often can be thought of as ldquotimerdquo in most instances ndash Not every DP has stagesndash The previous shortest path problem has 6 stagesndash The match problem does not have stages
28
Dynamic Programming in General
bull States The smaller decision subproblemsare often expressed in a very compact manner The description of the smaller subproblemsis often referred to as the state ndash match problem ldquostaterdquo is the number of matches
leftbull At each state-stage there are one or more de
cisions The DP recursion determines the best decision ndash match problem how many matches to removendash shortest path example go right and up or else go
down and right
29
Optimal Capacity Expansion What is the least cost way of building plants
Cost of $15 million in any year in which a plant is built At most 3 plants a year can be built
Cum DemandCost per plant in $millions
30
Finding a topological order
Find a node with no incoming arc Label it node 1For i = 2 to n find a node with no incoming arc from an unlabeled node Label it node i
31
Find d(j) using a recursion
d(j) is the shortest length of a path from node 1 to node j
Let cij = length of arc (ij)
What is d(j) computed in terms of d(1) hellip d(j-1)
Compute f(2) hellip f(8)Example d(4) = min 3 + d(2) 2 + d(3)
32
Finding optimal paragraph layouts
bull Tex optimally decomposes paragraphs by selecting the breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
bull Tex optimally decomposes paragraphs by select-ingthe breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
14
Concave Functions
Concave Functions f(λy + (1-λ)z) ge λf(y) + (1-λ)f(z)
for every yand zand for 0le λ le1
eg f((y+z)2) ge f(y)2 + f(z)2
We say ldquostrictrdquo convexity if sign is ldquogtrdquo for 0lt λ lt1
15
Convexity and Extreme Pointsxy
We say that a set Sis convex if for every two points xand yin S and for every real number λin [01] λx + (1-λ)y εS
The feasible region of a linear program is convex
We say that an element w εSis an extreme point(vertexcorner point) if wis not the midpoint of any line segment contained in S
16
Local Maximum (Minimum) Property
bull A local max of a concave function on a convex feasible region is also a global max
bull A local min of a convex function on a convex feasible region is also a global min
bull Strict convexity or concavity implies that the global optimum isunique
bull Given this we can efficiently solve ndashMaximization Problems with a concave obje
ctive function and linear constraints ndashMinimization Problems with a convex object
ive function and linear constraints
17
Where is the optimal solution
Note the optimal solution is not at a corner pointIt is where the isocontour first hits the feasible region
18
Another example
X
Minimize(x-8)2+ (y-8)2
Then the global unconstrained minimum
is also feasible
The optimal solution is not on the boundary of the feasible region
19
Finding a local maximum using Fibonacci Search
Where the maximum may be
Length of search Interval 3
20
The search finds a local maximum but not necessarily a global maximum
21
Approximating a non-linear function of 1 variable the λmethody
Choose different values of xto
approximate the x-axis
Approximate using piecewise linear
segments
22
More on theλmethody
Suppose that for ndash3 lex le-1
Then we approximate f(x) as λ1(-20) + λ2(-7 13)
we represent x has λ1(-3) + λ2(-1) where λ1 + λ2= 1 and λ1 λ2ge0
23
Approximating a non-linear objective function for a minimization NLP
original problem minimize Suppose that where
bull Approximate f(y) minimize
ndash Note when given a choice of representing y in alternative ways the LP will choose one that leads to the least objective value for the approximation
24
For minimizing a convex function the λ-method automatically satisfies the
additional adjacency property
+ adjacency condition+ other constraints
25
Dynamic programming
bull Suppose that there are 50 matches on a table and the person who picks up the last match wins At each alternating turn my opponent or I can pick up 1 2 or 6 matches Assuming that I go first how can I be sure of winning the game
26
Determining the strategy using DP
bull n = number of matches left (n is the statestage) bull g(n) = 1 if you can force a win at n matches g(n) = 0 otherwise g(n) = optimal value functionAt each statestage you can make one of three decision
s take 1 2 or 6 matchesbull g(1) = g(2) = g(6) = 1 (boundary conditions)bull g(3) = 0 g(4) = g(5) = 1 (why)The recursionbull g(n) = 1 if g(n-1) = 0 or g(n-2) = 0 or g(n-6) = 0 g(n) = 0 otherwisebull Equivalently g(n) = 1 ndashmin (g(n-1) g(n-2) g(n-6))
27
Dynamic Programming in General
bull Break up a complex decision problem into a sequence of smaller decision subproblems
bull Stages one solves decision problems one ldquostagerdquo at a time Stages often can be thought of as ldquotimerdquo in most instances ndash Not every DP has stagesndash The previous shortest path problem has 6 stagesndash The match problem does not have stages
28
Dynamic Programming in General
bull States The smaller decision subproblemsare often expressed in a very compact manner The description of the smaller subproblemsis often referred to as the state ndash match problem ldquostaterdquo is the number of matches
leftbull At each state-stage there are one or more de
cisions The DP recursion determines the best decision ndash match problem how many matches to removendash shortest path example go right and up or else go
down and right
29
Optimal Capacity Expansion What is the least cost way of building plants
Cost of $15 million in any year in which a plant is built At most 3 plants a year can be built
Cum DemandCost per plant in $millions
30
Finding a topological order
Find a node with no incoming arc Label it node 1For i = 2 to n find a node with no incoming arc from an unlabeled node Label it node i
31
Find d(j) using a recursion
d(j) is the shortest length of a path from node 1 to node j
Let cij = length of arc (ij)
What is d(j) computed in terms of d(1) hellip d(j-1)
Compute f(2) hellip f(8)Example d(4) = min 3 + d(2) 2 + d(3)
32
Finding optimal paragraph layouts
bull Tex optimally decomposes paragraphs by selecting the breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
bull Tex optimally decomposes paragraphs by select-ingthe breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
15
Convexity and Extreme Pointsxy
We say that a set Sis convex if for every two points xand yin S and for every real number λin [01] λx + (1-λ)y εS
The feasible region of a linear program is convex
We say that an element w εSis an extreme point(vertexcorner point) if wis not the midpoint of any line segment contained in S
16
Local Maximum (Minimum) Property
bull A local max of a concave function on a convex feasible region is also a global max
bull A local min of a convex function on a convex feasible region is also a global min
bull Strict convexity or concavity implies that the global optimum isunique
bull Given this we can efficiently solve ndashMaximization Problems with a concave obje
ctive function and linear constraints ndashMinimization Problems with a convex object
ive function and linear constraints
17
Where is the optimal solution
Note the optimal solution is not at a corner pointIt is where the isocontour first hits the feasible region
18
Another example
X
Minimize(x-8)2+ (y-8)2
Then the global unconstrained minimum
is also feasible
The optimal solution is not on the boundary of the feasible region
19
Finding a local maximum using Fibonacci Search
Where the maximum may be
Length of search Interval 3
20
The search finds a local maximum but not necessarily a global maximum
21
Approximating a non-linear function of 1 variable the λmethody
Choose different values of xto
approximate the x-axis
Approximate using piecewise linear
segments
22
More on theλmethody
Suppose that for ndash3 lex le-1
Then we approximate f(x) as λ1(-20) + λ2(-7 13)
we represent x has λ1(-3) + λ2(-1) where λ1 + λ2= 1 and λ1 λ2ge0
23
Approximating a non-linear objective function for a minimization NLP
original problem minimize Suppose that where
bull Approximate f(y) minimize
ndash Note when given a choice of representing y in alternative ways the LP will choose one that leads to the least objective value for the approximation
24
For minimizing a convex function the λ-method automatically satisfies the
additional adjacency property
+ adjacency condition+ other constraints
25
Dynamic programming
bull Suppose that there are 50 matches on a table and the person who picks up the last match wins At each alternating turn my opponent or I can pick up 1 2 or 6 matches Assuming that I go first how can I be sure of winning the game
26
Determining the strategy using DP
bull n = number of matches left (n is the statestage) bull g(n) = 1 if you can force a win at n matches g(n) = 0 otherwise g(n) = optimal value functionAt each statestage you can make one of three decision
s take 1 2 or 6 matchesbull g(1) = g(2) = g(6) = 1 (boundary conditions)bull g(3) = 0 g(4) = g(5) = 1 (why)The recursionbull g(n) = 1 if g(n-1) = 0 or g(n-2) = 0 or g(n-6) = 0 g(n) = 0 otherwisebull Equivalently g(n) = 1 ndashmin (g(n-1) g(n-2) g(n-6))
27
Dynamic Programming in General
bull Break up a complex decision problem into a sequence of smaller decision subproblems
bull Stages one solves decision problems one ldquostagerdquo at a time Stages often can be thought of as ldquotimerdquo in most instances ndash Not every DP has stagesndash The previous shortest path problem has 6 stagesndash The match problem does not have stages
28
Dynamic Programming in General
bull States The smaller decision subproblemsare often expressed in a very compact manner The description of the smaller subproblemsis often referred to as the state ndash match problem ldquostaterdquo is the number of matches
leftbull At each state-stage there are one or more de
cisions The DP recursion determines the best decision ndash match problem how many matches to removendash shortest path example go right and up or else go
down and right
29
Optimal Capacity Expansion What is the least cost way of building plants
Cost of $15 million in any year in which a plant is built At most 3 plants a year can be built
Cum DemandCost per plant in $millions
30
Finding a topological order
Find a node with no incoming arc Label it node 1For i = 2 to n find a node with no incoming arc from an unlabeled node Label it node i
31
Find d(j) using a recursion
d(j) is the shortest length of a path from node 1 to node j
Let cij = length of arc (ij)
What is d(j) computed in terms of d(1) hellip d(j-1)
Compute f(2) hellip f(8)Example d(4) = min 3 + d(2) 2 + d(3)
32
Finding optimal paragraph layouts
bull Tex optimally decomposes paragraphs by selecting the breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
bull Tex optimally decomposes paragraphs by select-ingthe breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
16
Local Maximum (Minimum) Property
bull A local max of a concave function on a convex feasible region is also a global max
bull A local min of a convex function on a convex feasible region is also a global min
bull Strict convexity or concavity implies that the global optimum isunique
bull Given this we can efficiently solve ndashMaximization Problems with a concave obje
ctive function and linear constraints ndashMinimization Problems with a convex object
ive function and linear constraints
17
Where is the optimal solution
Note the optimal solution is not at a corner pointIt is where the isocontour first hits the feasible region
18
Another example
X
Minimize(x-8)2+ (y-8)2
Then the global unconstrained minimum
is also feasible
The optimal solution is not on the boundary of the feasible region
19
Finding a local maximum using Fibonacci Search
Where the maximum may be
Length of search Interval 3
20
The search finds a local maximum but not necessarily a global maximum
21
Approximating a non-linear function of 1 variable the λmethody
Choose different values of xto
approximate the x-axis
Approximate using piecewise linear
segments
22
More on theλmethody
Suppose that for ndash3 lex le-1
Then we approximate f(x) as λ1(-20) + λ2(-7 13)
we represent x has λ1(-3) + λ2(-1) where λ1 + λ2= 1 and λ1 λ2ge0
23
Approximating a non-linear objective function for a minimization NLP
original problem minimize Suppose that where
bull Approximate f(y) minimize
ndash Note when given a choice of representing y in alternative ways the LP will choose one that leads to the least objective value for the approximation
24
For minimizing a convex function the λ-method automatically satisfies the
additional adjacency property
+ adjacency condition+ other constraints
25
Dynamic programming
bull Suppose that there are 50 matches on a table and the person who picks up the last match wins At each alternating turn my opponent or I can pick up 1 2 or 6 matches Assuming that I go first how can I be sure of winning the game
26
Determining the strategy using DP
bull n = number of matches left (n is the statestage) bull g(n) = 1 if you can force a win at n matches g(n) = 0 otherwise g(n) = optimal value functionAt each statestage you can make one of three decision
s take 1 2 or 6 matchesbull g(1) = g(2) = g(6) = 1 (boundary conditions)bull g(3) = 0 g(4) = g(5) = 1 (why)The recursionbull g(n) = 1 if g(n-1) = 0 or g(n-2) = 0 or g(n-6) = 0 g(n) = 0 otherwisebull Equivalently g(n) = 1 ndashmin (g(n-1) g(n-2) g(n-6))
27
Dynamic Programming in General
bull Break up a complex decision problem into a sequence of smaller decision subproblems
bull Stages one solves decision problems one ldquostagerdquo at a time Stages often can be thought of as ldquotimerdquo in most instances ndash Not every DP has stagesndash The previous shortest path problem has 6 stagesndash The match problem does not have stages
28
Dynamic Programming in General
bull States The smaller decision subproblemsare often expressed in a very compact manner The description of the smaller subproblemsis often referred to as the state ndash match problem ldquostaterdquo is the number of matches
leftbull At each state-stage there are one or more de
cisions The DP recursion determines the best decision ndash match problem how many matches to removendash shortest path example go right and up or else go
down and right
29
Optimal Capacity Expansion What is the least cost way of building plants
Cost of $15 million in any year in which a plant is built At most 3 plants a year can be built
Cum DemandCost per plant in $millions
30
Finding a topological order
Find a node with no incoming arc Label it node 1For i = 2 to n find a node with no incoming arc from an unlabeled node Label it node i
31
Find d(j) using a recursion
d(j) is the shortest length of a path from node 1 to node j
Let cij = length of arc (ij)
What is d(j) computed in terms of d(1) hellip d(j-1)
Compute f(2) hellip f(8)Example d(4) = min 3 + d(2) 2 + d(3)
32
Finding optimal paragraph layouts
bull Tex optimally decomposes paragraphs by selecting the breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
bull Tex optimally decomposes paragraphs by select-ingthe breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
17
Where is the optimal solution
Note the optimal solution is not at a corner pointIt is where the isocontour first hits the feasible region
18
Another example
X
Minimize(x-8)2+ (y-8)2
Then the global unconstrained minimum
is also feasible
The optimal solution is not on the boundary of the feasible region
19
Finding a local maximum using Fibonacci Search
Where the maximum may be
Length of search Interval 3
20
The search finds a local maximum but not necessarily a global maximum
21
Approximating a non-linear function of 1 variable the λmethody
Choose different values of xto
approximate the x-axis
Approximate using piecewise linear
segments
22
More on theλmethody
Suppose that for ndash3 lex le-1
Then we approximate f(x) as λ1(-20) + λ2(-7 13)
we represent x has λ1(-3) + λ2(-1) where λ1 + λ2= 1 and λ1 λ2ge0
23
Approximating a non-linear objective function for a minimization NLP
original problem minimize Suppose that where
bull Approximate f(y) minimize
ndash Note when given a choice of representing y in alternative ways the LP will choose one that leads to the least objective value for the approximation
24
For minimizing a convex function the λ-method automatically satisfies the
additional adjacency property
+ adjacency condition+ other constraints
25
Dynamic programming
bull Suppose that there are 50 matches on a table and the person who picks up the last match wins At each alternating turn my opponent or I can pick up 1 2 or 6 matches Assuming that I go first how can I be sure of winning the game
26
Determining the strategy using DP
bull n = number of matches left (n is the statestage) bull g(n) = 1 if you can force a win at n matches g(n) = 0 otherwise g(n) = optimal value functionAt each statestage you can make one of three decision
s take 1 2 or 6 matchesbull g(1) = g(2) = g(6) = 1 (boundary conditions)bull g(3) = 0 g(4) = g(5) = 1 (why)The recursionbull g(n) = 1 if g(n-1) = 0 or g(n-2) = 0 or g(n-6) = 0 g(n) = 0 otherwisebull Equivalently g(n) = 1 ndashmin (g(n-1) g(n-2) g(n-6))
27
Dynamic Programming in General
bull Break up a complex decision problem into a sequence of smaller decision subproblems
bull Stages one solves decision problems one ldquostagerdquo at a time Stages often can be thought of as ldquotimerdquo in most instances ndash Not every DP has stagesndash The previous shortest path problem has 6 stagesndash The match problem does not have stages
28
Dynamic Programming in General
bull States The smaller decision subproblemsare often expressed in a very compact manner The description of the smaller subproblemsis often referred to as the state ndash match problem ldquostaterdquo is the number of matches
leftbull At each state-stage there are one or more de
cisions The DP recursion determines the best decision ndash match problem how many matches to removendash shortest path example go right and up or else go
down and right
29
Optimal Capacity Expansion What is the least cost way of building plants
Cost of $15 million in any year in which a plant is built At most 3 plants a year can be built
Cum DemandCost per plant in $millions
30
Finding a topological order
Find a node with no incoming arc Label it node 1For i = 2 to n find a node with no incoming arc from an unlabeled node Label it node i
31
Find d(j) using a recursion
d(j) is the shortest length of a path from node 1 to node j
Let cij = length of arc (ij)
What is d(j) computed in terms of d(1) hellip d(j-1)
Compute f(2) hellip f(8)Example d(4) = min 3 + d(2) 2 + d(3)
32
Finding optimal paragraph layouts
bull Tex optimally decomposes paragraphs by selecting the breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
bull Tex optimally decomposes paragraphs by select-ingthe breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
18
Another example
X
Minimize(x-8)2+ (y-8)2
Then the global unconstrained minimum
is also feasible
The optimal solution is not on the boundary of the feasible region
19
Finding a local maximum using Fibonacci Search
Where the maximum may be
Length of search Interval 3
20
The search finds a local maximum but not necessarily a global maximum
21
Approximating a non-linear function of 1 variable the λmethody
Choose different values of xto
approximate the x-axis
Approximate using piecewise linear
segments
22
More on theλmethody
Suppose that for ndash3 lex le-1
Then we approximate f(x) as λ1(-20) + λ2(-7 13)
we represent x has λ1(-3) + λ2(-1) where λ1 + λ2= 1 and λ1 λ2ge0
23
Approximating a non-linear objective function for a minimization NLP
original problem minimize Suppose that where
bull Approximate f(y) minimize
ndash Note when given a choice of representing y in alternative ways the LP will choose one that leads to the least objective value for the approximation
24
For minimizing a convex function the λ-method automatically satisfies the
additional adjacency property
+ adjacency condition+ other constraints
25
Dynamic programming
bull Suppose that there are 50 matches on a table and the person who picks up the last match wins At each alternating turn my opponent or I can pick up 1 2 or 6 matches Assuming that I go first how can I be sure of winning the game
26
Determining the strategy using DP
bull n = number of matches left (n is the statestage) bull g(n) = 1 if you can force a win at n matches g(n) = 0 otherwise g(n) = optimal value functionAt each statestage you can make one of three decision
s take 1 2 or 6 matchesbull g(1) = g(2) = g(6) = 1 (boundary conditions)bull g(3) = 0 g(4) = g(5) = 1 (why)The recursionbull g(n) = 1 if g(n-1) = 0 or g(n-2) = 0 or g(n-6) = 0 g(n) = 0 otherwisebull Equivalently g(n) = 1 ndashmin (g(n-1) g(n-2) g(n-6))
27
Dynamic Programming in General
bull Break up a complex decision problem into a sequence of smaller decision subproblems
bull Stages one solves decision problems one ldquostagerdquo at a time Stages often can be thought of as ldquotimerdquo in most instances ndash Not every DP has stagesndash The previous shortest path problem has 6 stagesndash The match problem does not have stages
28
Dynamic Programming in General
bull States The smaller decision subproblemsare often expressed in a very compact manner The description of the smaller subproblemsis often referred to as the state ndash match problem ldquostaterdquo is the number of matches
leftbull At each state-stage there are one or more de
cisions The DP recursion determines the best decision ndash match problem how many matches to removendash shortest path example go right and up or else go
down and right
29
Optimal Capacity Expansion What is the least cost way of building plants
Cost of $15 million in any year in which a plant is built At most 3 plants a year can be built
Cum DemandCost per plant in $millions
30
Finding a topological order
Find a node with no incoming arc Label it node 1For i = 2 to n find a node with no incoming arc from an unlabeled node Label it node i
31
Find d(j) using a recursion
d(j) is the shortest length of a path from node 1 to node j
Let cij = length of arc (ij)
What is d(j) computed in terms of d(1) hellip d(j-1)
Compute f(2) hellip f(8)Example d(4) = min 3 + d(2) 2 + d(3)
32
Finding optimal paragraph layouts
bull Tex optimally decomposes paragraphs by selecting the breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
bull Tex optimally decomposes paragraphs by select-ingthe breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
19
Finding a local maximum using Fibonacci Search
Where the maximum may be
Length of search Interval 3
20
The search finds a local maximum but not necessarily a global maximum
21
Approximating a non-linear function of 1 variable the λmethody
Choose different values of xto
approximate the x-axis
Approximate using piecewise linear
segments
22
More on theλmethody
Suppose that for ndash3 lex le-1
Then we approximate f(x) as λ1(-20) + λ2(-7 13)
we represent x has λ1(-3) + λ2(-1) where λ1 + λ2= 1 and λ1 λ2ge0
23
Approximating a non-linear objective function for a minimization NLP
original problem minimize Suppose that where
bull Approximate f(y) minimize
ndash Note when given a choice of representing y in alternative ways the LP will choose one that leads to the least objective value for the approximation
24
For minimizing a convex function the λ-method automatically satisfies the
additional adjacency property
+ adjacency condition+ other constraints
25
Dynamic programming
bull Suppose that there are 50 matches on a table and the person who picks up the last match wins At each alternating turn my opponent or I can pick up 1 2 or 6 matches Assuming that I go first how can I be sure of winning the game
26
Determining the strategy using DP
bull n = number of matches left (n is the statestage) bull g(n) = 1 if you can force a win at n matches g(n) = 0 otherwise g(n) = optimal value functionAt each statestage you can make one of three decision
s take 1 2 or 6 matchesbull g(1) = g(2) = g(6) = 1 (boundary conditions)bull g(3) = 0 g(4) = g(5) = 1 (why)The recursionbull g(n) = 1 if g(n-1) = 0 or g(n-2) = 0 or g(n-6) = 0 g(n) = 0 otherwisebull Equivalently g(n) = 1 ndashmin (g(n-1) g(n-2) g(n-6))
27
Dynamic Programming in General
bull Break up a complex decision problem into a sequence of smaller decision subproblems
bull Stages one solves decision problems one ldquostagerdquo at a time Stages often can be thought of as ldquotimerdquo in most instances ndash Not every DP has stagesndash The previous shortest path problem has 6 stagesndash The match problem does not have stages
28
Dynamic Programming in General
bull States The smaller decision subproblemsare often expressed in a very compact manner The description of the smaller subproblemsis often referred to as the state ndash match problem ldquostaterdquo is the number of matches
leftbull At each state-stage there are one or more de
cisions The DP recursion determines the best decision ndash match problem how many matches to removendash shortest path example go right and up or else go
down and right
29
Optimal Capacity Expansion What is the least cost way of building plants
Cost of $15 million in any year in which a plant is built At most 3 plants a year can be built
Cum DemandCost per plant in $millions
30
Finding a topological order
Find a node with no incoming arc Label it node 1For i = 2 to n find a node with no incoming arc from an unlabeled node Label it node i
31
Find d(j) using a recursion
d(j) is the shortest length of a path from node 1 to node j
Let cij = length of arc (ij)
What is d(j) computed in terms of d(1) hellip d(j-1)
Compute f(2) hellip f(8)Example d(4) = min 3 + d(2) 2 + d(3)
32
Finding optimal paragraph layouts
bull Tex optimally decomposes paragraphs by selecting the breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
bull Tex optimally decomposes paragraphs by select-ingthe breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
20
The search finds a local maximum but not necessarily a global maximum
21
Approximating a non-linear function of 1 variable the λmethody
Choose different values of xto
approximate the x-axis
Approximate using piecewise linear
segments
22
More on theλmethody
Suppose that for ndash3 lex le-1
Then we approximate f(x) as λ1(-20) + λ2(-7 13)
we represent x has λ1(-3) + λ2(-1) where λ1 + λ2= 1 and λ1 λ2ge0
23
Approximating a non-linear objective function for a minimization NLP
original problem minimize Suppose that where
bull Approximate f(y) minimize
ndash Note when given a choice of representing y in alternative ways the LP will choose one that leads to the least objective value for the approximation
24
For minimizing a convex function the λ-method automatically satisfies the
additional adjacency property
+ adjacency condition+ other constraints
25
Dynamic programming
bull Suppose that there are 50 matches on a table and the person who picks up the last match wins At each alternating turn my opponent or I can pick up 1 2 or 6 matches Assuming that I go first how can I be sure of winning the game
26
Determining the strategy using DP
bull n = number of matches left (n is the statestage) bull g(n) = 1 if you can force a win at n matches g(n) = 0 otherwise g(n) = optimal value functionAt each statestage you can make one of three decision
s take 1 2 or 6 matchesbull g(1) = g(2) = g(6) = 1 (boundary conditions)bull g(3) = 0 g(4) = g(5) = 1 (why)The recursionbull g(n) = 1 if g(n-1) = 0 or g(n-2) = 0 or g(n-6) = 0 g(n) = 0 otherwisebull Equivalently g(n) = 1 ndashmin (g(n-1) g(n-2) g(n-6))
27
Dynamic Programming in General
bull Break up a complex decision problem into a sequence of smaller decision subproblems
bull Stages one solves decision problems one ldquostagerdquo at a time Stages often can be thought of as ldquotimerdquo in most instances ndash Not every DP has stagesndash The previous shortest path problem has 6 stagesndash The match problem does not have stages
28
Dynamic Programming in General
bull States The smaller decision subproblemsare often expressed in a very compact manner The description of the smaller subproblemsis often referred to as the state ndash match problem ldquostaterdquo is the number of matches
leftbull At each state-stage there are one or more de
cisions The DP recursion determines the best decision ndash match problem how many matches to removendash shortest path example go right and up or else go
down and right
29
Optimal Capacity Expansion What is the least cost way of building plants
Cost of $15 million in any year in which a plant is built At most 3 plants a year can be built
Cum DemandCost per plant in $millions
30
Finding a topological order
Find a node with no incoming arc Label it node 1For i = 2 to n find a node with no incoming arc from an unlabeled node Label it node i
31
Find d(j) using a recursion
d(j) is the shortest length of a path from node 1 to node j
Let cij = length of arc (ij)
What is d(j) computed in terms of d(1) hellip d(j-1)
Compute f(2) hellip f(8)Example d(4) = min 3 + d(2) 2 + d(3)
32
Finding optimal paragraph layouts
bull Tex optimally decomposes paragraphs by selecting the breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
bull Tex optimally decomposes paragraphs by select-ingthe breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
21
Approximating a non-linear function of 1 variable the λmethody
Choose different values of xto
approximate the x-axis
Approximate using piecewise linear
segments
22
More on theλmethody
Suppose that for ndash3 lex le-1
Then we approximate f(x) as λ1(-20) + λ2(-7 13)
we represent x has λ1(-3) + λ2(-1) where λ1 + λ2= 1 and λ1 λ2ge0
23
Approximating a non-linear objective function for a minimization NLP
original problem minimize Suppose that where
bull Approximate f(y) minimize
ndash Note when given a choice of representing y in alternative ways the LP will choose one that leads to the least objective value for the approximation
24
For minimizing a convex function the λ-method automatically satisfies the
additional adjacency property
+ adjacency condition+ other constraints
25
Dynamic programming
bull Suppose that there are 50 matches on a table and the person who picks up the last match wins At each alternating turn my opponent or I can pick up 1 2 or 6 matches Assuming that I go first how can I be sure of winning the game
26
Determining the strategy using DP
bull n = number of matches left (n is the statestage) bull g(n) = 1 if you can force a win at n matches g(n) = 0 otherwise g(n) = optimal value functionAt each statestage you can make one of three decision
s take 1 2 or 6 matchesbull g(1) = g(2) = g(6) = 1 (boundary conditions)bull g(3) = 0 g(4) = g(5) = 1 (why)The recursionbull g(n) = 1 if g(n-1) = 0 or g(n-2) = 0 or g(n-6) = 0 g(n) = 0 otherwisebull Equivalently g(n) = 1 ndashmin (g(n-1) g(n-2) g(n-6))
27
Dynamic Programming in General
bull Break up a complex decision problem into a sequence of smaller decision subproblems
bull Stages one solves decision problems one ldquostagerdquo at a time Stages often can be thought of as ldquotimerdquo in most instances ndash Not every DP has stagesndash The previous shortest path problem has 6 stagesndash The match problem does not have stages
28
Dynamic Programming in General
bull States The smaller decision subproblemsare often expressed in a very compact manner The description of the smaller subproblemsis often referred to as the state ndash match problem ldquostaterdquo is the number of matches
leftbull At each state-stage there are one or more de
cisions The DP recursion determines the best decision ndash match problem how many matches to removendash shortest path example go right and up or else go
down and right
29
Optimal Capacity Expansion What is the least cost way of building plants
Cost of $15 million in any year in which a plant is built At most 3 plants a year can be built
Cum DemandCost per plant in $millions
30
Finding a topological order
Find a node with no incoming arc Label it node 1For i = 2 to n find a node with no incoming arc from an unlabeled node Label it node i
31
Find d(j) using a recursion
d(j) is the shortest length of a path from node 1 to node j
Let cij = length of arc (ij)
What is d(j) computed in terms of d(1) hellip d(j-1)
Compute f(2) hellip f(8)Example d(4) = min 3 + d(2) 2 + d(3)
32
Finding optimal paragraph layouts
bull Tex optimally decomposes paragraphs by selecting the breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
bull Tex optimally decomposes paragraphs by select-ingthe breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
22
More on theλmethody
Suppose that for ndash3 lex le-1
Then we approximate f(x) as λ1(-20) + λ2(-7 13)
we represent x has λ1(-3) + λ2(-1) where λ1 + λ2= 1 and λ1 λ2ge0
23
Approximating a non-linear objective function for a minimization NLP
original problem minimize Suppose that where
bull Approximate f(y) minimize
ndash Note when given a choice of representing y in alternative ways the LP will choose one that leads to the least objective value for the approximation
24
For minimizing a convex function the λ-method automatically satisfies the
additional adjacency property
+ adjacency condition+ other constraints
25
Dynamic programming
bull Suppose that there are 50 matches on a table and the person who picks up the last match wins At each alternating turn my opponent or I can pick up 1 2 or 6 matches Assuming that I go first how can I be sure of winning the game
26
Determining the strategy using DP
bull n = number of matches left (n is the statestage) bull g(n) = 1 if you can force a win at n matches g(n) = 0 otherwise g(n) = optimal value functionAt each statestage you can make one of three decision
s take 1 2 or 6 matchesbull g(1) = g(2) = g(6) = 1 (boundary conditions)bull g(3) = 0 g(4) = g(5) = 1 (why)The recursionbull g(n) = 1 if g(n-1) = 0 or g(n-2) = 0 or g(n-6) = 0 g(n) = 0 otherwisebull Equivalently g(n) = 1 ndashmin (g(n-1) g(n-2) g(n-6))
27
Dynamic Programming in General
bull Break up a complex decision problem into a sequence of smaller decision subproblems
bull Stages one solves decision problems one ldquostagerdquo at a time Stages often can be thought of as ldquotimerdquo in most instances ndash Not every DP has stagesndash The previous shortest path problem has 6 stagesndash The match problem does not have stages
28
Dynamic Programming in General
bull States The smaller decision subproblemsare often expressed in a very compact manner The description of the smaller subproblemsis often referred to as the state ndash match problem ldquostaterdquo is the number of matches
leftbull At each state-stage there are one or more de
cisions The DP recursion determines the best decision ndash match problem how many matches to removendash shortest path example go right and up or else go
down and right
29
Optimal Capacity Expansion What is the least cost way of building plants
Cost of $15 million in any year in which a plant is built At most 3 plants a year can be built
Cum DemandCost per plant in $millions
30
Finding a topological order
Find a node with no incoming arc Label it node 1For i = 2 to n find a node with no incoming arc from an unlabeled node Label it node i
31
Find d(j) using a recursion
d(j) is the shortest length of a path from node 1 to node j
Let cij = length of arc (ij)
What is d(j) computed in terms of d(1) hellip d(j-1)
Compute f(2) hellip f(8)Example d(4) = min 3 + d(2) 2 + d(3)
32
Finding optimal paragraph layouts
bull Tex optimally decomposes paragraphs by selecting the breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
bull Tex optimally decomposes paragraphs by select-ingthe breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
23
Approximating a non-linear objective function for a minimization NLP
original problem minimize Suppose that where
bull Approximate f(y) minimize
ndash Note when given a choice of representing y in alternative ways the LP will choose one that leads to the least objective value for the approximation
24
For minimizing a convex function the λ-method automatically satisfies the
additional adjacency property
+ adjacency condition+ other constraints
25
Dynamic programming
bull Suppose that there are 50 matches on a table and the person who picks up the last match wins At each alternating turn my opponent or I can pick up 1 2 or 6 matches Assuming that I go first how can I be sure of winning the game
26
Determining the strategy using DP
bull n = number of matches left (n is the statestage) bull g(n) = 1 if you can force a win at n matches g(n) = 0 otherwise g(n) = optimal value functionAt each statestage you can make one of three decision
s take 1 2 or 6 matchesbull g(1) = g(2) = g(6) = 1 (boundary conditions)bull g(3) = 0 g(4) = g(5) = 1 (why)The recursionbull g(n) = 1 if g(n-1) = 0 or g(n-2) = 0 or g(n-6) = 0 g(n) = 0 otherwisebull Equivalently g(n) = 1 ndashmin (g(n-1) g(n-2) g(n-6))
27
Dynamic Programming in General
bull Break up a complex decision problem into a sequence of smaller decision subproblems
bull Stages one solves decision problems one ldquostagerdquo at a time Stages often can be thought of as ldquotimerdquo in most instances ndash Not every DP has stagesndash The previous shortest path problem has 6 stagesndash The match problem does not have stages
28
Dynamic Programming in General
bull States The smaller decision subproblemsare often expressed in a very compact manner The description of the smaller subproblemsis often referred to as the state ndash match problem ldquostaterdquo is the number of matches
leftbull At each state-stage there are one or more de
cisions The DP recursion determines the best decision ndash match problem how many matches to removendash shortest path example go right and up or else go
down and right
29
Optimal Capacity Expansion What is the least cost way of building plants
Cost of $15 million in any year in which a plant is built At most 3 plants a year can be built
Cum DemandCost per plant in $millions
30
Finding a topological order
Find a node with no incoming arc Label it node 1For i = 2 to n find a node with no incoming arc from an unlabeled node Label it node i
31
Find d(j) using a recursion
d(j) is the shortest length of a path from node 1 to node j
Let cij = length of arc (ij)
What is d(j) computed in terms of d(1) hellip d(j-1)
Compute f(2) hellip f(8)Example d(4) = min 3 + d(2) 2 + d(3)
32
Finding optimal paragraph layouts
bull Tex optimally decomposes paragraphs by selecting the breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
bull Tex optimally decomposes paragraphs by select-ingthe breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
24
For minimizing a convex function the λ-method automatically satisfies the
additional adjacency property
+ adjacency condition+ other constraints
25
Dynamic programming
bull Suppose that there are 50 matches on a table and the person who picks up the last match wins At each alternating turn my opponent or I can pick up 1 2 or 6 matches Assuming that I go first how can I be sure of winning the game
26
Determining the strategy using DP
bull n = number of matches left (n is the statestage) bull g(n) = 1 if you can force a win at n matches g(n) = 0 otherwise g(n) = optimal value functionAt each statestage you can make one of three decision
s take 1 2 or 6 matchesbull g(1) = g(2) = g(6) = 1 (boundary conditions)bull g(3) = 0 g(4) = g(5) = 1 (why)The recursionbull g(n) = 1 if g(n-1) = 0 or g(n-2) = 0 or g(n-6) = 0 g(n) = 0 otherwisebull Equivalently g(n) = 1 ndashmin (g(n-1) g(n-2) g(n-6))
27
Dynamic Programming in General
bull Break up a complex decision problem into a sequence of smaller decision subproblems
bull Stages one solves decision problems one ldquostagerdquo at a time Stages often can be thought of as ldquotimerdquo in most instances ndash Not every DP has stagesndash The previous shortest path problem has 6 stagesndash The match problem does not have stages
28
Dynamic Programming in General
bull States The smaller decision subproblemsare often expressed in a very compact manner The description of the smaller subproblemsis often referred to as the state ndash match problem ldquostaterdquo is the number of matches
leftbull At each state-stage there are one or more de
cisions The DP recursion determines the best decision ndash match problem how many matches to removendash shortest path example go right and up or else go
down and right
29
Optimal Capacity Expansion What is the least cost way of building plants
Cost of $15 million in any year in which a plant is built At most 3 plants a year can be built
Cum DemandCost per plant in $millions
30
Finding a topological order
Find a node with no incoming arc Label it node 1For i = 2 to n find a node with no incoming arc from an unlabeled node Label it node i
31
Find d(j) using a recursion
d(j) is the shortest length of a path from node 1 to node j
Let cij = length of arc (ij)
What is d(j) computed in terms of d(1) hellip d(j-1)
Compute f(2) hellip f(8)Example d(4) = min 3 + d(2) 2 + d(3)
32
Finding optimal paragraph layouts
bull Tex optimally decomposes paragraphs by selecting the breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
bull Tex optimally decomposes paragraphs by select-ingthe breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
25
Dynamic programming
bull Suppose that there are 50 matches on a table and the person who picks up the last match wins At each alternating turn my opponent or I can pick up 1 2 or 6 matches Assuming that I go first how can I be sure of winning the game
26
Determining the strategy using DP
bull n = number of matches left (n is the statestage) bull g(n) = 1 if you can force a win at n matches g(n) = 0 otherwise g(n) = optimal value functionAt each statestage you can make one of three decision
s take 1 2 or 6 matchesbull g(1) = g(2) = g(6) = 1 (boundary conditions)bull g(3) = 0 g(4) = g(5) = 1 (why)The recursionbull g(n) = 1 if g(n-1) = 0 or g(n-2) = 0 or g(n-6) = 0 g(n) = 0 otherwisebull Equivalently g(n) = 1 ndashmin (g(n-1) g(n-2) g(n-6))
27
Dynamic Programming in General
bull Break up a complex decision problem into a sequence of smaller decision subproblems
bull Stages one solves decision problems one ldquostagerdquo at a time Stages often can be thought of as ldquotimerdquo in most instances ndash Not every DP has stagesndash The previous shortest path problem has 6 stagesndash The match problem does not have stages
28
Dynamic Programming in General
bull States The smaller decision subproblemsare often expressed in a very compact manner The description of the smaller subproblemsis often referred to as the state ndash match problem ldquostaterdquo is the number of matches
leftbull At each state-stage there are one or more de
cisions The DP recursion determines the best decision ndash match problem how many matches to removendash shortest path example go right and up or else go
down and right
29
Optimal Capacity Expansion What is the least cost way of building plants
Cost of $15 million in any year in which a plant is built At most 3 plants a year can be built
Cum DemandCost per plant in $millions
30
Finding a topological order
Find a node with no incoming arc Label it node 1For i = 2 to n find a node with no incoming arc from an unlabeled node Label it node i
31
Find d(j) using a recursion
d(j) is the shortest length of a path from node 1 to node j
Let cij = length of arc (ij)
What is d(j) computed in terms of d(1) hellip d(j-1)
Compute f(2) hellip f(8)Example d(4) = min 3 + d(2) 2 + d(3)
32
Finding optimal paragraph layouts
bull Tex optimally decomposes paragraphs by selecting the breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
bull Tex optimally decomposes paragraphs by select-ingthe breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
26
Determining the strategy using DP
bull n = number of matches left (n is the statestage) bull g(n) = 1 if you can force a win at n matches g(n) = 0 otherwise g(n) = optimal value functionAt each statestage you can make one of three decision
s take 1 2 or 6 matchesbull g(1) = g(2) = g(6) = 1 (boundary conditions)bull g(3) = 0 g(4) = g(5) = 1 (why)The recursionbull g(n) = 1 if g(n-1) = 0 or g(n-2) = 0 or g(n-6) = 0 g(n) = 0 otherwisebull Equivalently g(n) = 1 ndashmin (g(n-1) g(n-2) g(n-6))
27
Dynamic Programming in General
bull Break up a complex decision problem into a sequence of smaller decision subproblems
bull Stages one solves decision problems one ldquostagerdquo at a time Stages often can be thought of as ldquotimerdquo in most instances ndash Not every DP has stagesndash The previous shortest path problem has 6 stagesndash The match problem does not have stages
28
Dynamic Programming in General
bull States The smaller decision subproblemsare often expressed in a very compact manner The description of the smaller subproblemsis often referred to as the state ndash match problem ldquostaterdquo is the number of matches
leftbull At each state-stage there are one or more de
cisions The DP recursion determines the best decision ndash match problem how many matches to removendash shortest path example go right and up or else go
down and right
29
Optimal Capacity Expansion What is the least cost way of building plants
Cost of $15 million in any year in which a plant is built At most 3 plants a year can be built
Cum DemandCost per plant in $millions
30
Finding a topological order
Find a node with no incoming arc Label it node 1For i = 2 to n find a node with no incoming arc from an unlabeled node Label it node i
31
Find d(j) using a recursion
d(j) is the shortest length of a path from node 1 to node j
Let cij = length of arc (ij)
What is d(j) computed in terms of d(1) hellip d(j-1)
Compute f(2) hellip f(8)Example d(4) = min 3 + d(2) 2 + d(3)
32
Finding optimal paragraph layouts
bull Tex optimally decomposes paragraphs by selecting the breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
bull Tex optimally decomposes paragraphs by select-ingthe breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
27
Dynamic Programming in General
bull Break up a complex decision problem into a sequence of smaller decision subproblems
bull Stages one solves decision problems one ldquostagerdquo at a time Stages often can be thought of as ldquotimerdquo in most instances ndash Not every DP has stagesndash The previous shortest path problem has 6 stagesndash The match problem does not have stages
28
Dynamic Programming in General
bull States The smaller decision subproblemsare often expressed in a very compact manner The description of the smaller subproblemsis often referred to as the state ndash match problem ldquostaterdquo is the number of matches
leftbull At each state-stage there are one or more de
cisions The DP recursion determines the best decision ndash match problem how many matches to removendash shortest path example go right and up or else go
down and right
29
Optimal Capacity Expansion What is the least cost way of building plants
Cost of $15 million in any year in which a plant is built At most 3 plants a year can be built
Cum DemandCost per plant in $millions
30
Finding a topological order
Find a node with no incoming arc Label it node 1For i = 2 to n find a node with no incoming arc from an unlabeled node Label it node i
31
Find d(j) using a recursion
d(j) is the shortest length of a path from node 1 to node j
Let cij = length of arc (ij)
What is d(j) computed in terms of d(1) hellip d(j-1)
Compute f(2) hellip f(8)Example d(4) = min 3 + d(2) 2 + d(3)
32
Finding optimal paragraph layouts
bull Tex optimally decomposes paragraphs by selecting the breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
bull Tex optimally decomposes paragraphs by select-ingthe breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
28
Dynamic Programming in General
bull States The smaller decision subproblemsare often expressed in a very compact manner The description of the smaller subproblemsis often referred to as the state ndash match problem ldquostaterdquo is the number of matches
leftbull At each state-stage there are one or more de
cisions The DP recursion determines the best decision ndash match problem how many matches to removendash shortest path example go right and up or else go
down and right
29
Optimal Capacity Expansion What is the least cost way of building plants
Cost of $15 million in any year in which a plant is built At most 3 plants a year can be built
Cum DemandCost per plant in $millions
30
Finding a topological order
Find a node with no incoming arc Label it node 1For i = 2 to n find a node with no incoming arc from an unlabeled node Label it node i
31
Find d(j) using a recursion
d(j) is the shortest length of a path from node 1 to node j
Let cij = length of arc (ij)
What is d(j) computed in terms of d(1) hellip d(j-1)
Compute f(2) hellip f(8)Example d(4) = min 3 + d(2) 2 + d(3)
32
Finding optimal paragraph layouts
bull Tex optimally decomposes paragraphs by selecting the breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
bull Tex optimally decomposes paragraphs by select-ingthe breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
29
Optimal Capacity Expansion What is the least cost way of building plants
Cost of $15 million in any year in which a plant is built At most 3 plants a year can be built
Cum DemandCost per plant in $millions
30
Finding a topological order
Find a node with no incoming arc Label it node 1For i = 2 to n find a node with no incoming arc from an unlabeled node Label it node i
31
Find d(j) using a recursion
d(j) is the shortest length of a path from node 1 to node j
Let cij = length of arc (ij)
What is d(j) computed in terms of d(1) hellip d(j-1)
Compute f(2) hellip f(8)Example d(4) = min 3 + d(2) 2 + d(3)
32
Finding optimal paragraph layouts
bull Tex optimally decomposes paragraphs by selecting the breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
bull Tex optimally decomposes paragraphs by select-ingthe breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
30
Finding a topological order
Find a node with no incoming arc Label it node 1For i = 2 to n find a node with no incoming arc from an unlabeled node Label it node i
31
Find d(j) using a recursion
d(j) is the shortest length of a path from node 1 to node j
Let cij = length of arc (ij)
What is d(j) computed in terms of d(1) hellip d(j-1)
Compute f(2) hellip f(8)Example d(4) = min 3 + d(2) 2 + d(3)
32
Finding optimal paragraph layouts
bull Tex optimally decomposes paragraphs by selecting the breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
bull Tex optimally decomposes paragraphs by select-ingthe breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
31
Find d(j) using a recursion
d(j) is the shortest length of a path from node 1 to node j
Let cij = length of arc (ij)
What is d(j) computed in terms of d(1) hellip d(j-1)
Compute f(2) hellip f(8)Example d(4) = min 3 + d(2) 2 + d(3)
32
Finding optimal paragraph layouts
bull Tex optimally decomposes paragraphs by selecting the breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
bull Tex optimally decomposes paragraphs by select-ingthe breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
32
Finding optimal paragraph layouts
bull Tex optimally decomposes paragraphs by selecting the breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
bull Tex optimally decomposes paragraphs by select-ingthe breakpoints for each line optimally It has a subroutine that computes the ugliness F(ij) of a line that begins at word i and ends at word j-1 How can we use F(ij) as part of a dynamic program whose solution will solve the paragraph problem
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
33
Capital Budgeting again
bull Investment budget = $14000
Investment
Cash Required (1000s)
NPV added (1000s)
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
34
Capital Budgeting stage 3
bull Consider stock 3 cost $4 NPV $12
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
35
The recursion
bull f(00) = 0 f(0k) is undefined for k gt 0bull f(k v) = min ( f(k-1 v) f(k-1 v-ak) + ck)
either item k is included or it is not
The optimum solution to the original problem is max f(n v) 0 lev leb
Note we solve the capital budgeting problem for all right hand sides less than b
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
36
Heuristics a way of dealing with hard combinatorial problems
Construction heuristics construct a solution
Example Nearest neighbor heuristic
bull beginbull choose an initial city for the tour while there are
any unvisited cities then the next city on the tour is the nearest unvisited city
end
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
37
Improvement Methods
bull These techniques start with a solution and seek out simple methods for improving the solution
bull Example Let T be a tour
bull Seek an improved tour Trsquo so that
|T -Trsquo| = 2
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
38
Illustration of 2-opt heuristic
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
39
Take two edges out Add 2 edges in
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
40
Take two edges out Add 2 edges in
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
41
Local Optimality
bull A solution y is said to be locally optimum (with respect to a given neighborhood) if there is no neighbor of y whose objective value is better than that of y
bull Example2-Opt finds a locally optimum solution
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
42
Improvement methods typically find locally optimum solutions
bull A solution y is said to be globally optimum if no other solution has a better objective value
bull Remark Local optimality depends on what a neighborhood is ie what modifications in the solution are permissiblendash eg 2-interchangesndash eg 3-interchanges
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
43
What is a neighborhood for the fire station problem
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
44
Insertion heuristic with randomization
Choose three cities randomly and obtain a tour T on the cities
For k = 4 to n choose a city that is not on T and insert it optimally into Tndash Note we can run this 1000 times and get
many different answers This increases the likelihood of getting a good solution
ndash Remark simulated annealing will not be on the final exam
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
45
GA termschromosome
(solution)gene
(variable)
1 or 0
(values)
alleles
Selection
Crossove
rmutation
populationObjective maximize fitness function
(objective function)
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
46
A Simple Example Maximize the number of 1rsquos
bull Initial Population Fitnessbull 10486981 1 1 0 1 4bull 10486980 1 1 0 1 3bull 10486980 0 1 1 0 2bull 10486981 0 0 1 1 3
bull 1048698Average fitness 3
Usually populations are much bigger say around 50 to 100 or more
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
47
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
Select two parents from the population
This is the selection step There will be more
on this later
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
48
Crossover Operation takes two solutions and creates a child (or more) whose genes are a mixture of the genes of the parents
1 point crossover Divide each parent into two parts at the same location k (chosen randomly)
Child 1 consists of genes 1 to k-1 from parent 1 and genes k to n from parent 2 Child 2 is the ldquoreverserdquo
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
49
Selection Operator
bull Think of crossover as mating
bull Selection biases mating so that fitter parents are more likely to mate
For example let the probability of selecting member j be fitness(j)total fitness
Prob(1) = 412 = 13Prob(3) = 212 = 16
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
50
Example with Selection and Crossover Only
original after 5generations
after 10 generations
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
51
Mutation
bull Previous difficulty important genetic variability was lost from the population
bull Idea introduce genetic variability into the population through mutation
bull simple mutation operation randomly flip q of the alleles (bits) in the population
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
52
Previous Example with a 1 mutation rate
original after 5generations
after 10 generations
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
53
Generation based GAs
Then replace the original population
by the children
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
54
Generation based GAs
This creates the next generation
Then iterate
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
55
For genetic algorithms the final exam will cover basic terminology
bull We will not cover steady state random keys
bull We will cover terms mentioned on the previous slides
56
Any questions before we solicit feedback on 15053
56
Any questions before we solicit feedback on 15053