gamultiobj only plotting a single result for multi objective
2 views (last 30 days)
Show older comments
When I run the following code, I am only getting a single result outputting from the gamultiobj function when it should be many. I dont know why. Please help me understand why this is happening and any solutions to the issue.
clc;
clear;
close all;
% Problem 2
lb=[13 230 15 15];% determine before FEA
ub=[15 250 17 17];% determine before FEA
x_in = [13.5870 248.6600 16.4220 15.8350
14.1440 231.7500 15.0310 16.6400
13.7170 233.7000 16.1970 16.9600
14.0000 241.6100 15.6310 15.2910
14.2650 236.0400 15.9950 15.0130
14.6370 237.2000 15.5410 15.5040
14.3380 235.3300 16.6010 15.1400
13.4440 234.6400 16.5310 16.1600
14.8520 247.2200 15.8160 16.7920
13.0300 232.0800 16.7990 16.2290
14.5480 246.9800 15.4450 15.7550
14.4010 242.2100 16.8550 15.9780
13.2170 245.9800 15.1260 15.3330
13.3300 244.6100 15.7880 15.6100
13.9740 249.2500 16.9100 16.0440
14.7580 230.5200 15.3820 16.5030
14.9700 239.7100 15.2430 16.4680
13.8800 240.2600 16.0920 15.4110
13.1850 238.1100 16.3530 16.3200
13.6120 243.5500 16.2870 16.8530];
x = [x_in(:,1) x_in(:,2) x_in(:,3) x_in(:,4)];
x1 = x(:,1);
x2 = x(:,2);
x3 = x(:,3);
x4 = x(:,4);
nvars = 4; % 4
Rows = 200;
MaxGen = 50;
FuncTol = 0;
ConTol = 0;
[xopt,fopt,output] = paretoOPTS(nvars,lb,ub,Rows,MaxGen,FuncTol,ConTol);
optimal_solution = xopt
function Output = myfuncOBJ(Input)
rho = 0.9;
x1 = Input(1); % variable 1
x2 = Input(2); % variable 2
x3 = Input(3); % variable 3
x4 = Input(4); % variable 4
x = [x1 x2 x3 x4];
x_in = x;
% x = (x_in - lb)./(ub-lb);
y_out1=[2.17 1.468 1.687 1.779 1.520 1.665 1.486 1.867 ...
1.489 2.017 1.701 1.660 2.387 2.288 1.965 1.260 ...
1.335 1.860 2.085 1.982]';
y_out2=[1.095 1.0826 1.08058 1.08326 1.08422 1.09308 1.08531 ...
1.07737 1.09688 1.07289 1.09167 1.09018 1.07647 1.07821 ...
1.08759 1.08892 1.09446 1.08253 1.07586 1.08255]';
w1 = rbf(x_in,y_out1,rho,'Multiquadric');
w2 = rbf(x_in,y_out2,rho,'Multiquadric');
F1 = rbf_approx(x_in,x,w1,rho,'Multiquadric');
F2 = rbf_approx(x_in,x,w2,rho,'Multiquadric');
Output = [F1 F2];
end
function [xopt,fopt,output] = paretoOPTS(nvars,lb,ub,Rows,MaxGen,FuncTol,ConTol)
options = optimoptions('gamultiobj');
options = optimoptions(options,'PopulationSize', Rows);
options = optimoptions(options,'MaxGenerations', MaxGen);
options = optimoptions(options,'FunctionTolerance', FuncTol);
options = optimoptions(options,'ConstraintTolerance', ConTol);
options = optimoptions(options,'CrossoverFcn', { @crossoverintermediate [] });
options = optimoptions(options,'Display', 'off');
options = optimoptions(options,'PlotFcn', { @gaplotpareto });
[xopt,fopt,output] = ...
gamultiobj(@myfuncOBJ,nvars,[],[],[],[],lb,ub,[],options);
end
Thank you very much
1 Comment
Alan Weiss
on 19 Dec 2021
And what is your rbf and rbf_approx code?
Alan Weiss
MATLAB mathematical toolbox documentation
Answers (0)
See Also
Categories
Find more on Multiobjective Optimization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!