Documentation Center

  • Trials
  • Product Updates

Use gamultiobj

Problem Formulation

The gamultiobj solver attempts to create a set of Pareto optima for a multiobjective minimization. You may optionally set bounds and linear constraints on variables. gamultiobj uses the genetic algorithm for finding local Pareto optima. As in the ga function, you may specify an initial population, or have the solver generate one automatically.

The fitness function for use in gamultiobj should return a vector of type double. The population may be of type double, a bit string vector, or can be a custom-typed vector. As in ga, if you use a custom population type, you must write your own creation, mutation, and crossover functions that accept inputs of that population type, and specify these functions in the following fields, respectively:

  • Creation function (CreationFcn)

  • Mutation function (MutationFcn)

  • Crossover function (CrossoverFcn)

You can set the initial population in a variety of ways. Suppose that you choose a population of size m. (The default population size is 15 times the number of variables n.) You can set the population:

  • As an m-by-n matrix, where the rows represent m individuals.

  • As a k-by-n matrix, where k < m. The remaining m – k individuals are generated by a creation function.

  • The entire population can be created by a creation function.

Use gamultiobj with the Optimization app

You can access gamultiobj from the Optimization app. Enter

optimtool('gamultiobj')

at the command line, or enter optimtool and then choose gamultiobj from the Solver menu. You can also start the tool from the MATLAB® Apps tab.

If the Quick Reference help pane is closed, you can open it by clicking the ">>" button on the upper right: . The help pane briefly explains all the available options.

You can create an options structure in the Optimization app, export it to the MATLAB workspace, and use the structure at the command line. For details, see Importing and Exporting Your Work in the Optimization Toolbox™ documentation.

Multiobjective Optimization with Two Objectives

This example has a two-objective fitness function f(x), where x is also two-dimensional:

function f = mymulti1(x)

f(1) = x(1)^4 - 10*x(1)^2+x(1)*x(2) + x(2)^4 -(x(1)^2)*(x(2)^2);
f(2) = x(2)^4 - (x(1)^2)*(x(2)^2) + x(1)^4 + x(1)*x(2);

Create this function file before proceeding.

Performing the Optimization with Optimization App

  1. To define the optimization problem, start the Optimization app, and set it as pictured.

  2. Set the options for the problem as pictured.

  3. Run the optimization by clicking Start under Run solver and view results.

A plot appears in a figure window.

This plot shows the tradeoff between the two components of f. It is plotted in objective function space; see the figure Set of Noninferior Solutions.

The results of the optimization appear in the following table containing both objective function values and the value of the variables.

You can sort the table by clicking a heading. Click the heading again to sort it in the reverse order. The following figures show the result of clicking the heading f1.

Performing the Optimization at the Command Line

To perform the same optimization at the command line:

  1. Set the options:

    options = gaoptimset('PopulationSize',60,...
              'ParetoFraction',0.7,'PlotFcns',@gaplotpareto);
  2. Run the optimization using the options:

    [x fval flag output population] = gamultiobj(@mymulti1,2,...
                              [],[],[],[],[-5,-5],[5,5],options);

Alternate Views

There are other ways of regarding the problem. The following figure contains a plot of the level curves of the two objective functions, the Pareto frontier calculated by gamultiobj (boxes), and the x-values of the true Pareto frontier (diamonds connected by a nearly-straight line). The true Pareto frontier points are where the level curves of the objective functions are parallel. They were calculated by finding where the gradients of the objective functions are parallel. The figure is plotted in parameter space; see the figure Mapping from Parameter Space into Objective Function Space.

Contours of objective functions, and Pareto frontier

gamultiobj found the ends of the line segment, meaning it found the full extent of the Pareto frontier.

 Code for creating the figure

Options and Syntax: Differences from ga

The syntax and options for gamultiobj are similar to those for ga, with the following differences:

  • gamultiobj does not have nonlinear constraints, so its syntax has fewer inputs.

  • gamultiobj takes an option DistanceMeasureFcn, a function that assigns a distance measure to each individual with respect to its neighbors.

  • gamultiobj takes an option ParetoFraction, a number between 0 and 1 that specifies the fraction of the population on the best Pareto frontier to be kept during the optimization. If there is only one Pareto frontier, this option is ignored.

  • gamultiobj uses only the Tournament selection function.

  • gamultiobj uses elite individuals differently than ga. It sorts noninferior individuals above inferior ones, so it uses elite individuals automatically.

  • gamultiobj has only one hybrid function, fgoalattain.

  • gamultiobj does not have a stall time limit.

  • gamultiobj has different plot functions available.

  • gamultiobj does not have a choice of scaling function.

Was this topic helpful?