Measure for how close the suboptimal solution from an Approximation Algorithm is to the optimal solution.
Formally, we say that an algorithm for a problems has an approximation ratio of if, for any input of size , the cost of the solution produced by the algorithm is within a factor of of the cost of an optimal solution: \max \left( \frac{C}{C^{}^{}^\*}, \frac{C^\*}{C} \right) \leq \rho(n)
If an algorithm achieves an approximation ratio of , it is called a ρ(n)-approximation algorithm.
The approximation ratio is never less than 1, since implies . Therefore a 1-approximation algorithm produces an optimal solution and an algorithm with a larger ratio returns a solution worse than optimal.
The ratio works for both maximization and minimization problems:
- Maximization: We by definition that and therefore the ratio will dominate the max function and represent
- Minimization: We have by definition that and therefore the ratio will dominate the max function and represent .
If an algorithm is a randomized approximation algorithm then the expected cost
plays the role of C.