Calculates the min load distance cost for a layout using a tournament approach (mutation) genetic algorithm. The layout is based on length (len) x width (wid) of the building. Algorithm calculates the min-distance of loads times distance and then properly assigns departments with the building layout areas based on min-cost.
(1) Calculate the number of departments to layout based on length x width = departments
(2) Load matrix indicates the number of loads per/week from dep to dep
(3) Distance matrix is based on Euclidean distance between areas (rooms)
(1) Randomly generate popSize of permutations for layouts as pop
(2) Find min-cost of all pop (trials); keep best pop member and plot.
(3) Shuffle (reshuffle) pop for a new tournament
(4) Sub-group pop into groups of 4.
a. Find the best of the 4
b. Overwrite worst of 4 from sub-group pop
(5) Mutate the best of 4 (winner) in each sub-group
(6) Insert best of 4 (winner) and all mutations back into population
(7) If iteration budget remains, go to step 2, else terminate.
Termination: based on iteration budget.
Need to input population size, number of iterations, length of the
building as well as the width of the building (rectangle or square only)
% Example of inputs:
% popSize = 100; % Size of the population of trials.
% numIter = 1500; % Number of iterations of GA; iteration budget.
% len = 5; % length of rectangle ( five department areas in length)
% wid = 5; % width of rectangle building. (five dep areas in width)
% loads = randi(80, [dep dep])] % matrix of loads from
% department to department.
% mld_ga_basic(popSize, numIter, len, wid, loads )
Robert Rich (2022). mld_ga_basic(popSize, numIter, len, wid, loads ) (https://www.mathworks.com/matlabcentral/fileexchange/64362-mld_ga_basic-popsize-numiter-len-wid-loads), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!