Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

I want to apply genetic algorithm on given nodes in TSP. How can I choose population and then apply crossover and mutation to get optimum path?

Asked by Yogesh Shukla on 14 Apr 2013

loc = [0.3663, 0.9076; 0.7459, 0.8713; 0.4521, 0.8465; 0.7624, 0.7459; 0.7096, 0.7228; 0.0710, 0.7426; 0.4224, 0.7129; 0.5908, 0.6931; 0.3201, 0.6403; 0.5974, 0.6436; 0.3630, 0.5908; 0.6700, 0.5908; 0.6172, 0.5495; 0.6667, 0.5446; 0.1980, 0.4686; 0.3498, 0.4488; 0.2673, 0.4274; 0.9439, 0.4208; 0.8218, 0.3795; 0.3729, 0.2690; 0.6073, 0.2640; 0.4158, 0.2475; 0.5990, 0.2261; 0.3927, 0.1947; 0.5347, 0.1898; 0.3960, 0.1320; 0.6287, 0.0842; 0.5000, 0.0396; 0.9802, 0.0182; 0.6832, 0.8515];

NumCity = length(L);

distance = zeros(NumCity);

for i = 1:NumCity,

for j = 1:NumCity,

distance(i, j) = norm(loc(i, :) - loc(j, :));

0 Comments

Yogesh Shukla

Products

No products are associated with this question.

1 Answer

Answer by Alan Weiss on 15 Apr 2013

Perhaps this example will give you some help:

Alan Weiss

MATLAB mathematical toolbox documentation

1 Comment

Yogesh Shukla on 15 Apr 2013

Thank you for reply. How can I create my own map to use in this code. Please help me.

Alan Weiss

Contact us