Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between a stochastic and a heuristic algorithm

Extending the question of streetparade, I would like to ask what is the difference, if any, between a stochastic and a heuristic algorithm.

Would it be right to say that a stochastic algorithm is actually one type of heuristic?

like image 655
orestis21 Avatar asked Jan 22 '15 09:01

orestis21


People also ask

What is the main difference between an algorithm and a heuristic?

An algorithm is a step-wise procedure for solving a specific problem in a finite number of steps. The result (output) of an algorithm is predictable and reproducible given the same parameters (input). A heuristic is an educated guess which serves as a guide for subsequent explorations.

What is a stochastic algorithm?

Stochastic Optimization Algorithms Stochastic optimization refers to a field of optimization algorithms that explicitly use randomness to find the optima of an objective function, or optimize an objective function that itself has randomness (statistical noise).

What is the difference between an algorithm and a heuristic psychology?

Algorithms and heuristics are different approaches to solving problems. Algorithms are comprehensive step-by-step procedures. They are exhaustive and guarantee the correct solution, but may be time-consuming and require a lot of mental effort. In contrast, heuristics are shortcut strategies or rules-of-thumb.

What is an example of a heuristic algorithm?

Knapsack Problem An example heuristic for this problem is a greedy algorithm, which sorts the items in descending order of value per weight, and then proceeds to insert them into the “sack”. This ensures the most valuably “dense” items make it into the sack first.


2 Answers

Booth approaches are usually used to speed up genere and test solutions to NP complete problems

  1. Stochastic algorithms use randomness

    They use all combinations but not in order but instead they use random ones from the whole range of possibilities hoping to hit the solution sooner. Implementation is fast easy and single iteration is also fast (constant time)

  2. Heuristics algorithms

    They pick up the combinations not randomly but based on some knowledge on used process, input dataset, or usage instead. So they lower the number of combinations significantly to only those they are probably the solution and use only those but usually all of them until solution is found.

    Implementation complexity depends on the problem, single iteration is usually much much slower then stochastic approach (constant time) so heuristics is used only if the number of possibilities is lowered enough to actual speed up is visible because even if algorithm complexity with heuristic is usually much lower sometimes the constant time is big enough to even slow things down ... (in runtime terms)

Booth approaches can be combined together

like image 171
Spektre Avatar answered Oct 05 '22 18:10

Spektre


TTBOMK, "stochastic algorithm" is not a standard term. "Randomized algorithm" is, however, and it's probably what is meant here.

Randomized: Uses randomness somehow. There are two flavours: Monte Carlo algorithms always finish in bounded time, but don't guarantee an optimal solution, while Las Vegas algorithms aren't necessarily guaranteed to finish in any finite time, but promise to find the optimal solution. (Usually they are also required to have a finite expected running time.) Examples of common Monte Carlo algorithms: MCMC, simulated annealing, and Miller-Rabin primality testing. Quicksort with randomized pivot choice is a Las Vegas algorithm that always finishes in finite time. An algorithm that does not use any randomness is deterministic.

Heuristic: Not guaranteed to find the correct answer. An algorithm that is not heuristic is exact.

Many heuristics are sensitive to "incidental" properties of the input that don't affect the true solution, such as the order items are considered in the First-Fit heuristic for the Bin Packing problem. In this case they can be thought of as Monte Carlo randomized algorithms: you can randomly permute the inputs and rerun them, always keeping the best answer you find. OTOH, other heuristics don't have this property -- e.g. the First-Fit-Decreasing heuristic is deterministic, since it always first sorts the items in decreasing size order.

If the set of possible outputs of a particular randomized algorithm is finite and contains the true answer, then running it long enough is "practically guaranteed" to eventually find it (in the sense that the probability of not finding it can be made arbitrarily small, but never 0). Note that it's not automatically the case that some permutation of the inputs to a heuristic will result in getting the exact answer -- in the case of First-Fit, it turns out that this is true, but this was only proven in 2009.

Sometimes stronger statements about convergence of randomized algorithms can be made: these are usually along the lines of "For any given small threshold d, after t steps we will be within d of the optimal solution with probability f(t, d)", with f(t, d) an increasing function of t and d.

like image 31
j_random_hacker Avatar answered Oct 05 '22 19:10

j_random_hacker