PE
docx
keyboard_arrow_up
School
Multimedia University of Kenya *
*We aren’t endorsed by this school
Course
MANAGERIAL
Subject
Electrical Engineering
Date
Nov 24, 2024
Type
docx
Pages
7
Uploaded by mongaresams
Q1: Potential Energy dynamic problem
The Nelder-Mead simplex method successfully minimized the potential energy function
P
(
x
1
, x
2
)
=
5.2
x
1
2
+
1.8
x
2
2
−
2
x
1
x
2
−
x
1
−
2
x
2
. After 36 iterations, the algorithm
converged to an optimal solution:
x
1
=
0.2273,
x
2
=
0.6818,
f
(
x
1
,x
2
)
=−
0.7955
The convergence criterion, measuring the distance between the highest point x
H
and
the centroid x
CE
, fell below the specified tolerance (0.3), signifying successful
convergence.
The iterative progression of the simplex is summarized in a table, showcasing the
dynamic changes in x
1
, x
2
, and f
(
x
1
,x
2
)
across different steps. The figure
visualizes how the simplex evolved, with the red ' x
' pinpointing the final optimal
point. This graphical representation illustrates the method's ability to navigate the
parameter space efficiently, ultimately identifying the minimum potential energy.
The optimization process demonstrates the efficacy of the Nelder-Mead simplex method
in efficiently finding the optimal solution for the given potential energy function.
# Define the convergence criterion
def convergence_criterion
(
vertices
):
x_L
, x_M
, x_H = vertices
x_CE = (
x_L + x_M + x_H
) / 3
return np
.sqrt(
np
.sum((
x - x_CE
)
**
2 for x in vertices
)) / 3
# Set initial values
x0 = np
.array([
2.0
, 2.0
])
c = 2
# Initialize variables for recording iteration details
iterations = []
results = []
# Define the objective function for the optimization
def objective_function
(
x
):
result = potential_energy
(
x
)
iterations
.
append
(
np
.concatenate((
x
, [
result
])))
results
.
append
(
result
)
return result
# Perform the Nelder-Mead optimization
res = minimize(
objective_function
, x0
, method
=
'nelder-mead'
,
options
=
{
'initial_simplex'
: np
.array([
[
x0
[
0
] + c
, x0
[
1
]],
[
x0
[
0
], x0
[
1
] + c
],
[
x0
[
0
], x0
[
1
]]]),
'maxiter'
: 1000
,
'fatol'
: tol
,
'disp'
: True
})
# Display the optimization results
print
(
"Optimal Solution:"
)
print
(
f
"x1 = {
res
.x[
0
]
:.4f}
, x2 = {
res
.x[
1
]
:.4f}
, f(x1, x2) = {
res
.fun
:.4f}
"
)
# Display the iteration details
#print("\nIterations:")
#print("Iter x1 x2 f(x1, x2)")
#for i, iteration in enumerate(iterations):
# print(f"{i+1:<5} {iteration[0]:.4f} {iteration[1]:.4f}
{iteration[2]:.4f}")
# Plot the iterations
iterations = np
.array(
iterations
)
plt
.
figure
(
figsize
=
(
8
, 6
))
plt
.
scatter
(
iterations
[:, 0
], iterations
[:, 1
], c
=
'red'
, marker
=
'x'
,
label
=
'Iterations'
)
plt
.
plot
(
iterations
[:, 0
], iterations
[:, 1
], linestyle
=
'-'
, color
=
'blue'
, label
=
'Simplex Path'
)
plt
.
scatter
(
res
.x[
0
], res
.x[
1
], c
=
'green'
, marker
=
'o'
, label
=
'Optimal Solution'
)
plt
.
xlabel
(
'x1'
)
plt
.
ylabel
(
'x2'
)
plt
.
title
(
'Nelder-Mead Simplex Method Iterations'
)
plt
.
legend
()
plt
.
grid
(
True
)
plt
.
show
()
Optimization terminated successfully.
Current function value: -0.795455
Iterations: 36
Function evaluations: 72
Optimal Solution:
x
1
=
0.2273,
x
2
=
0.6818,
f
(
x
1,
x
2
)=−
0.7955
Iterations:
14.0000
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
The graph illustrates the convergence of the Nelder-Mead simplex method during the
optimization process for the given potential energy function. Each blue marker
represents the simplex at a particular iteration, and the red marker denotes the final
optimized point.
The method progresses towards the optimal solution by adjusting the simplex
configuration iteratively, demonstrating the algorithm's ability to navigate the parameter
space efficiently. The convergence is evident as the simplex evolves towards the optimal
values of −
¿
1
x
¿
¿
and −
¿
2
x
¿
¿
. The termination point aligns with the minimum potential
energy, achieving a value of -0.7955.
This visual representation enhances our understanding of the optimization process,
showcasing how the algorithm refines its search space. The convergence is in line with
the specified tolerance, highlighting the effectiveness of the Nelder-Mead simplex
method in minimizing the potential energy function.
Q3:
(a) Karush-Kuhn-Tucker (KKT) Method:
The KKT conditions for a constrained optimization problem involve the Lagrangian,
complementary slackness, and gradient of the Lagrangian. The Lagrangian is as follows:
L
(
x
1
, x
2
, λ
)
¿
f
1
(
x
1
, x
2
)
+
λ
(
2
−
(
x
2
−
x
1
)
)
+
μ
1
x
1
+
μ
2
(
x
2
−
x
1
−
2
)
x
2
−
x
1
−
¿
¿
¿
¿
x
1
2
+
x
2
2
−
2
x
1
+
6
+
λ
(
2
−
(
x
2
−
x
1
)
)
+
μ
1
x
1
+
μ
2
¿
¿
¿
Let's denote g
1
(
x
)=
x
2
−
x
1
and g
2
(
x
)=
x
1
−
x
2
+
2
. The problem has two
constraints.
1.
Stationarity:
∂ L
∂x
1
=
2
x
1
−
2
−
λ
+
μ
1
−
μ
2
=
0
∂L
∂ x
2
=
2
x
2
−
2
λ
−
μ
2
=
0
1.
Primal feasibility:
g
1
(
x
)=
x
2
−
x
1
≤
2
g
2
(
x
)=
x
1
−
x
2
+
2
≤
0
1.
Dual feasibility:
λ≥
0,
μ
1
≥
0,
μ
2
≥
0
1.
Complementary słackness:
λ g
1
(
x
)=
0,
μ
1
x
1
=
0,
μ
2
g
2
(
x
)=
0
(b) Solve Each Individual Optimization Problem Graphically: (0) For
f
1
(
x
1
, x
2
)
=
x
1
2
+
x
2
2
−
2
x
1
+
6
subject to 0
≤x
2
−
x
1
≤
2
(ii) For
f
2
(
x
1
, x
2
)
=
x
1
2
+
x
2
2
−
4
x
1
−
10
x
2
+
32
subject to 0
≤x
2
−
x
1
≤
2
(c) Plot the Pareto
Front, Showing the Utopia Point:
Part C: Plot
# Define the objective functions
def f1
(
x1
, x2
):
return x1
**
2 + x2
**
2 - 2
*
x1 + 6
def f2
(
x1
, x2
):
return x1
**
2 + x2
**
2 - 4
*
x1 - 10
*
x2 + 32
# Define the constraint functions
def g1
(
x1
, x2
):
return x2 - x1
def g2
(
x1
, x2
):
return x1 - x2 + 2
# Generate points for plotting
x1 = np
.linspace(
0
, 5
, 100
)
x2_1 = x1
x2_2 = x1 + 2
# Plot the Pareto front
plt
.
figure
(
figsize
=
(
8
, 6
))
plt
.
plot
(
f1
(
x1
, x2_1
), f2
(
x1
, x2_1
), label
=
r
'$0 \l
eq x_2 - x_1 \l
eq 2$'
, color
=
'blue'
)
plt
.
plot
(
f1
(
x1
, x2_2
), f2
(
x1
, x2_2
), linestyle
=
'--'
, color
=
'blue'
)
# Highlight the utopia point (solution to KKT conditions)
utopia_x1 = 1
utopia_x2 = 3
plt
.
scatter
(
f1
(
utopia_x1
, utopia_x2
), f2
(
utopia_x1
, utopia_x2
), color
=
'red'
, marker
=
'x'
, label
=
'Utopia Point'
)
# Label axes and add legend
plt
.
xlabel
(
'$f_1(x_1, x_2)$'
)
plt
.
ylabel
(
'$f_2(x_1, x_2)$'
)
plt
.
title
(
'Pareto Front with Utopia Point'
)
plt
.
legend
()
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
# Show plot
plt
.
grid
(
True
)
plt
.
show
()
Related Documents
Related Questions
Hi please show all work and explanation and math. Thank you!
arrow_forward
1.1
arrow_forward
AND AGAIN...LETS GO AGAIN... I CAN NOT READ IMAGES.. STOP RESPONDING WITH IMAGES/GRAPHICS. IS THAT MORE COMPLICATED THAN THIS MATH? PLEASE RESPOND IN TEXT...THE LITERAL CHARACTERS YOU ARE READING RIGHT NOW.
UNIVERSITY OF PHYSICS 24.55
In (Figure 1), C1C1C_1 = 3.50 μFμF and VabVabV_ab = 160 VV. The charge on capacitor C1C1 is 150 μCμC and the charge on C3C3 is 450 μCμC.
Figure
1 of 1
Part A
What is the value of the capacitance of C2C2?
Express your answer with the appropriate units.
Part B
What is the value of the capacitance of C3C3?
Express your answer with the appropriate units.
THE FIGURE DESCRIPTION GIVEN:
A circuit consists of 3 capacitors.The circuit
has endpoints A and B, and is divided into 2 parts by point D. C_1 and C_2 are connected in parellel between points A and D. Capacitors c_3 is located between points B and D.
THAT IS IT. you literly don't get ANY MORE INFORMATION THAN THAT. So don't reject me again for that lie and please don't…
arrow_forward
Student number: 1700123
arrow_forward
Hello. I am confused which route to take for this problem. I could break it into parts, but do I put it into its odd and even functions for symmetry? Could you guide me through this problem?
Thank you for your help.
arrow_forward
TngGrapns: A Not Secure math.webwork.rochester.edu/webwork2_.
Previous Problem
Problem List
Next
1.0
12
1.0
(Click on graph to enlarge)
For the sine function given in the graph
its amplitude is
its period is
its phase shift is
its vertical displacement is
-6
Note: You can earn partial credit on this problem.
Preview My Answers
Submit Answers
You have attempted this problem 0 times.
You have unlimited attempts remaining.
arrow_forward
Linear Algebra:
kindly answer in Proper way step by step:
Please solve it on emergency basis, less than ONe hour please:
Mention name "Shahzad Ali" "F2019266015" on the top of the every page:
Circuit is inside the image:
Analyze the circuit given below to find the unknown currents i1,i2,i3,i4,i5and i6 by developing a system of linear equations. Then apply Gauss-Jordan elimination method to solve the developed system.
arrow_forward
Please answer question 1 with details on how to do it. Make handwriting legible. Thank you.
arrow_forward
The Nyquist plot of the OLTF of a closed-loop system is shown below:
Imaginary Axis
Answer:
4
3
2
-2
-3
-4
-2
0
The OLTF has no poles at the RHP.
What is the value of N?
1
O The closed-loop system is stable.
O The closed-loop system is unstable.
Nyquist Diagram
2
Real Axis
3
4
5
6
arrow_forward
Q2: Use the Routh stability criterion to determine the number of roots in the left-
half plane, the right-half plane, and on the imaginary axis for the given
characteristic equation:
A(s) = s7 + 5s6 + 9s5 + 9s* + 4s³ + 20s2 + 36s + 36 = 0
%3D
Draw conclusions about the stability of the closed-loop system.
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you

Power System Analysis and Design (MindTap Course ...
Electrical Engineering
ISBN:9781305632134
Author:J. Duncan Glover, Thomas Overbye, Mulukutla S. Sarma
Publisher:Cengage Learning
Related Questions
- Hi please show all work and explanation and math. Thank you!arrow_forward1.1arrow_forwardAND AGAIN...LETS GO AGAIN... I CAN NOT READ IMAGES.. STOP RESPONDING WITH IMAGES/GRAPHICS. IS THAT MORE COMPLICATED THAN THIS MATH? PLEASE RESPOND IN TEXT...THE LITERAL CHARACTERS YOU ARE READING RIGHT NOW. UNIVERSITY OF PHYSICS 24.55 In (Figure 1), C1C1C_1 = 3.50 μFμF and VabVabV_ab = 160 VV. The charge on capacitor C1C1 is 150 μCμC and the charge on C3C3 is 450 μCμC. Figure 1 of 1 Part A What is the value of the capacitance of C2C2? Express your answer with the appropriate units. Part B What is the value of the capacitance of C3C3? Express your answer with the appropriate units. THE FIGURE DESCRIPTION GIVEN: A circuit consists of 3 capacitors.The circuit has endpoints A and B, and is divided into 2 parts by point D. C_1 and C_2 are connected in parellel between points A and D. Capacitors c_3 is located between points B and D. THAT IS IT. you literly don't get ANY MORE INFORMATION THAN THAT. So don't reject me again for that lie and please don't…arrow_forward
- Student number: 1700123arrow_forwardHello. I am confused which route to take for this problem. I could break it into parts, but do I put it into its odd and even functions for symmetry? Could you guide me through this problem? Thank you for your help.arrow_forwardTngGrapns: A Not Secure math.webwork.rochester.edu/webwork2_. Previous Problem Problem List Next 1.0 12 1.0 (Click on graph to enlarge) For the sine function given in the graph its amplitude is its period is its phase shift is its vertical displacement is -6 Note: You can earn partial credit on this problem. Preview My Answers Submit Answers You have attempted this problem 0 times. You have unlimited attempts remaining.arrow_forward
- Linear Algebra: kindly answer in Proper way step by step: Please solve it on emergency basis, less than ONe hour please: Mention name "Shahzad Ali" "F2019266015" on the top of the every page: Circuit is inside the image: Analyze the circuit given below to find the unknown currents i1,i2,i3,i4,i5and i6 by developing a system of linear equations. Then apply Gauss-Jordan elimination method to solve the developed system.arrow_forwardPlease answer question 1 with details on how to do it. Make handwriting legible. Thank you.arrow_forwardThe Nyquist plot of the OLTF of a closed-loop system is shown below: Imaginary Axis Answer: 4 3 2 -2 -3 -4 -2 0 The OLTF has no poles at the RHP. What is the value of N? 1 O The closed-loop system is stable. O The closed-loop system is unstable. Nyquist Diagram 2 Real Axis 3 4 5 6arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Power System Analysis and Design (MindTap Course ...Electrical EngineeringISBN:9781305632134Author:J. Duncan Glover, Thomas Overbye, Mulukutla S. SarmaPublisher:Cengage Learning

Power System Analysis and Design (MindTap Course ...
Electrical Engineering
ISBN:9781305632134
Author:J. Duncan Glover, Thomas Overbye, Mulukutla S. Sarma
Publisher:Cengage Learning