SHARE
TWEET

Untitled

a guest Apr 20th, 2019 99 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. f = open("testtour.txt", 'r')
  2. starttour = []
  3. i = 0;
  4. for line in f:
  5.     starttour.append(line.strip().split(' '))
  6.     i = i+1
  7. f.close()
  8.  
  9. def twoopt(tour,i,j):
  10.     tourCopy = tour
  11.     tourCopy[i+1:j+1]= reversed(tourCopy[i+1:j+1])
  12.  
  13.     return tourCopy
  14.  
  15.  
  16. print(twoopt(starttour, 0, 5))
  17. print(starttour)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top