Problem-Based Global Optimization Setup
solve
Global Optimization Toolbox has two approaches for optimization: problem-based and
solver-based. See Decide 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 using solve
. For details, see Problem-Based Optimization Workflow.
Note: If you have a nonlinear function
that is not composed of polynomials, rational expressions, and elementary
functions such as exp
, then convert the function to an
optimization expression by using fcn2optimexpr
. See Convert Nonlinear Function to Optimization Expression and
Supported Operations for Optimization Variables and Expressions.
For a basic example, see Compare 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 (Since R2022a) |
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
Explore considerations for problem-based and solver-based optimization with Global Optimization Toolbox solvers. - 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 for Global Optimization Toolbox solvers in the problem-based approach. - Integer Constraints in Nonlinear Problem-Based Optimization
Learn how the problem-based optimization functionsprob2struct
andsolve
handle integer constraints.
Set Global Optimization Options
- Set Problem-Based Optimization Options for Global Optimization Toolbox Solvers
How to set and change optimization options in the problem-based approach for Global Optimization Toolbox. - 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
Explore the options for pattern search. - Genetic Algorithm Options
Explore the options for the genetic algorithm. - Particle Swarm Options
Explore the options for particle swarm. - Surrogate Optimization Options
Explore the options for surrogate optimization, including algorithm control, stopping criteria, command-line display, and output and plot functions. - Simulated Annealing Options
Explore 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
when the problem has named index variables by using 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
Explore the supported mathematical and indexing operations for optimization variables and expressions.