samedi 10 mars 2018

Array Shuffle (With same Start and end Value)

I'm currently working on a Travelling salesman problem and i'm having trouble generating random paths with the same start and end value

This is my current path(path of cities visited)

0 1 2 3 4 5 6 7 8 9 10 11 12 13 38 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 14 39 40 41 42 43 44 45 46 47 48 49 50 51 0

See how the last node arrives back at 0(TSP logic)

Now i'm trying to shuffle this array randomly because random start points generate better results then others However I know how to shuffle the array using Collections but that would shuffle every value randomly

Basically i'm trying to create a method to shuffle an array randomly WITH THE EXCEPTION THE START and END VALUES must be the same and every number must be distinct 0-51




Aucun commentaire:

Enregistrer un commentaire