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 个)

类别

Help CenterFile Exchange 中查找有关 Genetic Algorithm 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by