MATLAB: GA using Integer Constraints not running every member of Population

gaintegeroptimization

Hi
So I was using matlab's ga to solve an optimization problem with 40 variables. Before I set it up like so
LB = .05e-6*ones(1,nvars);
UB = 1e-6*ones(1,nvars);
Length = 20e-6;
Aeq = ones(1,nvars);
opts = gaoptimset('OutputFcns',@myOutFun,'TolCon',.01e-6);
[x,fval,exitFlag,Output,population] = ga(@grating_cost_function_arb,nvars,[],[],Aeq,Length,LB,UB,[],opts);
And it was working fine, but it ended up generating variations in the variables on the order of 1e-10 (a scale that I don't want the ga to even consider because the cost function that I use in the ga uses a simulation program that results in practically the same cost when the variables are changed like this). So I changed my ga to an integer problem like so:
LB = 5*ones(1,nvars);
UB = 100*ones(1,nvars);
Length = 2000;
AintIneq = ones(2,nvars);
AintIneq(1,:) = -1*AintIneq(1,:);
bIntIneq = [-Length; Length];
intCon = 1:nvars;
opts = gaoptimset('OutputFcns',@myOutFun,'TolCon',1);
[x,fval,exitFlag,Output,population] = ga(@grating_cost_function_arb,nvars,AintIneq,bIntIneq,[],[],LB,UB,[],intCon,opts);
In my cost function now I convert the integers back to non-integer values by multiplying the generated variables by 1e-6/100. The ga still works but for some reason now, instead of running the simulation for each member of the population it runs approximately 15 of each generation. What's really confusing me is that even though it runs my cost function (the simulation) for only like 15 population members, the state variable has function values (cost function values) for all 100 members of each generation (100 because of changing my problem to an integer problem). Is there any reason why this is happening? Can I change this so it runs the cost function for each member? Also if it doesn't run the cost function for each member how does it generate the next generation?
Thanks Yanni

Best Answer

Wait I think I figured it out. Looking here it seems that the way integer programming works is that it tries to minimize a penalty function where if the member is a feasible member (i.e. it satisfies my linear inequalities) it minimizes my cost function, but if the member is not feasible (the sum of the variables is not between 1999 and 2001 inclusive) the penalty function becomes "the maximum fitness function among feasible members of the population, plus a sum of the constraint violations of the (infeasible) point." So all these members that aren't being run don't sum up to the correct value so they're cost function becomes this penalty function and the simulation doesn't run.
Thanks!