From: Glenn on
I'm having a problem with the @gacreationlinearfeasible function in the GADS Toolbox.

My call to ga:
[x fval exitflag output population scores] = ...
ga(f,length(x),A,b,Aeq,beq,lb,ub,nonlcon,gaopts);

where
f = @(x)objfunc(x,myarg1,myarg2,...,myargN);

and x is of length 14:
x = [15 7 0 0.0105 2 1535 1.55 0.08 1620 1.59 0.02 1800 1.95 0.02]

I want to search each parameter +/- 10%, so
lb = 0.9*x;
ub = 1.1*x;

Also,
Aeq = [];
beq = [];
nonlcon = [];

and for initial testing I am using
gaopts = gaoptimset('PopulationSize',10,...
'generations',10,...
'elitecount',1,...
'outputfcn',@aplgaoutputfcn01);

where my custom output function @aplgaoutputfcn contains
....
%% write to output file
fid = fopen('gaout.txt','a');
fprintf(fid,'Generation %d:\n',state.Generation);
for i = 1:length(state.Score)
fprintf(fid,'%2d %5.2f ',i,state.Score(i));
fprintf(fid,'%6.3f %6.3f %6.2f %7.5f %5.3f',state.Population(i,1:5));
fprintf(fid,' %7.2f %5.3f %6.4f',state.Population(i,6:end));
fprintf(fid,'\n');
end
fprintf(fid,'\n');
fclose(fid);
....

-----------------------------------------------
When I set A = [] and b = [], I get what I expect, that is a uniform draw for each parameter within lb and ub.

Generation 0:
1 6.22 13.500 6.300 0.00 0.00945 1.800 1381.50 1.395 0.0880 1458.00 1.431 0.0220 1620.00 1.755 0.0180
2 5.58 13.620 6.802 0.00 0.00968 1.982 1584.79 1.505 0.0811 1663.91 1.635 0.0207 1756.33 2.112 0.0200
3 2.75 14.971 7.540 0.00 0.01127 1.835 1565.00 1.623 0.0839 1526.15 1.602 0.0189 1809.64 1.880 0.0216
4 6.11 14.931 7.450 0.00 0.01068 2.115 1563.82 1.554 0.0863 1720.58 1.704 0.0189 1784.84 1.795 0.0209
5 6.52 14.722 7.553 0.00 0.00953 1.885 1473.14 1.490 0.0740 1688.04 1.531 0.0195 1974.36 2.122 0.0216
6 6.13 14.194 7.277 0.00 0.00946 1.893 1503.60 1.658 0.0758 1708.69 1.625 0.0183 1959.44 2.112 0.0186
7 5.42 14.918 6.556 0.00 0.01085 2.081 1643.03 1.694 0.0735 1522.88 1.507 0.0196 1704.36 1.924 0.0203
8 6.25 13.528 6.604 0.00 0.01045 2.032 1599.37 1.401 0.0754 1709.54 1.705 0.0187 1816.34 1.854 0.0205
9 6.10 14.983 6.887 0.00 0.01026 2.019 1544.90 1.577 0.0784 1696.00 1.624 0.0214 1621.82 1.890 0.0211
10 4.45 16.105 7.281 0.00 0.01099 2.031 1549.51 1.401 0.0753 1561.20 1.665 0.0219 1733.64 1.910 0.0192

-----------------------------------------------
However, I would also like to impose a linear inequality constraint such that x(9) is always greater than or equal to x(6) within the upper bounds (note this is violated by individual 7 above), so I set
A = zeros(1,length(x));
A(6) = -1;
A(9) = 1;
b = 0;

This results in:

Generation 0:
1 6.30 13.500 6.300 0.00 0.01155 1.800 1458.00 1.395 0.0880 1458.00 1.431 0.0220 1620.00 1.755 0.0220
2 6.30 16.500 6.300 0.00 0.01155 1.800 1458.00 1.395 0.0880 1458.00 1.431 0.0220 1620.00 1.755 0.0220
3 6.30 13.500 6.300 0.00 0.01155 1.800 1458.00 1.395 0.0880 1458.00 1.431 0.0220 1620.00 1.755 0.0220
4 6.30 13.500 6.300 0.00 0.01155 1.800 1458.00 1.395 0.0880 1458.00 1.431 0.0220 1620.00 1.755 0.0220
5 6.28 13.500 6.300 0.00 0.01155 1.800 1458.00 1.395 0.0720 1458.00 1.431 0.0220 1620.00 1.755 0.0220
6 6.29 13.500 6.300 0.00 0.01155 1.800 1458.00 1.395 0.0820 1458.00 1.431 0.0220 1620.00 1.755 0.0220
7 6.30 13.500 6.300 0.00 0.01155 1.800 1458.00 1.395 0.0880 1458.00 1.431 0.0220 1620.00 1.755 0.0220
8 6.28 13.500 6.300 0.00 0.01155 1.800 1458.00 1.395 0.0763 1458.00 1.431 0.0220 1620.00 1.755 0.0220
9 6.28 13.500 6.300 0.00 0.01155 1.800 1458.00 1.395 0.0765 1458.00 1.431 0.0220 1620.00 1.755 0.0220
10 6.29 13.500 6.300 0.00 0.01155 1.800 1458.00 1.395 0.0807 1458.00 1.431 0.0220 1620.00 1.755 0.0220

As you can see the parameter space is not being properly sampled.

I tried A = A' but got an error. I also tried to chase down the error in @feasibleLHS but couldn't figure out the algorithm.

Any help would be appreciated...