## Steps for Problem-Based Multiobjective Optimization

This topic shows how to set up a multiobjective optimization in the problem-based approach, and details the format of results and initial points. For an example, see Pareto Front for Multiobjective Optimization, Problem-Based.

### Specify Multiple Objective Functions

Specify multiple objective functions in one of two ways:

Optimization expression — Give an optimization expression that has vector or array values. For example, this objective function returns a vector of three values:

prob.Objective = [sin(x),cos(x),1 - x.^2];

Structure — Give a structure of optimization expressions, each of which evaluates to a scalar. For example, this objective function returns a structure with three objective components:

prob.Objective.sin = sin(x); prob.Objective.cos = cos(x); prob.Objective.quad = 1 - x^2;

### Specify Multiple Objective Senses (Maximize or Minimize)

Specify an objective function sense, meaning maximize or minimize, depending on how you specify the objective function.

Objective is an optimization expression — All objectives in the problem have the same objective sense. For example,

`prob.ObjectiveSense = "max";`

Objective is a structure — Each objective function can have its own sense. The

`prob.ObjectiveSense`

structure has the same fields as the`prob.Objective`

structure. For example,prob.ObjectiveSense.sin = "minimize"; prob.Objective.cos = "maximize"; prob.Objective.quad = "max";

The default sense is `minimize`

.

### Data Format of Multiobjective Solutions

The returned `sol`

output is a vector of `OptimizationValues`

objects. Each object contains the values of the optimization variables and the objective
functions at one point on the Pareto front. If the problem has nonlinear constraints,
`sol`

also contains the nonlinear constraint violations at each solution
point.

The returned `fval`

output is a matrix where each row represents one
solution point and each column represents one objective function. The
`fval`

output is numeric, unlike the `sol`

output. You
can obtain the objective function values from the `sol`

object. However,
you can find the values more easily in `fval`

.

You can plot the resulting Pareto front in two or three dimensions by calling `paretoplot`

on
`sol`

. For an example, see Pareto Front for Multiobjective Optimization, Problem-Based.

### Supply Initial Points for Multiobjective Problem

Specifying initial points for multiobjective problems is optional. However, you can sometimes obtain better solutions by doing so. For an example showing the benefit, see Pareto Front for Multiobjective Optimization, Problem-Based.

To specify initial points, create an `OptimizationValues`

object using
the `optimvalues`

function. For examples, see the `optimvalues`

reference page.

### Hybrid Function

To obtain more accurate solutions, the `gamultiobj`

solver can
optionally call `fgoalattain`

. For an example, see Design Optimization of a Welded Beam. To use this hybrid function
in the problem-based workflow, set the `HybridFcn`

option to
`"fgoalattain"`

:

options = optimoptions('gamultiobj',HybridFcn="fgoalattain");

Include the solver and options arguments in the `solve`

call:

[sol,fval,exitflag,output] = solve(prob,... Solver="gamultiobj",... Options=options);

### View Pareto Set

To view the Pareto set in two or three dimensions while the solver proceeds, set a plot option.

For the

`gamultiobj`

function, set the`PlotFcn`

option to`'gaplotpareto'`

.options = optimoptions("gamultiobj",PlotFcn="gaplotpareto"); sol = solve(prob,Options=options)

For the

`paretosearch`

function, set the`PlotFcn`

option to`'psplotparetof'`

.

To view the Pareto set after the solver finishes, call `paretoplot`

on the solution.

sol = solve(prob); paretoplot(sol)

For an example, see Pareto Front for Multiobjective Optimization, Problem-Based.

If you have more than three objectives, `paretoplot`

allows you to
choose which objectives to plot. See the `paretoplot`

reference page for details.

## See Also

`gamultiobj`

| `paretosearch`

| `solve`

| `optimvalues`

| `paretoplot`