travel salesman question on Matlab using genetic algorithm
Show older comments
I need help please for one of the optimisation questions in MATLAB
We have to assume a runner running at a constant speed(15kmph) has to cover a distance in 60 minutes. There is a start point and he needs to return to this start point after covering a certain distance visiting a point only once from a point.( like Travelsalesman problem)
There are 27 points which are plotted on a map, thus we need to note the distance from each point to each point and import this matrix into MATLAB, the runner has to cover the optimised distance scoring max. marks by travelling from these points.
The first 9 points i.e. 1 to 9 have 2 marks and followed 9 has 3 marks and last 9 has 4 marks. the runner has to gain max. marks and cover distance in 60 min, else he has a penalty of 2 marks after every 30 sec.
I am attaching the distance file for all 28 points including the start point- walkingdistances.csv
Also, there are few hints given below by the expert:
1) Do you understand how the OrderBasedExample sets up the problem and runs the ga function? 2) Do you understand what the tspeval.m function is supposed to do?
If you understand these two then you should know what your function should do; it should return the total points you would score running the orienteering course for an order of controls that you have been given.
That means that you need to write code into tspeval.m that 1) total up the points you would get for passing each of the controls you are given in sol, 2) calculates the total distance you would cover following the order of controls you are given in sol, 3) calculate the time you need to run that distance (you would need to enter in a speed that you are running at), 4) find out how many points you would lose for taking longer than 60 minutes 5) return the final score via val.
To start off with you should only try to do 1 and 5. You can do the rest once you have it working.
kindly help me with code.
Thanking you sincerely I have no clue how to do it, never used the software before. can anyone help me with code, please, waiting for your kind help :)
1 Comment
Walter Roberson
on 10 Sep 2017
You appear to be making reference to https://github.com/estsauver/GAOT which is the Genetic Algorithm Optimization Toolbox. That is a third-party toolbox that is written in MATLAB but which does not use the Mathwork's Global Optimization Toolbox's genetic algorithm routines.
Answers (1)
Categories
Find more on Nearest Neighbors in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!