Download presentation
Presentation is loading. Please wait.
Published byJanel Mason Modified over 6 years ago
1
Chapter 6 Nonlinear Equations and Optimization Problems
Solving Applied Mathematical Problems with MATLAB CRC/Taylor & Francis Press Chinese version by Tsinghua University Press PPT by Wenbin Dong and Jun Peng, Northeastern University, PRC Proofread by Dingyu Xue & YangQuan Chen 星期四, , 22:08:13 Slide 1 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
2
Chapter 6 Nonlinear Equations and Optimization Problems
Solutions to Nonlinear Algebraic Equations Solving Unconstrained Optimization Problems Solving Constrained Optimization Problems Solving Mixed Integer Programming Problems Linear Matrix Inequalities 星期四, , 22:08:13 Slide 2 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
3
6.1 Solutions to Nonlinear Algebraic Equations
Graphical method for solving nonlinear equations Quasi-analytical solutions to polynomial-type equations Numerical solutions to ordinary nonlinear equations Solutions to nonlinear matrix equations 星期四, , 22:08:13 Slide 3 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
4
6.1.1 Graphical method for solving nonlinear equations
Graphically solving nonlinear equations of a single variable Graphically solving nonlinear equations of two variables Not suitable more equations with more variables 星期四, , 22:08:13 Slide 4 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
5
Graphically solving nonlinear equations of a single variable
The function ezplot() can be used to draw the curves from the implicit function The real solutions to the equations can be retrieved from the intersections of the curves with 星期四, , 22:08:13 Slide 5 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
6
Example 6.1 Graphically solve : MATLAB commands: Verification:
星期四, , 22:08:13 Slide 6 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
7
Graphically solving nonlinear equations of two variables
Use ezplot() function to draw the all the equations. The intersections of the curves are then the solutions to the original simultaneous equations 星期四, , 22:08:13 Slide 7 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
8
Example 6.2 Graphically solve the following:
Plot of the first function: Plot of the second function: 星期四, , 22:08:13 Slide 8 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
9
The rectangular region can be selected
星期四, , 22:08:13 Slide 9 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
10
6.1.2 Quasi-analytical solutions to polynomial-type equations
Special equations such as polynomial equations, may be of high order Abel-Ruffini Theorem claim that no analytical solution method for 5+th order equation Numerical solution not accurate High precision methods exist Many equations can be converted into polynomial equations 星期四, , 22:08:13 Slide 10 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
11
Example 6.3 Graphically solve MATLAB command solutions:
星期四, , 22:08:13 Slide 11 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
12
The syntax to solve polynomial-type equations
the simplest direct solutions variables specified 星期四, , 22:08:13 Slide 12 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
13
Example 6.4 Applying solve() function to solve
MATLAB command solutions: Verification: 星期四, , 22:08:13 Slide 13 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
14
Example 6.5 Solve MATLAB command solutions: Verification:
星期四, , 22:08:13 Slide 14 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
15
When the last equation is changed into
MATLAB command solutions: 星期四, , 22:08:13 Slide 15 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
16
Example 6.6 Solve MATLAB command solutions: 星期四, 2008-4- 24, 22:08:13
星期四, , 22:08:13 Slide 16 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
17
Verification: 星期四, 2008-4- 24, 22:08:13
星期四, , 22:08:13 Slide 17 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
18
Example 6.7 Solve the equations with constants
MATLAB command solutions: 星期四, , 22:08:13 Slide 18 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
19
6.1.3 Numerical solutions to ordinary nonlinear equations
The syntax of getting real numerical solutions to given nonlinear equations simple syntax formal syntax 星期四, , 22:08:13 Slide 19 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
20
The syntax of selecting methods and control accuracies
get default control template set control parameters Or 星期四, , 22:08:13 Slide 20 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
21
Procedures in Solving Numerically Algebraic Equations
Set the variables, so that the equations are Describe the equations with M-function Anonymous function Inline function, again not recommended Solve the equations Verify the solutions 星期四, , 22:08:13 Slide 21 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
22
Example 6.8 Given select variables and convert the original ODEs to
Matrix form 星期四, , 22:08:13 Slide 22 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
23
Ways of describing the equation
M-function Anonymous function Inline function 星期四, , 22:08:13 Slide 23 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
24
When the initial values are
When another initial search point used NOTE: the selection of different initial values may lead to different solutions. 星期四, , 22:08:13 Slide 24 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
25
Example 6.9 Lambert function , is variable, is the solution of For different , solve and plot Solution tactics and procedure Use for loop Use anonymous function to describe Generate w vector Plot the curve of the function MATLAB solutions: 星期四, , 22:08:13 Slide 25 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
26
Direct solution, with lambertw function:
MATLAB statements Direct solution, with lambertw function: 星期四, , 22:08:13 Slide 26 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
27
Example 6.10 Solve numerically Using the solve() function
Using graphical method for initial value: 星期四, , 22:08:13 Slide 27 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
28
Re-setting the relevant precision control variables
The expected precision may not be reached However the best result under double-precision scheme can be obtained 星期四, , 22:08:13 Slide 28 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
29
Summary of three types of algebraic equation solution methods
Graphical methods, ezplot Advantages: all real solutions within a region can be found; good overview for the solutions Disadvantages: Only applicable to 1D and 2D equations; not accurate; only real solutions Quasi-analytical methods, solve Advantages: Real/imaginary, more accurate Disadvantages: Only applies to polynomial type equations; not allowed to select initial point 星期四, , 22:08:13 Slide 29 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
30
Pure numerical methods fsolve
Advantages: Can be used to solve multi-dimensional nonlinear equations; freely select initial search point, accurate than graphical method Disadvantages: Imaginary solutions cannot be found; for polynomial type equations, not so good Combination of algorithms, hints For 1D and 2D equations, use graphical method to spot an approximate solution Use the solution as an initial point, search for more accurate solutions with fsolve 星期四, , 22:08:13 Slide 30 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
31
6.1.4 Solutions to nonlinear matrix equations
Riccati equation in Chapter 4, exploration More nonlinear matrix equations, e.g., Generalized Riccati equation Modified Riccati equation Many many more matrix equations 星期四, , 22:08:13 Slide 31 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
32
Riccati equation solver
fsolve() can only solve , not vector , vector , no matrices involved Convert matrix equation into vector equations Vector to matrix math MATLAB Matrix to vector 星期四, , 22:08:13 Slide 32 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
33
M-function to describe Riccati equation in vector form
A new function to solve Riccati equation 星期四, , 22:08:13 Slide 33 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
34
Example 6.11 Solve the following Riccati equations: with
星期四, , 22:08:13 Slide 34 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
35
Repeated use of MATLAB commands:
are() function may find one Repeated use of MATLAB commands: Another solution 星期四, , 22:08:13 Slide 35 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
36
Example 6.12 Given where find and verify all the possible solutions
星期四, , 22:08:13 Slide 36 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
37
For the Riccati-like equation Another M-function
Another matrix equation solver 星期四, , 22:08:13 Slide 37 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
38
Repeated MATLAB command:
Be patient, some of the solutions may be difficult to find. Run the function multiple times 星期四, , 22:08:13 Slide 38 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
39
Possible solutions, all passed verifications
星期四, , 22:08:13 Slide 39 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
40
6.2 Solving Unconstrained Optimization Problems
Analytical solutions and graphical solution methods Numerical solution using MATLAB Global minima and local minima Solving optimization problems using gradient information Optimization problems with boundary constraints 星期四, , 22:08:13 Slide 40 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
41
Mathematical description
The mathematical description to unconstrained minimization problems Objective function is a scalar one vector decision variables, or optimum variables Physical meaning: find the vector that minimizes the objective function Maximization problem, 星期四, , 22:08:13 Slide 41 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
42
6.2.1 Analytical solutions and graphical solution methods
The necessary conditions for an unconstrained optimization problem where is the optimum point Equation solution may be more difficult, also second-order derivatives needed 星期四, , 22:08:13 Slide 42 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
43
Example 6.13 Study the optimality of
Plot of the first order derivative function of 星期四, , 22:08:13 Slide 43 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
44
Draw the first-order derivative and verify positive 2nd-order derivative
星期四, , 22:08:13 Slide 44 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
45
6.2.2 Numerical solution using MATLAB
The syntax of finding numerical solution simplest statement Or more general form 星期四, , 22:08:13 Slide 45 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
46
Describing the objective function
M-function, Anonymous function Inline function, again not recommended No intermediate variable allowed in anonymous function or inline function 星期四, , 22:08:13 Slide 46 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
47
Example 6.14 Given , find its minimum. Using fminsearch():
Using fminunc(): 星期四, , 22:08:13 Slide 47 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
48
Draw the searching trajectory:
星期四, , 22:08:13 Slide 48 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
49
星期四, , 22:08:13 Slide 49 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
50
6.2.3 Global minimums and local minimums
The necessary condition for a minimum point to exist is that Using search method, only one such a point may be found from a given initial point. It is the global minimum. 星期四, , 22:08:13 Slide 50 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
51
Example 6.15 Given observe that different initial values give different minima. Construct objective function The initial search point is 星期四, , 22:08:13 Slide 51 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
52
The initial search point is Plot of for :
星期四, , 22:08:13 Slide 52 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
53
6.2.4 Solving optimization problems using gradient information
The optimums may not be obtained using the information provided in the objective function alone, since the convergence speed for solving optimization problems may be very low. The gradient information can be used to solve the problem. 星期四, , 22:08:13 Slide 53 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
54
Example 6.16 Solving unconstrained optimization problem for the Rosenbrock function: Plotting the 3D contour map: 星期四, , 22:08:13 Slide 54 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
55
Without the gradient information
Determine the gradient matrix 星期四, , 22:08:13 Slide 55 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
56
Prepare the objective function:
Solve the optimization problem 星期四, , 22:08:13 Slide 56 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
57
6.2.5 Optimization problems with boundary constraints
The mathematical description to boundary constraints problem is where the notation s.t. means subject to John D'Errico, fminsearchbnd function, on CD 星期四, , 22:08:13 Slide 57 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
58
The syntax of finding optimization problems with boundary constraints
simplest statement more general form 星期四, , 22:08:13 Slide 58 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
59
Example 6.17 Solving Rosenbrock problem where and .
MATLAB command solutions: 星期四, , 22:08:13 Slide 59 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
60
6.3 Solving Constrained Optimization Problems
Constraints and feasibility regions Solving linear programming problems Solving quadratic programming problems Solving general nonlinear programming problems 星期四, , 22:08:13 Slide 60 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
61
6.3.1 Constraints and feasibility regions
The general description of constrained nonlinear optimization problems: where All x satisfying the constraints form the so-called feasible region. 星期四, , 22:08:13 Slide 61 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
62
Example 6.18 Graphically solve: The objective function
The feasible region 星期四, , 22:08:13 Slide 62 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
63
Illustration of feasible region
星期四, , 22:08:13 Slide 63 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
64
6.3.2 Solving linear programming problems
The general mathematical description to linear programming (LP) problems All linear Note, standard form 星期四, , 22:08:13 Slide 64 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
65
The syntaxes of solving LP problems:
星期四, , 22:08:13 Slide 65 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
66
Example 6.19 Solve the following LP problem:
Describing the problem in MATLAB 星期四, , 22:08:13 Slide 66 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
67
Solutions via simple command
Control precision 星期四, , 22:08:13 Slide 67 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
68
Example 6.20 Solve the following LP problem:
Convert the problem into minimization problem first 星期四, , 22:08:13 Slide 68 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
69
MATLAB command solutions:
星期四, , 22:08:13 Slide 69 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
70
Example 6.21 Find the solution to the LP problem Multiple subscripts
星期四, , 22:08:13 Slide 70 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
71
Rearrange the variables into single subscript
The original problem can then be rewritten as 星期四, , 22:08:13 Slide 71 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
72
MATLAB command solutions:
星期四, , 22:08:13 Slide 72 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
73
6.3.3 Solving quadratic programming problems
The general form of quadratic programming One should establish the matrices first 星期四, , 22:08:13 Slide 73 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
74
The syntaxes of solving quadratic programming problems:
星期四, , 22:08:13 Slide 74 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
75
Example 6.22 Solve the following QP problem:
Find relevant matrices first 星期四, , 22:08:13 Slide 75 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
76
The objective function is rewritten
The matrices 星期四, , 22:08:13 Slide 76 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
77
MATLAB command solutions:
where we omit the constant 30 星期四, , 22:08:13 Slide 77 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
78
6.3.4 Solving general nonlinear programming problems
The general form of nonlinear programming where Physical interpretation: under the given constraints, find to minimize the objective function 星期四, , 22:08:13 Slide 78 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
79
Solving nonlinear programming problems
For simplicity Solving nonlinear programming problems 星期四, , 22:08:13 Slide 79 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
80
Example 6.23 Solve the nonlinear programming problem
Write M-functions, for objective function and constraints, the latter returns two variables 星期四, , 22:08:13 Slide 80 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
81
Prepare the nonlinear constraint function:
Express the objective function 星期四, , 22:08:13 Slide 81 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
82
Using fmincon() to get a solution:
More accurate solutions 星期四, , 22:08:13 Slide 82 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
83
Simplifying the nonlinear constraint function:
Get a solution: 星期四, , 22:08:13 Slide 83 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
84
Example 6.24 Using the gradient information to solve the following and compare the results. 星期四, , 22:08:13 Slide 84 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
85
The Jacobian matrix, can be derived
Re-write the objective function 星期四, , 22:08:13 Slide 85 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
86
Using fmincon() to get a solution:
星期四, , 22:08:13 Slide 86 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
87
6.4 Solving Mixed Integer Programming Problems
Solving binary programming problems 星期四, , 22:08:13 Slide 87 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
88
6.4.1 Solving mixed integer programming problems
One of the most frequently used algorithm for mixed integer programming problems is the branch-and-bound algorithm Free toolbox by Mr.Keort Kuipers The Toolbox is given on the CD Very light modifications by D Xue, for MATLAB R2008a 星期四, , 22:08:13 Slide 88 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
89
Fun should be a quoted file name, not @...
Call the function vector to indicate the variable in should be an integer, and 0 for a real number Fun should be a quoted file name, If err returned is empty, successful 星期四, , 22:08:13 Slide 89 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
90
Fine tuning of the function
Before call, After call, truncate the unwanted digits 星期四, , 22:08:13 Slide 90 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
91
Example 6.25 Assume , use bnb20() to solve ILP
The objective function, no anonymous function 星期四, , 22:08:13 Slide 91 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
92
Determine the ILP errmsg is empty, hence successful
星期四, , 22:08:13 Slide 92 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
93
For small-scale problems, the enumerate method can be used
If n=20 is changed to 30, extremely large memory required for computers 星期四, , 22:08:13 Slide 93 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
94
The sub-optimum solutions
If one requires to be integers, while the other two variables can be arbitrarily chosen 星期四, , 22:08:13 Slide 94 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
95
Enumerate method summary
Advantages Ensure global optimum Apart from optimum, sub-optima also possible Simple for small scale problems Disadvantages Heavy computation load/memory use Not possible for large or even medium scale problems. 星期四, , 22:08:13 Slide 95 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
96
Example 6.26 Solve the modified Rosenbrock problem where
and are integers The objective function 星期四, , 22:08:13 Slide 96 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
97
MATLAB command solutions:
星期四, , 22:08:13 Slide 97 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
98
The interval is , and using the enumerate method
星期四, , 22:08:13 Slide 98 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
99
6.4.2 Solving binary programming problems
Binary linear programming MATLAB function Binary nonlinear programming, use bnb20() Set lower bounds to a zero vector Set upper bounds to a vector of all ones Use bnb20() directly 星期四, , 22:08:13 Slide 99 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
100
Example 6.27 Solve the binary linear programming problem
MATLAB command solutions: 星期四, , 22:08:13 Slide 100 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
101
All the feasible solutions
The enumerate method All the feasible solutions 星期四, , 22:08:13 Slide 101 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
102
Example 6.28 Using bnb20() to solve the following:
Prepare the objective function 星期四, , 22:08:13 Slide 102 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
103
6.5 Linear Matrix Inequalities
A general introduction to LMIs Lyapunov inequalities Classifications of LMI problems LMI problem solutions with MATLAB Optimization of LMI problems by YALMIP Toolbox 星期四, , 22:08:13 Slide 103 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
104
6.5.1 A general introduction to LMIs
The general mathematical description of LMIs where is the coefficient vector of a polynomial, and are Hermitian matrices 星期四, , 22:08:13 Slide 104 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
105
Some LMIs can be combined into a single LMI , where
If the LMI matrix is a negative-definite matrix, the solution is convex where Some LMIs can be combined into a single LMI , where 星期四, , 22:08:13 Slide 105 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
106
6.5.2 Lyapunov inequalities
The mathematical description of a Lyapunov inequality where is a symmetrical matrix, with 星期四, , 22:08:13 Slide 106 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
107
Construct an MATLAB function to solve
星期四, , 22:08:13 Slide 107 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
108
continued from the previous slide
The syntax : 星期四, , 22:08:13 Slide 108 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
109
Example 6.29 Given find the LMI representation for it. For a matrix, writes out in its LMI form. MATLAB command solutions: 星期四, , 22:08:13 Slide 109 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
110
Math description of LMI form
For X matrix Math description of LMI form 星期四, , 22:08:13 Slide 110 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
111
For a symbolic matrix results 星期四, 2008-4- 24, 22:08:13
星期四, , 22:08:13 Slide 111 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
112
The Schur complement Given a partitioned matrix with
where , is a square. Then, the following three cases are equivalence. with 星期四, , 22:08:13 Slide 112 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
113
Algebraic Riccati inequality
where The original nonlinear inequality can equivalently be converted into the following LMIs 星期四, , 22:08:13 Slide 113 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
114
6.5.3 Classifications of LMI problems
Feasible solution problem The feasible solution problem is in fact find the solution where the minimized is to be found. If can be found, there exist solutions to the original problem, otherwise there is no feasible solution. 星期四, , 22:08:13 Slide 114 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
115
Linear objective function minimization problems
Given this problem can also be solved using ordinary linear programming methods 星期四, , 22:08:13 Slide 115 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
116
The generalized eigenvalue problems
The generalized eigenvalue problems can be expressed as a special LMI problem. The expression can be expressed by general matrix as where¸ is regarded as the generalized eigenvalue. The optimization problem can be established 星期四, , 22:08:13 Slide 116 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
117
6.5.4 LMI problem solutions with MATLAB
The ways to describe LMIs in MATLAB Create a LMI model Define the decision variables where specifies the type of the decision matrix, 星期四, , 22:08:13 Slide 117 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
118
Describe LMIs in partitioned form
where Normally, the term is APB If , then k=-k If flag=‘s’, the term is If the term is constant, then P=0, and B omitted Confirm the LMI model 星期四, , 22:08:13 Slide 118 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
119
Solve the LMI problem Feasible solution Linear objective function
Generalized eigenvalues 星期四, , 22:08:13 Slide 119 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
120
Example 6.30 Given for the Riccati inequality
find a feasible positive-definite solution 星期四, , 22:08:13 Slide 120 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
121
MATLAB command solutions:
星期四, , 22:08:13 Slide 121 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
122
6.5.5 Optimization of LMI problems by YALMIP Toolbox
YALMIP, Dr.Johan Löfberg, Division of Automatic Control, Department of Electrical Engineering Linköping University, Sweden Now becoming an easy to use optimization problem modeling and solving language Close to math form New version available on CD 星期四, , 22:08:13 Slide 122 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
123
Decision variable declaration
Symmetrical matrix Rectangular matrix Integer variable Binary form Other forms, such as Hankel matrix, hankel() 星期四, , 22:08:13 Slide 123 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
124
Constraints can be declared with [ ] Optimization problem solutions
find the feasible solutions optimization problem for objective function options are allowed such as algorithm selection 星期四, , 22:08:13 Slide 124 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
125
Example 6.31 Given Use YALMIP Toolbox to solve the Riccati inequality
星期四, , 22:08:13 Slide 125 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
126
MATLAB command solutions:
Much simpler than RCT 星期四, , 22:08:13 Slide 126 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
127
Example 6.32 Solve the linear programming problem
MATLAB command solutions: 星期四, , 22:08:13 Slide 127 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
128
Assume that the decision variables are integers
Mixed integer programming 星期四, , 22:08:13 Slide 128 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
129
Example 6.33 For a linear system where 星期四, 2008-4- 24, 22:08:13
星期四, , 22:08:13 Slide 129 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
130
The LMI problem can also be posed into the LMI framework
Find the norm for the system. 星期四, , 22:08:13 Slide 130 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
131
MATLAB command solutions:
星期四, , 22:08:13 Slide 131 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
132
Chapter summary Relevant functions 星期四, 2008-4- 24, 22:08:13
星期四, , 22:08:13 Slide 132 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
133
星期四, , 22:08:13 Slide 133 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
134
Solving nonlinear equations is a common task in engineering practice
Solving nonlinear equations is a common task in engineering practice. In this chapter, we first introduced some simple graphical solution methods and symbolic solution command “solve( )” in Symbolic Math Toolbox and the command “fsolve( )” in Optimization Toolbox. We introduced how to solve unconstrained optimization problems in MATLAB and we also clarified the concept of “global solution” and “local solution”. 星期四, , 22:08:13 Slide 134 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
135
The constrained optimization problem formulation the concept of feasible region are introduced. We focused on using MATLAB to solve various optimization problems such linear programming, quadratic programming In MATLAB 7.0, a new command bintprog( ) has been provided to solve 0-1 integer programming, which is also solvable by using bnb20( ) 星期四, , 22:08:13 Slide 135 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
136
We introduced the integer programming problem formulation and its solution using a dedicated toolbox for integer LP. For general integer and mixed-integer programming problems, we introduced the branch-and-bound solver bnb20( ) So far, the most powerful toolbox for optimization problems is the commercial package called TOMLAB ( It is highly integrated with almost all available advanced optimization algorithms. 星期四, , 22:08:13 Slide 136 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
137
Linear matrix inequality problems are also explored in the chapter
Linear matrix inequality problems are also explored in the chapter. Two ways of solving such problems are presented: Robust Control Toolbox, with standard ways to represent the LMIs and three type of LMI problems can be solved with relevant functions YALMIP modeling package, where LMI modeling can be specified in a much simpler and straightforward way. LMI problems as well as other optimization problems can be solved easily with YALMIP 星期四, , 22:08:13 Slide 137 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
138
Finally, genetic algorithm based optimization method and particle swarm optimization method are believed to be able to achieve the global solution. The “nature-inspired optimization techniques” will be introduced in Chapter 10/Section 10.3, which are treated as nontraditional applied math problems 星期四, , 22:08:13 Slide 138 (of 138) Dingyü Xue and YangQuan Chen, Solving Applied Mathematical Problems with MATLAB, CRC Press, 2008
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.