Main Content

Pareto Front for Two Objectives

Multiobjective Optimization with Two Objectives

This example shows how to find a Pareto set for a two-objective function of two variables. The example presents two approaches for minimizing: using the Optimize Live Editor task and working at the command line.

The two-objective function f(x), where x is also two-dimensional, is

f1(x)=x14+x24+x1x2(x1x2)210x12f2(x)=x14+x24+x1x2(x1x2)2.

Find Pareto Set Using Optimize Live Editor Task

  1. Create a new live script by clicking the New Live Script button in the File section on the Home tab.

  2. Insert an Optimize Live Editor task. Click the Insert tab and then, in the Code section, select Task > Optimize.

    Inserting Optimize Live Editor task

    Optimize task in Live Editor: Choose between problem-based (recommended) and solver-based

  3. Click the Solver-based task.

    Optimize Live Editor task

  4. For use in entering problem data, insert a new section by clicking the Section Break button on the Insert tab. New sections appear above and below the task.

  5. In the new section above the task, enter the following code to define the number of variables and lower and upper bounds.

    nvar = 2;
    lb = [0 -5];
    ub = [5 0];
  6. To place these variables into the workspace, run the section by pressing Ctrl+Enter.

  7. Specify Problem Type

    In the Specify problem type section of the task, click the Objective > Nonlinear button.

  8. Click the Constraints > Lower bounds and Upper bounds buttons.

  9. Select Solver > gamultiobj - Multiobjective optimization using genetic algorithm.

    Objective, constraints, and solver specified

  10. Select Problem Data

    In the Select problem data section, select Objective function > Local function, and then click the New button. The function appears in a new section below the task.

  11. Edit the resulting function definition to contain the following code.

    function f = mymulti1(x)
    
    f(2) = x(1)^4 + x(2)^4 + x(1)*x(2) - (x(1)*x(2))^2;
    f(1) = f(2) - 10*x(1)^2;
    end
  12. In the Select problem data section, select the Local function > mymulti1 function.

  13. Select Number of variables > nvar.

  14. Select Lower bounds > From workspace > lb and Upper bounds > From workspace > ub.

  15. Specify Solver Options

    Expand the Specify solver options section of the task, and then click the Add button. To have a denser, more connected Pareto front, specify a larger-than-default populations by selecting Population settings > Population size > 60.

  16. To have more of the population on the Pareto front than the default settings, click the + button. In the resulting options, select Algorithm > Pareto set fraction > 0.7.

  17. Set Display Options

    In the Display progress section of the task, select the Pareto front plot function.

    Problem data, solver options, and display progress specified

  18. Run Solver and Examine Results

    To run the solver, click the options button at the top right of the task window, and select Run Section. The plot appears in a separate figure window and in the task output area.

    Set of points on a convex curve from about [-38,33] to about [-5,0]

    The plot shows the tradeoff between the two components of f, which is plotted in objective function space. For details, see the figure Figure 14-2, Set of Noninferior Solutions.

Find Pareto Set at the Command Line

To perform the same optimization at the command line, complete the following steps.

  1. Create the mymulti1 objective function file on your MATLAB® path.

    function f = mymulti1(x)
    
    f(2) = x(1)^4 + x(2)^4 + x(1)*x(2) - (x(1)*x(2))^2;
    f(1) = f(2) - 10*x(1)^2;
    end
  2. Set the options and bounds.

    options = optimoptions('gamultiobj','PopulationSize',60,...
              'ParetoFraction',0.7,'PlotFcn',@gaplotpareto);
    lb = [0 -5];
    ub = [5 0];
  3. Run the optimization using the options.

    [solution,ObjectiveValue] = gamultiobj(@mymulti1,2,...
                              [],[],[],[],lb,ub,options);

Both the Optimize Live Editor task and the command line allow you to formulate and solve problems, and they give identical results. The command line is more streamlined, but provides less help for choosing a solver, setting up the problem, and choosing options such as plot functions. You can also start a problem using Optimize, and then generate code for command line use, as in Constrained Nonlinear Problem Using Optimize Live Editor Task or Solver.

Alternate Views

You can view this problem in other ways. 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. The algorithm calculates these points by finding where the gradients of the objective functions are parallel. The figure is plotted in parameter space; see Figure 14-1, Mapping from Parameter Space into Objective Function Space.

Contours of objective functions, and Pareto frontier

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

 Code for creating the figure

See Also

|

Related Topics