当前位置:网站首页>Mathematical modeling - nonlinear programming
Mathematical modeling - nonlinear programming
2022-06-25 17:16:00 【Herding cattle】
Catalog
The solution of nonlinear programming
Unconstrained extreme value problem
Nonlinear programming : A mathematical expression describing the objective function or constraints , At least one is a nonlinear function .
Basic concepts
remember
yes n Dimensional space
A point in (n Dimension vector ),
,
,
Is defined in
Real valued functions on . if f,g,h At least one of the functions is x The nonlinear function of , It is called the general form of nonlinear programming model :

Global optimal solution : if
, also
There are
, said
Is the global optimal solution .
Locally optimal solution :x In the neighborhood of ( Also included in the feasible region ),x The corresponding function value is the smallest , be x Is the local optimal solution .
Unconstrained nonlinear programming problem It can be expressed as :

convex programming
Convex programming is a special nonlinear programming problem , The global optimal solution can be obtained .
convex set :

Convex function :

The nonnegative linear combination of finite convex functions defined on a convex set is still convex
Discriminant theorem


The determinant of a positive semidefinite matrix is nonnegative .
Hesse matrix :

For the general form of nonlinear programming model , if f(x) Is a convex function ,g(x) Is a convex function ,h(x) by Linear function , Then the nonlinear programming problem is called convex programming . The local optimal solution of convex programming is the global optimal solution , The set of optimal solutions forms a convex set . When the objective function is strictly convex , The optimal solution must be unique .
Example

f(x) and g2(x) Determinant of the Hesse matrix :

Other constraints are linear functions , So it's a convex programming problem
clc,clear
prob = optimproblem;
x = optimvar('x',2,'LowerBound',0);
prob.Objective = sum(x.^2)-4*x(1)+4;
con = [-x(1)+x(2)-2 <= 0
x(1)^2-x(2)+1 <= 0];
prob.Constraints.con = con;
x0.x = rand(2,1)% Nonlinear programming must be given an initial value ,x0 Name at will
[s,f,flag,o] = solve(prob,x0);
s.x
ans =
0.5536
1.3064
Quadratic programming model
The objective function is a quadratic function of the decision vector , The constraints are linear , Then this model is called quadratic programming model , General form :

![]()
among :

When H Positive definite when , The objective function is minimized when , The model is convex quadratic programming , The local optimal solution of convex quadratic programming is the global optimal solution . If not convex programming , It is recommended to use fmincon function .
Example


The objective function is to minimize , however H Is a negative definite matrix , So it's not convex programming .
clc,clear
x = optimvar('x',2,'LowerBound',0);
h = [-1,-0.15;-0.15,-2];
f = [98;277];
a = [1,1;1,-2];
b = [100;0];
prob = optimproblem('Objective',x'*h*x+f'*x);
prob.Constraints = a*x <= b;
[s,f,flag,o] = solve(prob);
s.xans =
1
1
[1,1] Is the local optimal solution , Use fmincon function :

fx = @(x)x'*h*x+f'*x;
[x,y] = fmincon(fx,rand(2,1),a,b,[],[],[0;0],[])x =
1.0e-07 *
0.2533
0.3400
y =1.1901e-05
The solution of nonlinear programming
Unconstrained extreme value problem
MATLAB The functions used to solve unconstrained minima in the toolbox are :


Example
![]()
clc,clear
f = @(x) x(1)^3-x(2)^3+3*x(1)^2+3*x(2)^2-9*x(1);
g = @(x) -f(x);
[m1,n1] = fminunc(f,[0,0])% Find the minimum
[m2,n2] = fminsearch(g,[0,0]);% Find the maximum
m2,-n2m1 =
1.0000 -0.0000
n1 =-5
m2 =-3.0000 2.0000
ans =31.0000

Constrained extremum problem
There are also solver based solutions and problem-based solutions
Solver based solution
The standard form of the mathematical model is :


example :

clc,clear
fun1 = @(x) sum(x.^2)+8;
[x,y] = fmincon(fun1,rand(3,1),[],[],[],[],zeros(3,1),[],@fun2)
function [c,ceq] = fun2(x)
c = [-x(1)^2+x(2)-x(3)^2
x(1)+x(2)^2+x(3)^3-20];
ceq = [-x(1)-x(2)^2+2
x(2)+2*x(3)^2-3];
endProblem based solution
clc,clear
x = optimvar('x',3,'LowerBound',0);
prob = optimproblem('Objective',sum(x.^2)+8);
con1 = [-x(1)^2+x(2)-x(3)^2 <= 0
x(1)+x(2)^2+x(3)^3 <= 20];
con2 = [-x(1)-x(2)^2+2 == 0
x(2)+2*x(3)^2 == 3];
prob.Constraints.con1 = con1;
prob.Constraints.con2 = con2;
x0.x = rand(3,1);
[s,f,flag,out] = solve(prob,x0);
s.x,f
other
The return value of an anonymous function can only have one , It could be a vector .
边栏推荐
猜你喜欢

揭秘GES超大规模图计算引擎HyG:图切分

ddia数据密集型应用系统设计 整理

「津津乐道播客」#386 原汤话原食:谁还不是个“白字先生”?

The art of code annotation. Does excellent code really need no annotation?

SMART PLC如何构造ALT指令

二十九-使用RealSenseD435进行ORBSLAM2实时三维重建

Sword finger offer 50 First character that appears only once

Involution? Foam? Change? Ten questions directly hit the core puzzle of "meta universe" – the essence of "ask ta- Wang Lei about the time of the universe"

知道这些面试技巧,让你的测试求职少走弯路

剑指 Offer 39. 数组中出现次数超过一半的数字
随机推荐
SMART PLC如何构造ALT指令
XXIX - orbslam2 real-time 3D reconstruction using realsensed435
On Web 3.0
学习太极创客 — MQTT(三)连接MQTT服务端
超全金属PBR多通道贴图素材网站整理
好胖子带你学Flink系列-Flink源码剖析第一集Standalone启动脚本分析
剑指 Offer II 012. 左右两边子数组的和相等
Will the 2022 cloud world be better
Redis Series - Overview day1 - 1
Internship: the annotation under swagger involves the provision of interfaces
try with resource
SnakeYAML配置文件解析器
XShell连接VMWare虚拟机
2022-06-17 网工进阶(十)IS-IS-通用报头、邻接关系的建立、IIH报文、DIS与伪节点
剑指 Offer II 014. 字符串中的变位词 滑动窗口
Vscode plug-in self use
[proficient in high concurrency] deeply understand the basis of C language and C language under assembly
Effects and laws
MySQL 用 limit 为什么会影响性能?
Next.js 热更新 Markdown 文件变更