Problem-Based Optimization Setup
solve
Global Optimization Toolboxhas two approaches for optimization: problem-based and solver-based. SeeDecide Between Problem-Based and Solver-Based Approach. In problem-based optimization, you create symbolic-style optimization variables. Then you create expressions in these variables that represent the objective and constraints. Finally, solve the problem usingsolve
. For details, seeProblem-Based Optimization Workflow.
Note:If you have a nonlinear function that is not composed of polynomials, rational expressions, and elementary functions such asexp
, then convert the function to an optimization expression by usingfcn2optimexpr
. SeeConvert Nonlinear Function to Optimization ExpressionandSupported Operations for Optimization Variables and Expressions.
For a basic example, seeCompare Several Global Solvers, Problem-Based.
Functions
Objects
OptimizationConstraint |
Optimization constraints |
OptimizationEquality |
Equalities and equality constraints |
OptimizationExpression |
Arithmetic or functional expression in terms of optimization variables |
OptimizationInequality |
Inequality constraints |
OptimizationProblem |
Optimization problem |
OptimizationValues |
Values for optimization problems |
OptimizationVariable |
Variable for optimization |
Topics
Problem-Based Steps
- Problem-Based Optimization Workflow
Learn the problem-based steps for solving optimization problems. - Optimization Expressions
Define expressions for both the objective and constraints. - Pass Extra Parameters in Problem-Based Approach
Pass extra parameters, data, or fixed variables in the problem-based approach. - Named Index for Optimization Variables
Create and work with named indices for variables. - Review or Modify Optimization Problems
Review or modify problem elements such as variables and constraints. - Examine Optimization Solution
Evaluate the solution and its quality.
Steps for Global Solvers
- Decide Between Problem-Based and Solver-Based Approach
空洞e considerations for problem-based and solver-based optimization withGlobal Optimization Toolboxsolvers. - Global Optimization Toolbox Default Solvers and Problem Types
Identify the types of problems you can solve in the problem-based approach and their associated default solvers. - Initial Points for Global Optimization Toolbox Solvers
Specify initial points forGlobal Optimization Toolboxsolvers in the problem-based approach. - Integer Constraints in Nonlinear Problem-Based Optimization
Learn how the problem-based optimization functionsprob2struct
andsolve
handle integer constraints.
Set Options
- Set Options
Set optimization options - Set Options in Problem-Based Approach Using varindex
To set options in some contexts, map problem-based variables to solver-based usingvarindex
. - Pattern Search Options
空洞e the options for pattern search. - Genetic Algorithm Options
空洞e the options for the genetic algorithm. - Particle Swarm Options
空洞e the options for particle swarm. - Surrogate Optimization Options
空洞e the options for surrogate optimization, including algorithm control, stopping criteria, command-line display, and output and plot functions. - Simulated Annealing Options
空洞e the options for simulated annealing.
Tips for Problem-Based Optimization
- Create Efficient Optimization Problems
Obtain a faster or more accurate solution when the problem has integer constraints, and avoid loops when creating a problem. - Separate Optimization Model from Data
Create reusable, scalable problems by separating the model from the data. - Variables with Duplicate Names Disallowed
Learn how to solve a problem that has two optimization variables with the same name. - Create Initial Point for Optimization with Named Index Variables
Create initial points forsolve
当问题通过索引变量使用g thefindindex
function. - Expression Contains Inf or NaN
Optimization expressions containingInf
orNaN
cannot be displayed, and can cause unexpected results. - Objective and Constraints Having a Common Function in Serial or Parallel, Problem-Based
Save time when the objective and nonlinear constraint functions share common computations in the problem-based approach. - Obtain Generated Function Details
Find the values of extra parameters in nonlinear functions created byprob2struct
. - Output Function for Problem-Based Optimization
Use an output function in the problem-based approach to record iteration history and to make a custom plot.
Parallel Computing
- How Solvers Compute in Parallel
Learn how solvers distribute work for parallel computing. - How to Use Parallel Processing in Global Optimization Toolbox
Direct a solver or hybrid function to use multiple processes. - Minimizing an Expensive Optimization Problem Using Parallel Computing Toolbox
Example showing the effectiveness of parallel computing in two solvers:fmincon
andga
. - Improving Performance with Parallel Computing
Investigate factors for speeding optimizations.
Problem-Based Algorithms
- Problem-Based Optimization Algorithms
Learn how the optimization functions and objects solve optimization problems. - Supported Operations for Optimization Variables and Expressions
空洞e the supported mathematical and indexing operations for optimization variables and expressions.