Failure in initial user-supplied fitness function evaluation. GA cannot continue.

조회 수: 17 (최근 30일)
Lio Lio
Lio Lio 2017년 8월 20일
댓글: 效 钱 2024년 5월 30일
Hello, I have a problem when applying Useparallel in genetic algorithms. This is my code:
i
ObjFcn = @myFitness;
IntCon=[1 2 3 4 5];
nvars = 5;
LB= [lb1 lb2 lb3 lb4 lb5];
UB= [20 100 100 100 100];
ConsFcn= @Repecarga;
opts = gaoptimset('PlotFcns',{@gaplotbestf,@gaplotbestindiv},'UseParallel',true);
opts.PopulationSize = 30;
[ho,fval]=ga(ObjFcn,nvars,[],[],[],[],LB,UB,ConsFcn,IntCon,opts)
My objective function is as follows:
i
function y = myFitness(ho)
y = 65*ho(1)+15*ho(2)+13*ho(3)+ 7*ho(4)+2*ho(5)
end
The error I get is this
Error in ga (line 351)
[x,fval,exitFlag,output,population,scores] = gaminlp(FitnessFcn,nvars, ...
Error in EJECUTABLE (line 136)
[ho, fval]=ga(ObjFcn,nvars,[],[],[],[],LB,UB,ConsFcn,IntCon,opts)
Caused by:
Failure in user-supplied fitness function evaluation. Cannot continue.
Failure in initial user-supplied fitness function evaluation. GA cannot continue.
Regards.
  댓글 수: 9
效 钱
效 钱 2024년 5월 30일
Try using process-based parallel computing mode or turn off parallel computing.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Entering Commands에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by