主要内容

本页采用了机器翻译。点击此处可查看最新英文版本。

paretoplot

多目标的帕累托图

自 R2022a 起

说明

paretoplot(val) 创建了 val 中目标的帕累托图。如果 val 包含三个以上的目标,则 paretoplot 绘制前三个目标。

示例

paretoplot(val,objlabels) 创建了 objlabels 中列出的目标的帕累托图。如果每个目标函数都有单独的标签,请使用此语法。

示例

paretoplot(val,objindex) 创建了 objindex 中列出的目标的帕累托图。如果您的目标函数未标记,请使用此语法。

示例

对于任何先前输入的语法,h = paretoplot(___) 都会返回结果分散对象的句柄 h。创建散点图对象后,使用 h 设置其属性。

示例

paretoplot(ax,___) 将绘图绘制到带有句柄 ax 的坐标区中。

示例

全部折叠

使用优化变量创建并求解多目标优化问题。

x = optimvar("x",LowerBound=-1,UpperBound=2);
prob = optimproblem;
prob.Objective.obj1 = x^2;
prob.Objective.obj2 = (x-1)^2;
[sol,fval] = solve(prob,Solver="paretosearch");
Solving problem using paretosearch.

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'.

绘制帕累托前沿。

paretoplot(sol)

Figure contains an axes object. The axes object with title Pareto Front, xlabel obj1, ylabel obj2 contains 4 objects of type text, scatter.

创建并求解具有四个命名目标的多目标优化问题。

x = optimvar("x",2,LowerBound=-2,UpperBound=4);
prob = optimproblem;
prob.Objective.obj1 = norm(x)^2;
prob.Objective.obj2 = norm(x - [1;0])^2;
prob.Objective.obj3 = norm(x - [0;1])^2;
prob.Objective.obj4 = norm(x - [1;1])^2;
sol = solve(prob,Solver="paretosearch");
Solving problem using paretosearch.

Pareto set found that satisfies the constraints. 

Optimization completed because the relative change in the distance of the Pareto set 
is less than 'options.ParetoSetChangeTolerance' and constraints are satisfied to within 
'options.ConstraintTolerance'.

创建前三个目标的帕累托图;

paretoplot(sol)

Figure contains an axes object. The axes object with title Pareto Front, xlabel obj1, ylabel obj2 contains 5 objects of type text, scatter.

创建最后三个目标的帕累托图。

paretoplot(sol,["obj2" "obj3" "obj4"])

Figure contains an axes object. The axes object with title Pareto Front, xlabel obj2, ylabel obj3 contains 5 objects of type text, scatter.

创建并求解具有四个目标的多目标优化问题。目标函数返回一个四元素向量。

x = optimvar("x",2,LowerBound=-2,UpperBound=4);
prob = optimproblem;
obj = [norm(x)^2,norm(x - [1;0])^2,norm(x - [0;1])^2,norm(x - [1;1])^2];
prob.Objective = obj;
sol = solve(prob,Solver="paretosearch");
Solving problem using paretosearch.

Pareto set found that satisfies the constraints. 

Optimization completed because the relative change in the distance of the Pareto set 
is less than 'options.ParetoSetChangeTolerance' and constraints are satisfied to within 
'options.ConstraintTolerance'.

创建前三个目标的帕累托图;

paretoplot(sol)

Figure contains an axes object. The axes object with title Pareto Front, xlabel Objective(1), ylabel Objective(2) contains 5 objects of type text, scatter.

创建最后三个目标的帕累托图。

paretoplot(sol,[2 3 4])

Figure contains an axes object. The axes object with title Pareto Front, xlabel Objective(2), ylabel Objective(3) contains 5 objects of type text, scatter.

使用优化变量创建并求解多目标优化问题。

x = optimvar("x",LowerBound=-1,UpperBound=2);
prob = optimproblem;
prob.Objective.obj1 = x^2;
prob.Objective.obj2 = (x-1)^2;
[sol,fval] = solve(prob,Solver="paretosearch");
Solving problem using paretosearch.

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'.

绘制帕累托前沿。要启用编辑,请获取绘图的句柄。

h = paretoplot(sol);

Figure contains an axes object. The axes object with title Pareto Front, xlabel obj1, ylabel obj2 contains 4 objects of type text, scatter.

将标记从蓝色 'o' 更改为红色 'x'。为了获得不扭曲的视图,请将轴设置为相等的长度。

h.Marker = "x";
h.MarkerEdgeColor = "r";
axis equal

Figure contains an axes object. The axes object with title Pareto Front, xlabel obj1, ylabel obj2 contains 4 objects of type text, scatter.

有关可编辑属性的完整列表,请参阅 Scatter 属性

输入参数

全部折叠

优化值,指定为 OptimizationValues 对象。通常,vals 是多目标问题的解,solsolve 的输出。

paretoplot 可以绘制两个或三个目标。如果您有三个以上的目标,paretoplot 将绘制前三个。使用 objlabelsobjindex 参量要绘制的两个或三个目标。

示例: sol

目标函数标签,指定为两个或三个条目的字符串向量。这些条目是优化问题中的目标函数标签。

示例: ["obj1" "obj2"]

数据类型: char | string

目标函数索引,指定为正整数向量。objindex 必须包含从 1 到目标数量范围内的两个或三个条目。

示例: [4 1 3]

数据类型: double

绘图坐标区,指定为句柄。

版本历史记录

在 R2022a 中推出

另请参阅

(Global Optimization Toolbox) | (Global Optimization Toolbox) |