Calculates probability and draws if solution should be accepted.

    Based on exp(-Delta*E/T) formula.

    Args:
        random_sample: Uniformly distributed random number in the range [0, 1).
        cost_diff: Cost difference between new and previous solutions.
        temp: Current temperature.

    Returns:
        Tuple of boolean and float, with boolean equal to True if solution is
        accepted, and False otherwise. The float value is acceptance
        probability.

def _accept(random_sample: float, cost_diff: float,
            temp: float) -> Tuple[bool, float]:
    """Calculates probability and draws if solution should be accepted.

    Based on exp(-Delta*E/T) formula.

    Args:
        random_sample: Uniformly distributed random number in the range [0, 1).
        cost_diff: Cost difference between new and previous solutions.
        temp: Current temperature.

    Returns:
        Tuple of boolean and float, with boolean equal to True if solution is
        accepted, and False otherwise. The float value is acceptance
        probability.
    """
    exponent = -cost_diff / temp
    if exponent >= 0.0:
        return True, 1.0
    else:
        probability = math.exp(exponent)
    return probability > random_sample, probability