MATLAB: GA optimiser error in boxdirections

boxdirectionsgenetic algorithm

I constantly get the error shown below here and I would very much appreciate if anyone could point to what I can do to avoid this. Version is Matlab 2013a. Thanks!
Error using / Matrix dimensions must agree.
Error in boxdirections (line 23) pollParam = 1/sqrt(MeshSize);
Error in mutationadaptfeasible (line 71) [Basis,TangentCone] = boxdirections(true,StepSize,x,linCon.lb,linCon.ub,tol);
Error in stepGA (line 36) mutateKids = feval(options.MutationFcn, parents((1 + 2 * nXoverKids):end), options,GenomeLength,FitnessFcn,state,thisScore,thisPopulation,options.MutationFcnArgs{:});
Error in galincon (line 63) [score,population,state] = stepGA(score,population,options,state,GenomeLength,FitnessFcn);
Error in ga (line 351) [x,fval,exitFlag,output,population,scores] = galincon(FitnessFcn,nvars, …
Error in GAOptimDesign (line 8) [x,fval] = ga(ObjectiveFunction,nvars,[],[],[],[],LB,UB)
The code I am running is as follows, i.e. the ga optimiser from the optimtool:
ObjectiveFunction = @design; nvars = 12; % Number of variables LB = [-3 -3 -3 -3 18 10 10 5 65 65 65 65]; % Lower bound UB = [5 5 5 5 30 25 25 20 75 75 75 75]; % Upper bound
options = gaoptimset('PopulationSize',3) [x,fval] = ga(ObjectiveFunction,nvars,[],[],[],[],LB,UB
The design function is way to large to describe here.

Best Answer

Hi Ulrik,
From the docs: "You should set Population size to be at least the value of Number of variables, so that the individuals in each population span the space being searched".
If you have 12 design variables, the population size should at least be 12, not 3.
Other than that please check your code inside "design.m" to make sure you're supplying column vectors where it expects column vectors, and row vectors if it expects row vectors.