image thumbnail

mld_ga_basic(popSiz​e, numIter, len, wid, loads )

version (6.63 KB) by Robert Rich
Tournament genetic algorithm to calculate the min-cost design (load x distance) for job shop layout


Updated 04 Oct 2017

View License

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.
GA steps:
(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 )

Cite As

Robert Rich (2022). mld_ga_basic(popSize, numIter, len, wid, loads ) (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2016a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!