Share information between objective and constraint function with genetic algorithm

12 Ansichten (letzte 30 Tage)
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

Antworten (0)

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by