Question: This is a step of simulated annealing algorithm for TSP, in Python. But I don't get what it does. It says True, but is it

This is a step of simulated annealing algorithm for TSP, in Python. But I don't get what it does. It says True, but is it talking about what condition? what are i and j? why should one be bigger than the other one? Please explain

def propose_move(self): n = self.n #number of cities while True: i = np.random.randint(n) j = np.random.randint(n) if i != j: break if i > j: i, j = j, i return (i,j)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!