code: def acceptance_prob(old_cost, new_cost, T):
      
      #if start pos is not valid, always move
      if old_cost == 1e20:
          return 1.0
      #if we have found a valid ps before, never move to nonvalid pos
      if new_cost == 1e20:
          return 0.0
      #always move if new cost is better
      if new_cost < old_cost:
          return 1.0
      #maybe move if old cost is better than new cost depending on T and random value
      return np.exp(((old_cost-new_cost)/old_cost)/T)
docs: annealing equation, with modifications to work towards a lower value