SlideShare a Scribd company logo
Penalty Functions
• The Premise
• Quadratic Loss
• Problems and Solutions
The Premise
You may have noticed that the addition of
constraints to an optimization problem has the
effect of making it much more difficult.
The goal of penalty functions is to convert
constrained problems into unconstrained
problems by introducing an artificial penalty for
violating the constraint.
The Premise
Consider this example: Suppose there is a freeway
(like a toll freeway) that monitors when you enter
and exit the road.
Instead of establishing a speed limit of 65 mph,
they could use these rules:
• You can drive as fast as you want.
• If you drive under 65 mph you can use our road
for free.
• Every mph you drive over 65 will cost you $500.
The Premise
The previous example had no constraints – you
can drive as fast as you want! But the effect of
these rules would still be to limit drivers to
65mph. You can also control the likelihood of
speeding by adjusting the fine.
Penalty functions work in exactly this way.
Initial Steps
We will be working with a very simple example:
minimize f(x) = 100/x
subject to x ≤ 5
(With a little thought, you can tell that f(x) will be minimized
when x = 5, so we know what answer we should get!)
Before starting, convert any constraints into the
form (expression) ≤ 0. In this example, x ≤ 5
becomes:
x – 5 ≤ 0
Initial Steps
Once your constraints are converted, the next
step is to start charging a penalty for violating
them. Since we’re trying to minimize f(x), this
means we need to add value when the
constraint is violated.
If you are trying to maximize, the penalty will
subtract value.
Quadratic Loss: Inequalities
With the constraint x – 5 ≤ 0, we need a penalty that is:
• 0 when x – 5 ≤ 0 (the constraint is satisfied)
• positive when x – 5 is > 0 (the constraint is violated)
This can be done using the operation
P(x) = max(0, x – 5)
which returns the maximum of the two values, either 0
or whatever (x – 5) is.
We can make the penalty more severe by using
P(x) = max(0, x – 5)2.
This is known as a quadratic loss function.
Quadratic Loss: Equalities
It is even easier to convert equality constraints
into quadratic loss functions because we don’t
need to worry about the operation (max, g(x)).
We can convert h(x) = c into h(x) – c = 0, then
use
P(x) = (h(x) – c)2
The lowest value of P(x) will occur when h(x) = c,
in which case the penalty P(x) = 0. This is exactly
what we want.
Practice Problem 1
Convert the following constraints into quadratic
loss functions:
a) x ≤ 12
b) x2 ≥ 200
c) 2x + 7 ≤ 16
d) e2x + 1 ≥ 9
e) 4x2 + 2x = 12
The Next Step
Once you have converted your constraints into
penalty functions, the basic idea is to add all the
penalty functions on to the original objective
function and minimize from there:
minimize T(x) = f(x) + P(x)
In our example,
minimize T(x) = 100/x + max(0, x – 5)2
A Problem
But… it isn’t quite that easy.
The addition of penalty functions can create severe
slope changes in the graph at the boundary, which
interferes with typical minimization programs.
Fortunately, there are two simple changes that will
alleviate this problem.
First Solution: r
The first is to multiply the quadratic loss function by
a constant, r. This controls how severe the penalty
is for violating the constraint.
The accepted method is to start with r =
10, which is a mild penalty. It will not form
a very sharp point in the graph, but the
minimum point found using r = 10 will not
be a very accurate answer because the
penalty is not severe enough.
First Solution: r
Then, r is increased to 100 and the
function minimized again starting from the
minimum point found when r was 10. The
higher penalty increases accuracy, and as
we narrow in on the solution, the
sharpness of the graph is less of a
problem.
We continue to increase r values until the
solutions converge.
Second Solution: Methods
The second solution is to be thoughtful with
how we minimize. The more useful minimization
programs written in unit 2 were interval
methods. The program started with an interval
and narrowed it in from the endpoints.
With a severe nonlinearity, interval methods
have a tendency to skip right over the minimum.
Second Solution: Methods
For this reason, interval methods are generally
not ideal for penalty functions. It is better to use
methods that take tiny steps from a starting
point, similar to the “brute force” methods we
used in 1-variable, or any of the methods we
used in 2-variable minimization.
It is also important when using penalty functions
to run the program a few times from various
starting points to avoid local extremes.
Practice Problem 2
Write a program that, given an initial point and a
function,
1) uses the derivative to determine the
direction of the minimum
2) takes small steps in that direction until the
function value increases
3) decreases the step size to narrow in on the
minimum
4) reports the minimum value
Test, document and save your code!
The Final Step
Now, back to the example:
minimize f(x) = 100/x
subject to x ≤ 5
has become
minimize T(x) = 100/x + r · (max(0, x – 5)2)
The initial point must be chosen in violation of the
constraint, which is why these are known as
“exterior penalty functions”. We’ll start with x = 20.
Practice Problem 3
Using your step minimization program, minimize
f(x) = 100/x + 10 · (max(0, x – 5))2
from starting point 20. Call your answer “a”.
Then, minimize
f(x) = 100/x + 100 · (max(0, x – 5))2
from starting point a.
Repeat for r = 1000 and r = 10,000.
Practice Problem 4
Write a function that will carry out successive
iterations of raising the value of r and closing
the interval boundaries. Check your loop with
the previous problem, then use it to solve this
problem:
minimize f(x) = 0.8x2 – 2x
subject to x ≤ 4
Test different starting points to see the effect.
Practice Problem 5
Next, solve this problem:
Minimize f(x) = (x – 8)2
subject to x ≥ 10
(Be careful with that ≥! it will affect both your g(x) and
your starting point.)
A Note About Exterior Penalty
Functions
Because exterior penalty functions start outside
the feasible region and approach it from the
outside, they only find extremes that occur on
the boundaries of the feasible region. They will
not find interior extremes.
In order to accomplish that, these are often
used in combination with interior penalty
functions… next lesson!

More Related Content

What's hot

Fuzzy Logic and Neural Network
Fuzzy Logic and Neural NetworkFuzzy Logic and Neural Network
Fuzzy Logic and Neural Network
SHIMI S L
 
Combinatorial optimization CO-1
Combinatorial optimization CO-1Combinatorial optimization CO-1
Combinatorial optimization CO-1
man003
 
Particle Swarm Optimization - PSO
Particle Swarm Optimization - PSOParticle Swarm Optimization - PSO
Particle Swarm Optimization - PSO
Mohamed Talaat
 
Optimization problems and algorithms
Optimization problems and  algorithmsOptimization problems and  algorithms
Optimization problems and algorithms
Aboul Ella Hassanien
 
Multi Objective Optimization
Multi Objective OptimizationMulti Objective Optimization
Multi Objective Optimization
Nawroz University
 
Artificial fish swarm optimization
Artificial fish swarm optimizationArtificial fish swarm optimization
Artificial fish swarm optimization
Ahmed Fouad Ali
 
Instance Based Learning in Machine Learning
Instance Based Learning in Machine LearningInstance Based Learning in Machine Learning
Instance Based Learning in Machine Learning
Pavithra Thippanaik
 
Simulated Annealing - A Optimisation Technique
Simulated Annealing - A Optimisation TechniqueSimulated Annealing - A Optimisation Technique
Simulated Annealing - A Optimisation Technique
AUSTIN MOSES
 
Artificial Bee Colony algorithm
Artificial Bee Colony algorithmArtificial Bee Colony algorithm
Artificial Bee Colony algorithm
Ahmed Fouad Ali
 
Introduction to Optimization.ppt
Introduction to Optimization.pptIntroduction to Optimization.ppt
Introduction to Optimization.ppt
MonarjayMalbog1
 
Automated assembly systems
Automated assembly systemsAutomated assembly systems
Automated assembly systems
Vibhas Purushu
 
Hidden line removal algorithm
Hidden line removal algorithmHidden line removal algorithm
Hidden line removal algorithm
KKARUNKARTHIK
 
Tabu search
Tabu searchTabu search
Tabu search
Ahmed Fouad Ali
 
MACHINE LEARNING - GENETIC ALGORITHM
MACHINE LEARNING - GENETIC ALGORITHMMACHINE LEARNING - GENETIC ALGORITHM
MACHINE LEARNING - GENETIC ALGORITHM
Puneet Kulyana
 
Tsp branch and-bound
Tsp branch and-boundTsp branch and-bound
Tsp branch and-bound
Saravanan Natarajan
 
# Neural network toolbox
# Neural network toolbox # Neural network toolbox
# Neural network toolbox
VineetKumar508
 
8 automated assembly-systems
8 automated assembly-systems8 automated assembly-systems
8 automated assembly-systems
lizard_mn
 

What's hot (20)

Fuzzy Logic and Neural Network
Fuzzy Logic and Neural NetworkFuzzy Logic and Neural Network
Fuzzy Logic and Neural Network
 
Optmization techniques
Optmization techniquesOptmization techniques
Optmization techniques
 
Combinatorial optimization CO-1
Combinatorial optimization CO-1Combinatorial optimization CO-1
Combinatorial optimization CO-1
 
Particle Swarm Optimization - PSO
Particle Swarm Optimization - PSOParticle Swarm Optimization - PSO
Particle Swarm Optimization - PSO
 
Optimization problems and algorithms
Optimization problems and  algorithmsOptimization problems and  algorithms
Optimization problems and algorithms
 
Lecture28 tsp
Lecture28 tspLecture28 tsp
Lecture28 tsp
 
Multi Objective Optimization
Multi Objective OptimizationMulti Objective Optimization
Multi Objective Optimization
 
Artificial fish swarm optimization
Artificial fish swarm optimizationArtificial fish swarm optimization
Artificial fish swarm optimization
 
Instance Based Learning in Machine Learning
Instance Based Learning in Machine LearningInstance Based Learning in Machine Learning
Instance Based Learning in Machine Learning
 
Simulated Annealing - A Optimisation Technique
Simulated Annealing - A Optimisation TechniqueSimulated Annealing - A Optimisation Technique
Simulated Annealing - A Optimisation Technique
 
Artificial Bee Colony algorithm
Artificial Bee Colony algorithmArtificial Bee Colony algorithm
Artificial Bee Colony algorithm
 
Introduction to Optimization.ppt
Introduction to Optimization.pptIntroduction to Optimization.ppt
Introduction to Optimization.ppt
 
Automated assembly systems
Automated assembly systemsAutomated assembly systems
Automated assembly systems
 
Hidden line removal algorithm
Hidden line removal algorithmHidden line removal algorithm
Hidden line removal algorithm
 
Tabu search
Tabu searchTabu search
Tabu search
 
Chap8 new
Chap8 newChap8 new
Chap8 new
 
MACHINE LEARNING - GENETIC ALGORITHM
MACHINE LEARNING - GENETIC ALGORITHMMACHINE LEARNING - GENETIC ALGORITHM
MACHINE LEARNING - GENETIC ALGORITHM
 
Tsp branch and-bound
Tsp branch and-boundTsp branch and-bound
Tsp branch and-bound
 
# Neural network toolbox
# Neural network toolbox # Neural network toolbox
# Neural network toolbox
 
8 automated assembly-systems
8 automated assembly-systems8 automated assembly-systems
8 automated assembly-systems
 

Similar to Penalty functions

Penalty Function Method in Modern Optimization Techniques
Penalty Function Method in Modern Optimization TechniquesPenalty Function Method in Modern Optimization Techniques
Penalty Function Method in Modern Optimization Techniques
Suman Bhattacharyya
 
4optmizationtechniques-150308051251-conversion-gate01.pdf
4optmizationtechniques-150308051251-conversion-gate01.pdf4optmizationtechniques-150308051251-conversion-gate01.pdf
4optmizationtechniques-150308051251-conversion-gate01.pdf
BechanYadav4
 
optmizationtechniques.pdf
optmizationtechniques.pdfoptmizationtechniques.pdf
optmizationtechniques.pdf
SantiagoGarridoBulln
 
AMS_502_13, 14,15,16 (1).pptx
AMS_502_13, 14,15,16 (1).pptxAMS_502_13, 14,15,16 (1).pptx
AMS_502_13, 14,15,16 (1).pptx
bhavypatel2228
 
LP linear programming (summary) (5s)
LP linear programming (summary) (5s)LP linear programming (summary) (5s)
LP linear programming (summary) (5s)
Dionísio Carmo-Neto
 
Daa unit 1
Daa unit 1Daa unit 1
Daa unit 1
jinalgoti
 
Simplex method material for operation .pptx
Simplex method material for operation .pptxSimplex method material for operation .pptx
Simplex method material for operation .pptx
bizuayehuadmasu1
 
AOT2 Single Variable Optimization Algorithms.pdf
AOT2 Single Variable Optimization Algorithms.pdfAOT2 Single Variable Optimization Algorithms.pdf
AOT2 Single Variable Optimization Algorithms.pdf
SandipBarik8
 
Integer Linear Programming
Integer Linear ProgrammingInteger Linear Programming
Integer Linear Programming
SukhpalRamanand
 
Linear Programming
Linear ProgrammingLinear Programming
Linear Programming
Pulchowk Campus
 
Linear Programming Review.ppt
Linear Programming Review.pptLinear Programming Review.ppt
Linear Programming Review.ppt
MArunyNandinikkutty
 
LPP.pptx
LPP.pptxLPP.pptx
LINEAR PROGRAMMING
LINEAR PROGRAMMINGLINEAR PROGRAMMING
LINEAR PROGRAMMING
rashi9
 
Linear Programing.pptx
Linear Programing.pptxLinear Programing.pptx
Linear Programing.pptx
AdnanHaleem
 
Quantitativetechniqueformanagerialdecisionlinearprogramming 090725035417-phpa...
Quantitativetechniqueformanagerialdecisionlinearprogramming 090725035417-phpa...Quantitativetechniqueformanagerialdecisionlinearprogramming 090725035417-phpa...
Quantitativetechniqueformanagerialdecisionlinearprogramming 090725035417-phpa...
kongara
 
CI_L01_Optimization.pdf
CI_L01_Optimization.pdfCI_L01_Optimization.pdf
CI_L01_Optimization.pdf
SantiagoGarridoBulln
 
Chapter 6-INTEGER PROGRAMMING note.pdf
Chapter 6-INTEGER PROGRAMMING  note.pdfChapter 6-INTEGER PROGRAMMING  note.pdf
Chapter 6-INTEGER PROGRAMMING note.pdf
Tsegay Berhe
 
Linear Programming Quiz Solution
Linear Programming Quiz SolutionLinear Programming Quiz Solution
Linear Programming Quiz Solution
Ed Dansereau
 
5163147.ppt
5163147.ppt5163147.ppt
5163147.ppt
Mayurkumarpatil1
 

Similar to Penalty functions (20)

Penalty Function Method in Modern Optimization Techniques
Penalty Function Method in Modern Optimization TechniquesPenalty Function Method in Modern Optimization Techniques
Penalty Function Method in Modern Optimization Techniques
 
4optmizationtechniques-150308051251-conversion-gate01.pdf
4optmizationtechniques-150308051251-conversion-gate01.pdf4optmizationtechniques-150308051251-conversion-gate01.pdf
4optmizationtechniques-150308051251-conversion-gate01.pdf
 
optmizationtechniques.pdf
optmizationtechniques.pdfoptmizationtechniques.pdf
optmizationtechniques.pdf
 
AMS_502_13, 14,15,16 (1).pptx
AMS_502_13, 14,15,16 (1).pptxAMS_502_13, 14,15,16 (1).pptx
AMS_502_13, 14,15,16 (1).pptx
 
LP linear programming (summary) (5s)
LP linear programming (summary) (5s)LP linear programming (summary) (5s)
LP linear programming (summary) (5s)
 
Daa unit 1
Daa unit 1Daa unit 1
Daa unit 1
 
Simplex method material for operation .pptx
Simplex method material for operation .pptxSimplex method material for operation .pptx
Simplex method material for operation .pptx
 
AOT2 Single Variable Optimization Algorithms.pdf
AOT2 Single Variable Optimization Algorithms.pdfAOT2 Single Variable Optimization Algorithms.pdf
AOT2 Single Variable Optimization Algorithms.pdf
 
Integer Linear Programming
Integer Linear ProgrammingInteger Linear Programming
Integer Linear Programming
 
L20 Simplex Method
L20 Simplex MethodL20 Simplex Method
L20 Simplex Method
 
Linear Programming
Linear ProgrammingLinear Programming
Linear Programming
 
Linear Programming Review.ppt
Linear Programming Review.pptLinear Programming Review.ppt
Linear Programming Review.ppt
 
LPP.pptx
LPP.pptxLPP.pptx
LPP.pptx
 
LINEAR PROGRAMMING
LINEAR PROGRAMMINGLINEAR PROGRAMMING
LINEAR PROGRAMMING
 
Linear Programing.pptx
Linear Programing.pptxLinear Programing.pptx
Linear Programing.pptx
 
Quantitativetechniqueformanagerialdecisionlinearprogramming 090725035417-phpa...
Quantitativetechniqueformanagerialdecisionlinearprogramming 090725035417-phpa...Quantitativetechniqueformanagerialdecisionlinearprogramming 090725035417-phpa...
Quantitativetechniqueformanagerialdecisionlinearprogramming 090725035417-phpa...
 
CI_L01_Optimization.pdf
CI_L01_Optimization.pdfCI_L01_Optimization.pdf
CI_L01_Optimization.pdf
 
Chapter 6-INTEGER PROGRAMMING note.pdf
Chapter 6-INTEGER PROGRAMMING  note.pdfChapter 6-INTEGER PROGRAMMING  note.pdf
Chapter 6-INTEGER PROGRAMMING note.pdf
 
Linear Programming Quiz Solution
Linear Programming Quiz SolutionLinear Programming Quiz Solution
Linear Programming Quiz Solution
 
5163147.ppt
5163147.ppt5163147.ppt
5163147.ppt
 

Recently uploaded

一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
ahzuo
 
Adjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTESAdjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTES
Subhajit Sahu
 
Q1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year ReboundQ1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year Rebound
Oppotus
 
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
Timothy Spann
 
一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理
一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理
一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理
74nqk8xf
 
Influence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business PlanInfluence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business Plan
jerlynmaetalle
 
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
Timothy Spann
 
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
axoqas
 
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
dwreak4tg
 
一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单
ewymefz
 
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
pchutichetpong
 
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
axoqas
 
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
u86oixdj
 
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
NABLAS株式会社
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP
 
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
ahzuo
 
The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...
jerlynmaetalle
 
Malana- Gimlet Market Analysis (Portfolio 2)
Malana- Gimlet Market Analysis (Portfolio 2)Malana- Gimlet Market Analysis (Portfolio 2)
Malana- Gimlet Market Analysis (Portfolio 2)
TravisMalana
 
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Subhajit Sahu
 
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
ewymefz
 

Recently uploaded (20)

一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
一比一原版(CBU毕业证)卡普顿大学毕业证如何办理
 
Adjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTESAdjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTES
 
Q1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year ReboundQ1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year Rebound
 
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
 
一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理
一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理
一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理
 
Influence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business PlanInfluence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business Plan
 
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
 
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
 
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
 
一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单
 
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
 
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
 
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
 
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
 
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
 
The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...
 
Malana- Gimlet Market Analysis (Portfolio 2)
Malana- Gimlet Market Analysis (Portfolio 2)Malana- Gimlet Market Analysis (Portfolio 2)
Malana- Gimlet Market Analysis (Portfolio 2)
 
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
 
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
 

Penalty functions

  • 1. Penalty Functions • The Premise • Quadratic Loss • Problems and Solutions
  • 2. The Premise You may have noticed that the addition of constraints to an optimization problem has the effect of making it much more difficult. The goal of penalty functions is to convert constrained problems into unconstrained problems by introducing an artificial penalty for violating the constraint.
  • 3. The Premise Consider this example: Suppose there is a freeway (like a toll freeway) that monitors when you enter and exit the road. Instead of establishing a speed limit of 65 mph, they could use these rules: • You can drive as fast as you want. • If you drive under 65 mph you can use our road for free. • Every mph you drive over 65 will cost you $500.
  • 4. The Premise The previous example had no constraints – you can drive as fast as you want! But the effect of these rules would still be to limit drivers to 65mph. You can also control the likelihood of speeding by adjusting the fine. Penalty functions work in exactly this way.
  • 5. Initial Steps We will be working with a very simple example: minimize f(x) = 100/x subject to x ≤ 5 (With a little thought, you can tell that f(x) will be minimized when x = 5, so we know what answer we should get!) Before starting, convert any constraints into the form (expression) ≤ 0. In this example, x ≤ 5 becomes: x – 5 ≤ 0
  • 6. Initial Steps Once your constraints are converted, the next step is to start charging a penalty for violating them. Since we’re trying to minimize f(x), this means we need to add value when the constraint is violated. If you are trying to maximize, the penalty will subtract value.
  • 7. Quadratic Loss: Inequalities With the constraint x – 5 ≤ 0, we need a penalty that is: • 0 when x – 5 ≤ 0 (the constraint is satisfied) • positive when x – 5 is > 0 (the constraint is violated) This can be done using the operation P(x) = max(0, x – 5) which returns the maximum of the two values, either 0 or whatever (x – 5) is. We can make the penalty more severe by using P(x) = max(0, x – 5)2. This is known as a quadratic loss function.
  • 8. Quadratic Loss: Equalities It is even easier to convert equality constraints into quadratic loss functions because we don’t need to worry about the operation (max, g(x)). We can convert h(x) = c into h(x) – c = 0, then use P(x) = (h(x) – c)2 The lowest value of P(x) will occur when h(x) = c, in which case the penalty P(x) = 0. This is exactly what we want.
  • 9. Practice Problem 1 Convert the following constraints into quadratic loss functions: a) x ≤ 12 b) x2 ≥ 200 c) 2x + 7 ≤ 16 d) e2x + 1 ≥ 9 e) 4x2 + 2x = 12
  • 10. The Next Step Once you have converted your constraints into penalty functions, the basic idea is to add all the penalty functions on to the original objective function and minimize from there: minimize T(x) = f(x) + P(x) In our example, minimize T(x) = 100/x + max(0, x – 5)2
  • 11. A Problem But… it isn’t quite that easy. The addition of penalty functions can create severe slope changes in the graph at the boundary, which interferes with typical minimization programs. Fortunately, there are two simple changes that will alleviate this problem.
  • 12. First Solution: r The first is to multiply the quadratic loss function by a constant, r. This controls how severe the penalty is for violating the constraint. The accepted method is to start with r = 10, which is a mild penalty. It will not form a very sharp point in the graph, but the minimum point found using r = 10 will not be a very accurate answer because the penalty is not severe enough.
  • 13. First Solution: r Then, r is increased to 100 and the function minimized again starting from the minimum point found when r was 10. The higher penalty increases accuracy, and as we narrow in on the solution, the sharpness of the graph is less of a problem. We continue to increase r values until the solutions converge.
  • 14. Second Solution: Methods The second solution is to be thoughtful with how we minimize. The more useful minimization programs written in unit 2 were interval methods. The program started with an interval and narrowed it in from the endpoints. With a severe nonlinearity, interval methods have a tendency to skip right over the minimum.
  • 15. Second Solution: Methods For this reason, interval methods are generally not ideal for penalty functions. It is better to use methods that take tiny steps from a starting point, similar to the “brute force” methods we used in 1-variable, or any of the methods we used in 2-variable minimization. It is also important when using penalty functions to run the program a few times from various starting points to avoid local extremes.
  • 16. Practice Problem 2 Write a program that, given an initial point and a function, 1) uses the derivative to determine the direction of the minimum 2) takes small steps in that direction until the function value increases 3) decreases the step size to narrow in on the minimum 4) reports the minimum value Test, document and save your code!
  • 17. The Final Step Now, back to the example: minimize f(x) = 100/x subject to x ≤ 5 has become minimize T(x) = 100/x + r · (max(0, x – 5)2) The initial point must be chosen in violation of the constraint, which is why these are known as “exterior penalty functions”. We’ll start with x = 20.
  • 18. Practice Problem 3 Using your step minimization program, minimize f(x) = 100/x + 10 · (max(0, x – 5))2 from starting point 20. Call your answer “a”. Then, minimize f(x) = 100/x + 100 · (max(0, x – 5))2 from starting point a. Repeat for r = 1000 and r = 10,000.
  • 19. Practice Problem 4 Write a function that will carry out successive iterations of raising the value of r and closing the interval boundaries. Check your loop with the previous problem, then use it to solve this problem: minimize f(x) = 0.8x2 – 2x subject to x ≤ 4 Test different starting points to see the effect.
  • 20. Practice Problem 5 Next, solve this problem: Minimize f(x) = (x – 8)2 subject to x ≥ 10 (Be careful with that ≥! it will affect both your g(x) and your starting point.)
  • 21. A Note About Exterior Penalty Functions Because exterior penalty functions start outside the feasible region and approach it from the outside, they only find extremes that occur on the boundaries of the feasible region. They will not find interior extremes. In order to accomplish that, these are often used in combination with interior penalty functions… next lesson!