Share information between objective and constraint function with genetic algorithm
조회 수: 12 (최근 30일)
이전 댓글 표시
Hi,
I am using the genetic algorithm solver to minimise a function with non-linear constraints and mixed-integer variables. My constraints and objective functions share some heavy and identical computation. I was wondering whether there was a way to pass variables between these functions? I wanted to use something like Objective and Nonlinear Constraints in the Same Function, but it doesn't work with the genetic algorithm solver. I am using the gentic algorithm as follows:
fun = @computeMagVol;
nVars = 4;
A = [];
b = [];
Aeq = [];
beq = [];
lb = [4, 80, 1,1];
ub = [6,130,41,4];
nonlcon = @combineConstraints;
IntCon = [3,4];
options = optimoptions('ga','PopulationSize' , 25, ...
'PlotFcn' ,@gaplotPopAndBestIndiv, ...
'FunctionTolerance', 1.0000e-03 );
[x,fval,exitflag,output] = ga(fun,nVars,A,b,Aeq,beq,lb,ub,nonlcon,IntCon,options);
toc
Any suggestions would be greatly appreciated.
Best,
Ryan
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Genetic Algorithm에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!