# Why is a mix of greedy and random usually “best” for stochastic local search?

I read that a mix of "greedy" and "random" are ideal for stochastic local search (SLS), but I'm not sure why. It mentioned that the greedy finds the local minima and the randomness avoids getting trapped by the minima. What is the minima and how can you get trapped? Also, how does randomness avoid this? It seems like if it's truly random there's always a chance of ending up searching solutions that lead to dead ends multiple times (which seems like a waste of processing and avoidable)?

In the context of artificial intelligence, the ideas are the same. There are several algorithms that use stochastic actions in order to avoid getting trapped in local extrema. For example, simulated annealing, ant colony optimisation algorithms, $$Q$$-learning (using $$\epsilon$$-greedy) or genetic algorithms. An example of local search (or greedy) algorithm is 2-opt (for the TSP problem).