#NEWLINE# def eval_path( self , p ) : #NEWLINE# #INDENT# ' Given permutation of cities as a list of indices,\n        return total path length ' #NEWLINE# out = sum ( ( out . distance [ p [ i ] ] [ p [ ( i + 1 ) ] ] for i in range ( ( len ( p ) - 1 ) ) ) ) #NEWLINE# return out