To solve an optimization problem:
Decide what type of problem you have, and whether you want a local or global solution (see Local vs. Global Optima). Choose a solver per the recommendations in Table for Choosing a Solver.
Write your objective function and, if applicable, constraint functions per the syntax in Compute Objective Functions and Write Constraints.
Set appropriate options using
optimoptions, or prepare a
MultiStartproblem as described in Workflow for GlobalSearch and MultiStart. For details, see Pattern Search Options, Particle Swarm Options, Genetic Algorithm Options, Simulated Annealing Options, or Surrogate Optimization Options.
Run the solver.
Examine the result. For information on the result, see Solver Outputs and Iterative Display or Examine Results for
If the result is unsatisfactory, change options or start points or otherwise update your optimization and rerun it. For information, see Global Optimization Toolbox Solver Characteristics or Improve Results. For information on improving solutions that applies mainly to smooth problems, see When the Solver Fails, When the Solver Might Have Succeeded, or When the Solver Succeeds.