lb = [200 200 16 4 8 220];
ub = [1000 1500 25 12 10 300];

% Guide for more details.
opts = gaoptimset(...
    'PopulationSize', 150, ...
    'Generations', 200, ...
    'EliteCount', 10, ...
    'TolFun', 1e-10, ...
    'PlotFcns', @gaplotbestf);

%%
% for reproducibility.
rng(0, 'twister');
[xbest, fbest, exitflag] = ga(@columnVolume,6, [], [], [], [], ...
    lb, ub, @columnConstraints,[], opts);
    
% GA.
display(xbest);


fprintf('\nCost function returned by ga = %g\n', fbest);


lb = [1 1 1 1 1 1];
ub = [33 53 3 5 2 9];



rng(0, 'twister');
[xbestDisc, fbestDisc, exitflagDisc] = ga(@columnVolumeWithDisc, ...
    6, [], [], [], [], lb, ub, @columnConstraintsWithDisc,1:6, opts);


xbestDisc = columnMapVariables(xbestDisc);
display(xbestDisc);


fprintf('\nCost function returned by ga = %g\n', fbestDisc);

% discrete variables in the problem formulation.