Main Content

Get Started with Problem-Based Optimization and Equations

Get started with problem-based setup

To solve a problem using the problem-based approach, perform these steps.

  • Create an optimization problem using optimproblem or an equation-solving problem using eqnproblem.

  • Create optimization variables using optimvar.

  • Create expressions using the optimization variables representing the objective, constraints, or equations. Place the expressions into the problem using dot notation, such as

    prob.Objective = expression1;
    probl.Constraints.ineq = ineq1;
  • For nonlinear problems, create an initial point x0 as a structure, with the names of the optimization variables as the fields.

  • Solve the problem by calling solve.

To improve your setup, increase performance, or learn details about problem-based setup, see Improve Problem-Based Organization and Performance.

For parallel computing in Optimization Toolbox™, see the last section; for parallel computing in Global Optimization Toolbox, see How to Use Parallel Processing in Global Optimization Toolbox (Global Optimization Toolbox).


expand all

eqnproblemCreate equation problem
optimproblemCreate optimization problem
optimvaluesCreate values for optimization problem
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
findindexFind numeric index equivalents of named index variables
infeasibilityConstraint violation at a point
paretoplotPareto plot of multiobjective values
prob2structConvert optimization problem or equation problem to solver form
showDisplay information about optimization object
solveSolve optimization problem or equation problem
solversDetermine default and valid solvers for optimization problem or equation problem
varindexMap problem variables to solver-based variable index
writeSave optimization object description


EquationProblemSystem of nonlinear equations
OptimizationConstraintOptimization constraints
OptimizationEqualityEqualities and equality constraints
OptimizationExpressionArithmetic or functional expression in terms of optimization variables
OptimizationInequalityInequality constraints
OptimizationProblemOptimization problem
OptimizationValuesValues for optimization problems
OptimizationVariableVariable for optimization

Live Editor Tasks

OptimizeOptimize or solve equations in the Live Editor


Problem-Based Procedures


Tune and Monitor Solution Process


Parallel Computing in Optimization Toolbox