Invalid value for OPTIONS parameter PopInitRange: must be an array of finite doubles with two rows.

1 view (last 30 days)
Getting this error Invalid value for OPTIONS parameter PopInitRange: must be an array of finite doubles with two rows. New in Matlab and don't know much about ga tool
% Fitness Function
function [y, z] = myFitness(x)
L = 610; % Length
P = 0.00000785; % Density
y = L * P * x(1) * x(2);
z = 1/(1+y);
end
and constrainst code
Constrainst Function
function[c,c_eq] = myConstrainsts(x)
W = 4500; %Design Load
L = 610; %Length
E = 2.1e05;
c = [(1.5 * W * L)/(x(1) * x(2)^2); ((0.375 * W * L^3)/(E * x(1) * x(2)^3))];
c_eq = [];
end

Answers (1)

Alan Weiss
Alan Weiss on 12 Apr 2019
Are you performing a multiobjective optimization? If not, then your fitness function should return a scalar, not two outputs. If so, then you should call gamultiobj, not ga.
Alan Weiss
MATLAB mathematical toolbox documentation

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!