In computer science, an optimization problem is the problem of finding the best solution from all feasible solutions. More formally, an optimization problem is a quadruple , where
- is a set of instances;
- given an instance , is the set of feasible solutions;
- given an instance and a feasible solution of , denotes the measure of , which is usually a positive real.
- is the goal function, and is either or .
The goal is then to find for some instance an optimal solution, that is, a feasible solution with
For each optimization problem, there is a corresponding decision problem that asks whether there is a feasible solution for some particular measure . For example, if there is a graph which contains vertices and , an optimization problem might be "find a path from to that uses the fewest edges". This problem might have an answer of, say, 4. A corresponding decision problem would be "is there a path from to that uses 10 or fewer edges?" This problem can be answered with a simple 'yes' or 'no'.
An NP optimization problem has the following further restrictions:
- can be recognized in polynomial time, and
- the size of a feasible solution is polynomially bounded by the instance size.
This implies that the corresponding decision problem is in NP. Since interesting optimization problems usually fulfill these criteria, "optimization problem" is often used synonymously with "NP optimization problem".