image thumbnail

bdtsp_ga_basic(popS​ize, numIter, xy, alpha, range )

version (7.6 KB) by Robert Rich
Optimizes Hub-spoke (number hubs, location of dynamic hubs) for blimp-drone delivery (see Amazon)


Updated 08 Oct 2017

View License

% FUNCTION: mclust_ga_basic calculates the minimum of the sum of the max
% distances for several clusters. In essence, it is a clustering tool
% that minimizes the max distances between each cluster and the farthest
% member of that cluster. Genetic algorithm minimizes the sum of the max
% distance of each of the centroid (cluster centers) then calculates the
% TSP distance from each centroid to each centroid.
% Inputs:
% population size and iterations
% xy coordinates
% speed of drone as a factor of blimp speed
% range of drone
% Outputs:
% number of centroids
% assignement of xy coordinates to centroids
% (note that one or more coordinates will become centroids)
% GA uses uses a tournament approach mutation type genetic algorithm.
% Initialize:
% (1) Calculate the distance from each xy coordinate to every other xy
% coordinate as distance matrix dmat.
% Body:
% (1) Randomly generate populations
% (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.
% Find the best of the 4; 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.
% Example of inputs:
% nStops=30; % Number of delivery stops for blimp-drone
% popSize = 500; % Size of the population of trials.
% numIter = 2500; % Number of iterations of GA; iteration budget.
% alpha = 2; % Speed of drone as a factor of blimp
% range = 10; % Range of drone (i.e. 10 km)
% xy=50*rand([nStops,2]);
% bdtsp_ga_basic(popSize, numIter, xy, alpha, range )

Cite As

Robert Rich (2021). bdtsp_ga_basic(popSize, numIter, xy, alpha, range ) (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2017b
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!