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

1 回表示 (過去 30 日間)
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

回答 (1 件)

Alan Weiss
Alan Weiss 2019 年 4 月 12 日
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

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by