Example #1
0
def dealImproveCity(self, payload):
    global route, shortest, working
    working = True
    start_city, route = pickle.loads(payload)
    if DEBUG:
        print "Running city swap, city:", start_city
    new_route = algo_improve_swap(cities, route, start_city)
    len_old = route_length_final(cities, route)
    len_new = route_length_final(cities, new_route)
    if (len_old > len_new):
        print "City swap has improved:", len_old, ">", len_new
        route = new_route[0:]
        shortest = len_new
        self.sendPickle(C_SEND_RES, new_route)
    working = False
Example #2
0
def dealImproveCity(self, payload):
	global route, shortest, working
	working = True
	start_city, route = pickle.loads(payload)
	if DEBUG:
		print "Running city swap, city:", start_city
	new_route = algo_improve_swap(cities, route, start_city)
	len_old = route_length_final(cities, route)
	len_new = route_length_final(cities, new_route)
	if (len_old > len_new):
		print "City swap has improved:", len_old, ">", len_new
		route = new_route[0:]
		shortest = len_new
		self.sendPickle(C_SEND_RES, new_route)
	working = False
Example #3
0
def algo_combo2(cities):
	route = algo_greedy(cities)
	for i in xrange(2,4):
		route = algo_improve_rev(cities,route,i)
		route = algo_improve_swap(cities,route)
	return route
Example #4
0
def algo_combo2(cities):
    route = algo_greedy(cities)
    for i in xrange(2, 4):
        route = algo_improve_rev(cities, route, i)
        route = algo_improve_swap(cities, route)
    return route