Using PSO for TSP problem

18 views
Skip to first unread message

Adam Kow

unread,
Aug 10, 2018, 10:06:24 AM8/10/18
to Inspyred
Hi,
I would like to use PSO to solve TSP.

I tried to covert ant colony example for tsp to use PSO:

I changed the part of the code:
problem = inspyred.benchmarks.TSP(weights)
ea = inspyred.swarm.PSO(prng)
ea.terminator = inspyred.ec.terminators.generation_termination
ea.topology = inspyred.swarm.topologies.ring_topology
final_pop = ea.evolve(generator=problem.generator,
evaluator=problem.evaluator,
pop_size=100,
bounder=problem.bounder,
maximize=problem.maximize,
max_evaluations=30000, neighbour_size = 5)

Code is working but a am not sure if resuls are ok.

Can you give me an advice how to use PSO algoritm to solve TSP?

Thank You!

Aaron Garrett

unread,
Aug 10, 2018, 10:25:18 AM8/10/18
to insp...@googlegroups.com
Well, the PSO (as implemented) is for continuous problems, not discrete problems like the TSP. So it won't work out of the box. Without running the code, I would guess that it generates a lot of infeasible solutions (where cities are repeated in the list and some cities aren't included). You'd need to implement a form of Discrete PSO if you want to apply the approach to TSP. If you wanted to use a non-swarm approach, you'd need to use something like permutation variation. I think there's an example comparing ACO and an EC on the TSP somewhere in the documentation.

--
You received this message because you are subscribed to the Google Groups "Inspyred" group.
To unsubscribe from this group and stop receiving emails from it, send an email to inspyred+u...@googlegroups.com.
To post to this group, send email to insp...@googlegroups.com.
Visit this group at https://groups.google.com/group/inspyred.
For more options, visit https://groups.google.com/d/optout.
--
Aaron Garrett, Ph.D.
Assistant Professor
Computer Science
Wofford College
429 North Church Street
Spartanburg, SC 29303
Reply all
Reply to author
Forward
0 new messages