当前位置:网站首页>Mathematical modeling column | Part 5: MATLAB optimization model solving method (Part I): Standard Model
Mathematical modeling column | Part 5: MATLAB optimization model solving method (Part I): Standard Model
2022-04-23 20:20:00 【Install a sound 77】
Optimization problem is one of the most common problems in mathematical modeling competition . As a general rule , Those who seek the greatest 、 Minimum 、 furthest 、 lately 、 Most economical 、 Richest 、 Most efficient 、 The most time-consuming goal , Can be classified into the category of optimization problems .MATLAB Optimization toolbox and global optimization toolbox provide complete solutions to multiple optimization problems , The former covers linear programming 、 Mixed integer linear programming 、 Second planning 、 Nonlinear optimization 、 Solver for nonlinear least squares , The latter includes global search 、 Multiple initial points 、 Pattern search 、 Genetic algorithm and other solving algorithms .
This lecture mainly introduces how to use the optimization toolbox to solve the standard optimization model in mathematical modeling . More content , Welcome to MathWorks Website and MATLAB Software documentation .
1. Talk about optimization
Optimization means that under certain conditions , Seek to minimize your goals ( Big ) Design parameters or decisions . There are two key objects in the optimization problem : Objective functions and constraints ( Optional ). General optimization problems , Its mathematical expression can be described as :
among x For the length n Decision variable vector ,f(x) Is the target function ,G(x) Is a constraint function .
Solve the minimum of the objective function ( Big ) value , An efficient and accurate solution depends not only on constraints and the number of variables , It depends more on the characteristics of objective function and constraint function . Clarifying the optimization type is the premise of confirming the optimization scheme , Let's see how these features are divided :
Common objective functions are :
Linear programming : It is widely used in financial information that can be expressed linearly between variables 、 energy 、 In modern management fields such as operation research .
Mixed integer linear programming : The linear programming problem is extended , The constraint that some or all variables in the optimal solution must be integers is added . for example , If a variable represents the number of shares to be subscribed , Then only the integer value should be rounded . Again , If a variable represents the on of the generator / Off state , Then only binary values should be taken (0 or 1).
Second planning : The objective function or constraint function is a multivariate quadratic function . This optimization is applied to portfolio optimization in finance 、 Power plant generation optimization 、 Design optimization and other fields in engineering .
least square : It is divided into linear and nonlinear , Find the optimal function matching of variables by minimizing the sum of squares of errors . Nonlinear least squares optimization can also be used for curve fitting .
2. There are too many optimization solvers , How to choose ?
Yes MATLAB Provide algorithms for various optimization problems , We call it a solver (Solver). According to it, solve the goal , Divided into four groups :
-
Minimum optimization group : Find the starting point of the objective function x0 Local minima in the vicinity
-
Multi objective optimization group : Find or minimize the maximum value of a set of functions or the specified value
-
Equation solving system : Find the nonlinear equation f(x) = 0 starting point x0 Near solution
-
Least square method ( Curve fitting ) Group : Minimize the sum of squares
The optimization toolbox alone provides nearly 20 A solver , Faced with such a wide range of options , Users are often confused . fortunately ,MATLAB Provides a simple and clear reference tool —— Optimize the decision table . It can be said that a watch is in hand , Optimization does not worry :
The above table * The representation algorithm is provided by the global toolbox . Besides , Multiobjective optimization and equation solvers are not listed in this table , More solver options , You can click to read the original .
3. Write beautiful 、 Efficient code
After confirming the optimization strategy , You can start writing code . Let's take an example , Understand the steps and precautions for writing efficient optimization algorithm code .
[ subject ]
- Objective function
- Constraint function ( All variables are positive )
[ answer ]
a. First , According to the title, it is confirmed that this is a linear programming problem . The general mathematical expression of linear programming and MATLAB The standard form is :
Create a file that conforms to the standard format A、b、Aeq、beq、lb、ub Parameters , Only then can the optimization algorithm run smoothly .
b. For the optimization steps of linear programming ( It is also applicable to other optimization schemes ), Recommendations are as follows :
1 ) Select the optimization solver
2 ) Merge all variables into one vector
3 ) Create boundary constraints (lb,ub)
4 ) Create linear inequality constraints (A,b)
5 ) Create a linear equality constraint (Aeq,beq)
6 ) Create objective functions
7 ) Optimization problem solving
8 ) Results test
c. MATLAB Code and comments :
d. Optimization results :
e. If the result is not satisfactory , You can adjust the optimization options , Iterative calculation .
4. Integer programming artifact
In optimization , We often encounter integer programming problems , In especial 0-1 Programming problem , MATLAB For integer programming problems , There is a special solver intlinprog. This function can not only solve the general integer programming problem , We can also solve mixed integer programming problems , That is, the decision variable can be either an integer or a decimal , Just specify the number of the decision variable that is an integer . Through a concrete example , Let's take a look at the use of this function .
The problem is :
The solution code is :
Run code , The optimal solution can be obtained quickly x = [1 0 1].
5. Popular graphical applications
MATLAB So popular in the field of data analysis , In addition to providing a rich set of built-in algorithms , There are all kinds of friendly application interfaces . In the optimization toolbox , There is also such a powerful tool —— Optimization App, Can be in MATLAB Apps Window or run optmitool Command to open . It is an interactive graphical application tool , No need to write code , Directly set various solvers in the graphical interface 、 Configure the objective function 、 constraint condition , You can run the optimization algorithm and visualize the intermediate and final results .
stay Optimization App in , Just click... In the menu bar File > Generate Code, Can be App The settings in are automatically generated MATLAB Code , The user can realize the reuse and secondary development of the algorithm .
Besides , Facing more and more complex optimization problems , How to speed up the operation of the algorithm is also a problem we often hear . For this demand , Can combine MATLAB Parallel computing toolbox , Use the multi-core hardware resources of the computer , Realize algorithm acceleration , Interested users can click to read the original text, watch the video and learn more .
版权声明
本文为[Install a sound 77]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210551491858.html
边栏推荐
- 如何做产品创新?——产品创新方法论探索一
- 使用 WPAD/PAC 和 JScript在win11中进行远程代码执行1
- NC basic usage 1
- SQL Server Connectors By Thread Pool | DTSQLServerTP plugin instructions
- selenium. common. exceptions. WebDriverException: Message: ‘chromedriver‘ executable needs to be in PAT
- Building the tide, building the foundation and winning the future -- the successful holding of zdns Partner Conference
- SIGIR'22 "Microsoft" CTR estimation: using context information to promote feature representation learning
- nc基础用法
- DNS cloud school | analysis of hidden tunnel attacks in the hidden corner of DNS
- 网络通信基础(局域网、广域网、IP地址、端口号、协议、封装、分用)
猜你喜欢
AQS learning
Compact CUDA tutorial - CUDA driver API
Leetcode dynamic planning training camp (1-5 days)
ArcGIS JS version military landmark drawing (dovetail arrow, pincer arrow, assembly area) fan and other custom graphics
DTMF双音多频信号仿真演示系统
Handwritten Google's first generation distributed computing framework MapReduce
Numpy Index & slice & iteration
Browser - learning notes
SQL Server Connectors By Thread Pool | DTSQLServerTP plugin instructions
[text classification cases] (4) RNN and LSTM film evaluation Tendency Classification, with tensorflow complete code attached
随机推荐
16MySQL之DCL 中 COMMIT和ROllBACK
Notes of Tang Shu's grammar class in postgraduate entrance examination English
【目标跟踪】基于帧差法结合卡尔曼滤波实现行人姿态识别附matlab代码
Some basic configurations in interlij idea
Is the wechat CICC wealth high-end zone safe? How to open an account for securities
nc基础用法4
Tensorflow 2 basic operation dictionary
DNS cloud school | analysis of hidden tunnel attacks in the hidden corner of DNS
selenium.common.exceptions.WebDriverException: Message: ‘chromedriver‘ executable needs to be in PAT
The market share of the financial industry exceeds 50%, and zdns has built a solid foundation for the financial technology network
Es index (document name) fuzzy query method (database name fuzzy query method)
Historical track data reading of Holux m1200-e Bluetooth GPS track recorder
JDBC database addition, deletion, query and modification tool class
DNS cloud school | quickly locate DNS resolution exceptions and keep these four DNS status codes in mind
使用 WPAD/PAC 和 JScript在win11中进行远程代码执行3
. Ren -- the intimate artifact in the field of vertical Recruitment!
Still using listview? Use animatedlist to make list elements move
STM32基础知识
Redis cache penetration, cache breakdown, cache avalanche
What is the difference between a host and a server?