Use Exported Options and Problems

As an alternative to creating options using optimoptions, you can set the values of options in the Optimization app and then export the options to the MATLAB® workspace, as described in Importing and Exporting Your Work (Optimization Toolbox). If you export the default options in the Optimization app, the resulting options has the same settings as the default options returned by the command

options = optimoptions(@ga)

except that the exported 'Display' option defaults to 'off', and is 'final' in the default at the command line.

If you export a problem, ga_problem, from the Optimization app, you can apply ga to it using the syntax

[x,fval] = ga(ga_problem)

ga_problem contains the following fields:

  • fitnessfcn — Fitness function

  • nvars — Number of variables for the problem

  • Aineq — Matrix for inequality constraints

  • Bineq — Vector for inequality constraints

  • Aeq — Matrix for equality constraints

  • Beq — Vector for equality constraints

  • LB — Lower bound on x

  • UB — Upper bound on x

  • nonlcon — Nonlinear constraint function

  • options — Optimization options

Related Topics