MATLAB: In MATLAB, can we use ga with numerical constraint

ga

It might be weird question, if i cannot perform the analytic function of constraint, i have only numerical constraint, can we use ga with this numerical constraints?
thank you very much. best regard!!

Best Answer

If you want to put only upper and lower bounds on your parameters, you have to fill the unused arguments with ‘empty’ values using the empty matrix, [].
For instance, to only specify the upper and lower bounds:
LB = [ ... ]; % Vector Of Lower Bounds For Each Parameter
UB = [ ... ]; % Vector Of Upper Bounds For Each Parameter
x = ga(fitnessfcn,nvars,[],[],[],[],LB,UB)