# Problem-Based Global Optimization Setup

Create optimization variables, create problem with objective and constraints, call `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

expand all

 `optimproblem` Create optimization problem `optimvalues` Create values for optimization problem (Since R2022a) `optimvar` Create optimization variables `show` Display information about optimization object (Since R2019b) `showbounds` Display variable bounds `write` Save optimization object description (Since R2019b) `writebounds` Save description of variable bounds
 `fcn2optimexpr` Convert function to optimization expression (Since R2019a) `optimconstr` Create empty optimization constraint array `optimeq` Create empty optimization equality array (Since R2019b) `optimineq` Create empty optimization inequality array (Since R2019b) `optimexpr` Create empty optimization expression array `show` Display information about optimization object (Since R2019b) `write` Save optimization object description (Since R2019b)
 `evaluate` Evaluate optimization expression `findindex` Find numeric index equivalents of named index variables `infeasibility` Constraint violation at a point `prob2struct` Convert optimization problem or equation problem to solver form `show` Display information about optimization object (Since R2019b) `solve` Solve optimization problem or equation problem `varindex` Map problem variables to solver-based variable index (Since R2019a) `write` Save optimization object description (Since R2019b)

## Objects

 `OptimizationConstraint` Optimization constraints `OptimizationEquality` Equalities and equality constraints (Since R2019b) `OptimizationExpression` Arithmetic or functional expression in terms of optimization variables `OptimizationInequality` Inequality constraints (Since R2019b) `OptimizationProblem` Optimization problem `OptimizationValues` Values for optimization problems (Since R2022a) `OptimizationVariable` Variable for optimization