Main Content

本页对应的英文页面已更新,但尚未翻译。 若要查看最新内容,请点击此处访问英文页面。

基于问题的优化设置

使用变量和表达式表示优化问题,以串行或并行方式求解

在基于问题的优化中,您需要创建优化变量,用这些变量来构建表示目标和约束或表示方程的表达式,并使用 solve 求解问题。有关以基于问题的方法求解优化问题的步骤,请参阅Problem-Based Optimization Workflow。有关方程求解,请参阅Problem-Based Workflow for Solving Equations

在开始求解优化问题之前,您必须选择合适的方法:基于问题或基于求解器。有关详细信息,请参阅 首先选择基于问题或基于求解器的方法

注意:如果您的非线性函数不是多项式或有理式,请使用 fcn2optimexpr 将其转换为优化表达式。请参阅 Convert Nonlinear Function to Optimization Expression

有关基本非线性优化示例,请参阅基于问题求解有约束非线性问题:。有关基本混合整数线性规划示例,请参阅混合整数线性规划基础:基于问题。有关基本方程求解示例,请参阅Solve Nonlinear System of Equations, Problem-Based

函数

全部展开

eqnproblemCreate equation problem
optimproblem创建优化问题
optimvarCreate optimization variables
showDisplay information about optimization object
showboundsDisplay variable bounds
writeSave optimization object description
writeboundsSave description of variable bounds
fcn2optimexprConvert function to optimization expression
optimconstrCreate empty optimization constraint array
optimeqCreate empty optimization equality array
optimineqCreate empty optimization inequality array
optimexprCreate empty optimization expression array
showDisplay information about optimization object
writeSave optimization object description
evaluateEvaluate optimization expression
findindex查找命名索引变量的等效数值索引
infeasibilityConstraint violation at a point
prob2struct将优化问题或方程问题转换为求解器形式
solve求解优化问题或方程问题
varindex将问题变量映射到基于求解器的变量索引

对象

EquationProblemSystem of nonlinear equations
OptimizationConstraintOptimization constraints
OptimizationEqualityEqualities and equality constraints
OptimizationExpressionArithmetic or functional expression in terms of optimization variables
OptimizationInequalityInequality constraints
OptimizationProblem优化问题
OptimizationVariableVariable for optimization

主题

基于问题的步骤

Problem-Based Optimization Workflow

Problem-based steps for solving optimization problems.

Problem-Based Workflow for Solving Equations

Problem-based steps for solving equations.

Optimization Expressions

Expressions define both objective and constraints.

Pass Extra Parameters in Problem-Based Approach

Pass extra parameters, data, or fixed variables in the problem-based approach.

Write Objective Function for Problem-Based Least Squares

Syntax rules for problem-based least squares.

Named Index for Optimization Variables

How to create and work with named indices for variables.

Review or Modify Optimization Problems

Shows how to review or modify problem elements such as variables and constraints.

Examine Optimization Solution

How to evaluate the solution and its quality.

设置选项

设置选项

设置优化选项

Output Function for Problem-Based Optimization

Shows how to use an output function in the problem-based approach to record iteration history and to make a custom plot.

基于问题的优化技巧

Create Efficient Optimization Problems

Tips for obtaining a faster or more accurate solution when there are integer constraints, and for avoiding loops in problem creation.

Separate Optimization Model from Data

To create reusable, scalable problems, separate the model from the data.

Variables with Duplicate Names Disallowed

Solution to the problem of two optimization variables with the same name.

Create Initial Point for Optimization with Named Index Variables

This example shows how to create initial points for solve when you have named index variables by using the findindex function.

Expression Contains Inf or NaN

Optimization expressions containing Inf or NaN cannot be displayed, and can cause unexpected results.

Objective and Constraints Having a Common Function in Serial or Parallel, Problem-Based

Save time when your objective and nonlinear constraint functions share common computations in the problem-based approach.

并行计算

What Is Parallel Computing in Optimization Toolbox?

Use multiple processors for optimization.

Using Parallel Computing in Optimization Toolbox

Perform gradient estimation in parallel.

Minimizing an Expensive Optimization Problem Using Parallel Computing Toolbox™

Example showing the effectiveness of parallel computing in two solvers: fmincon and ga.

Improving Performance with Parallel Computing

Investigate factors for speeding optimizations.

基于问题的算法

Problem-Based Optimization Algorithms

How the optimization functions and objects solve optimization problems.

Supported Operations on Optimization Variables and Expressions

Lists all available mathematical and indexing operations on optimization variables and expressions.