Share information between objective and constraint function with genetic algorithm
10 次查看(过去 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!