MATLAB: How to specify linear equality and inequality constraints using the GA function within the Genetic Algorithm and Direct Search Toolbox

equalitygageneticGlobal Optimization Toolboxinequalitylinear

I would like to be able to specfiy linear equality and inequality constraints, similar to the functions in the Optimization Toolbox.
For example:
x = fmincon(fun, x0, A, b, Aeq, beq, lb, ub)
where "A" and "b" specify the linear inequality constraints "A*x <= b", and "Aeq" and "beq" are the linear equality constraints "Aeq*x = beq".

Best Answer

This enhancement has been incorporated in Release 14 Service Pack 3 (R14SP3). For previous product releases, read below for any possible workarounds:
The ability to specify linear constraints to the GA function is not available within the the Genetic Algorithm and Direct Search Toolbox.
To solve optimization problems that involve linear constraints and bounds, use the PATTERNSEARCH function, that has the functionality for specifying linear constraints and bounds. For information on this, see the following URL:
If you would like to be able to use constraints within the GA function, you will need to program this functionality within your objective functions. For an example of how to do this, download the gaBound.m file: