--  depending on the current 'temperature'. The temperature is gradually
--  reduced according to an annealing schedule, making random jumps less likely
--  as the algorithm progresses.
simulatedAnnealing :: (Problem p s a) => Schedule -> p s a -> IO (Node s a)
simulatedAnnealing schedule prob = go 0 (root prob)
    where
        go k current = let t = schedule k in
            if t == 0
                then return current
