Plot 3-D Pareto Front - MATLAB & Simulink - MathWorks (2024)

Open Live Script

This example shows how to plot a Pareto front for three objectives. Each objective function is the squared distance from a particular 3-D point. For speed of calculation, write each objective function in vectorized fashion as a dot product. To obtain a dense solution set, use 200 points on the Pareto front.

The example first shows how to obtain the plot using the built-in 'psplotparetof' plot function. Then solve the same problem and obtain the plot using gamultiobj, which requires slightly different option settings. The example shows how to obtain solution variables for a particular point in the Pareto plot. Then the example shows how to plot the points directly, without using a plot function, and shows how to plot an interpolated surface instead of Pareto points.

fun = @(x)[dot(x - [1,2,3],x - [1,2,3],2), ... dot(x - [-1,3,-2],x - [-1,3,-2],2), ... dot(x - [0,-1,1],x - [0,-1,1],2)];options = optimoptions('paretosearch','UseVectorized',true,'ParetoSetSize',200,... 'PlotFcn','psplotparetof');lb = -5*ones(1,3);ub = -lb;rng default % For reproducibility[x,f] = paretosearch(fun,3,[],[],[],[],lb,ub,[],options);
Pareto set found that satisfies the constraints. Optimization completed because the relative change in the volume of the Pareto set is less than 'options.ParetoSetChangeTolerance' and constraints are satisfied to within 'options.ConstraintTolerance'.

Plot 3-D Pareto Front- MATLAB & Simulink- MathWorks (1)

opts = optimoptions('gamultiobj',"PlotFcn","gaplotpareto","PopulationSize",200);[xg,fg] = gamultiobj(fun,3,[],[],[],[],lb,ub,[],opts);
gamultiobj stopped because the average change in the spread of Pareto solutions is less than options.FunctionTolerance.

Plot 3-D Pareto Front- MATLAB & Simulink- MathWorks (2)

This plot shows many fewer points than the paretosearch plot. Solve the problem again using a larger population.

opts.PopulationSize = 400;[xg,fg] = gamultiobj(fun,3,[],[],[],[],lb,ub,[],opts);
gamultiobj stopped because the average change in the spread of Pareto solutions is less than options.FunctionTolerance.

Change the viewing angle to better match the psplotpareto plot.

Plot 3-D Pareto Front- MATLAB & Simulink- MathWorks (3)

Find Solution Point Using Tool Tips

Select a point in the plot by using the Data Tips tool.

Plot 3-D Pareto Front- MATLAB & Simulink- MathWorks (4)

Plot 3-D Pareto Front- MATLAB & Simulink- MathWorks (5)

The pictured point has index 92. Display the point xg(92,:) that contains the solution variables associated with the pictured point.

disp(xg(92,:))
 -0.2889 0.0939 0.4980

Evaluate the objective functions at this point to see that it matches the displayed values.

disp(fun(xg(92,:)))
 11.5544 15.1912 1.5321

Create 3-D Scatter Plot

Plot points on the Pareto front by using scatter3.

figuresubplot(2,2,1)scatter3(f(:,1),f(:,2),f(:,3),'k.');subplot(2,2,2)scatter3(f(:,1),f(:,2),f(:,3),'k.');view(-148,8)subplot(2,2,3)scatter3(f(:,1),f(:,2),f(:,3),'k.');view(-180,8)subplot(2,2,4)scatter3(f(:,1),f(:,2),f(:,3),'k.');view(-300,8)

Plot 3-D Pareto Front- MATLAB & Simulink- MathWorks (6)

By rotating the plot interactively, you get a better view of its structure.

Interpolated Surface Plot

To see the Pareto front as a surface, create a scattered interpolant.

figureF = scatteredInterpolant(f(:,1),f(:,2),f(:,3),'linear','none');

To plot the resulting surface, create a mesh in x-y space from the smallest to the largest values. Then plot the interpolated surface.

sgr = linspace(min(f(:,1)),max(f(:,1)));ygr = linspace(min(f(:,2)),max(f(:,2)));[XX,YY] = meshgrid(sgr,ygr);ZZ = F(XX,YY);

Plot the Pareto points and surface together.

figuresubplot(2,2,1)surf(XX,YY,ZZ,'LineStyle','none')hold onscatter3(f(:,1),f(:,2),f(:,3),'k.');hold offsubplot(2,2,2)surf(XX,YY,ZZ,'LineStyle','none')hold onscatter3(f(:,1),f(:,2),f(:,3),'k.');hold offview(-148,8)subplot(2,2,3)surf(XX,YY,ZZ,'LineStyle','none')hold onscatter3(f(:,1),f(:,2),f(:,3),'k.');hold offview(-180,8)subplot(2,2,4)surf(XX,YY,ZZ,'LineStyle','none')hold onscatter3(f(:,1),f(:,2),f(:,3),'k.');hold offview(-300,8)

Plot 3-D Pareto Front- MATLAB & Simulink- MathWorks (7)

By rotating the plot interactively, you get a better view of its structure.

Plot Pareto Set in Control Variable Space

You can obtain a plot of the points on the Pareto set by using the 'psplotparetox' plot function.

options.PlotFcn = 'psplotparetox';[x,f] = paretosearch(fun,3,[],[],[],[],lb,ub,[],options);
Pareto set found that satisfies the constraints. Optimization completed because the relative change in the volume of the Pareto set is less than 'options.ParetoSetChangeTolerance' and constraints are satisfied to within 'options.ConstraintTolerance'.

Plot 3-D Pareto Front- MATLAB & Simulink- MathWorks (8)

Alternatively, create a scatter plot of the x-values in the Pareto set.

figuresubplot(2,2,1)scatter3(x(:,1),x(:,2),x(:,3),'k.');subplot(2,2,2)scatter3(x(:,1),x(:,2),x(:,3),'k.');view(-148,8)subplot(2,2,3)scatter3(x(:,1),x(:,2),x(:,3),'k.');view(-180,8)subplot(2,2,4)scatter3(x(:,1),x(:,2),x(:,3),'k.');view(-300,8)

Plot 3-D Pareto Front- MATLAB & Simulink- MathWorks (9)

This set does not have a clear surface. By rotating the plot interactively, you get a better view of its structure.

Parallel Plot

You can plot the Pareto set using a parallel coordinates plot. You can use a parallel coordinates plot for any number of dimensions. In the plot, each colored line represents one Pareto point, and each coordinate variable plots to an associated vertical line. Plot the objective function values using parellelplot.

figurep = parallelplot(f);p.CoordinateTickLabels =["Obj1";"Obj2";"Obj3"];

Color the Pareto points in the lowest tenth of the values of Obj2.

minObj2 = min(f(:,2));maxObj2 = max(f(:,2));grpRng = minObj2 + 0.1*(maxObj2-minObj2);grpData = f(:,2) <= grpRng;p.GroupData = grpData;p.LegendVisible = "off";

Plot 3-D Pareto Front- MATLAB & Simulink- MathWorks (10)

See Also

gamultiobj | paretosearch

Related Topics

  • Multiobjective Optimization

MATLAB Command

You clicked a link that corresponds to this MATLAB command:

 

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Plot 3-D Pareto Front- MATLAB & Simulink- MathWorks (11)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom (English)

Asia Pacific

Contact your local office

Plot 3-D Pareto Front
- MATLAB & Simulink
- MathWorks (2024)
Top Articles
Latest Posts
Article information

Author: Nathanael Baumbach

Last Updated:

Views: 5694

Rating: 4.4 / 5 (75 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Nathanael Baumbach

Birthday: 1998-12-02

Address: Apt. 829 751 Glover View, West Orlando, IN 22436

Phone: +901025288581

Job: Internal IT Coordinator

Hobby: Gunsmithing, Motor sports, Flying, Skiing, Hooping, Lego building, Ice skating

Introduction: My name is Nathanael Baumbach, I am a fantastic, nice, victorious, brave, healthy, cute, glorious person who loves writing and wants to share my knowledge and understanding with you.