# Reframing decision, counting, enumeration, and search as optimization

The top accepted answers to the questions below allude to two complexity classes of optimization problems: NPO and PO (in relation to NP and P for decision problems):

The way these questions and answers are written, I get the impression that many problems such as counting, enumeration, or searching problems could be framed as general optimization problems even if their formulation does not have an explicit objective function (i.e. mathematical programming problems). Is that correct?

Take decision problems for example, one often casts decisions in machine learning (ML) as those that minimize regret, or e.g. an expected error in the evaluation against a loss function (e.g. 0/1 for decision problems).

These types of decisions or search as-optimization formulations for a wide variety of problems are fairly ubiquitous in ML.

Take some other common examples:

• Find the $$n$$th Fibonacci term
• Find the GCD of a set of numbers
• Enumerate the subsets for which 3SUM answers "Yes"
• Count all hamiltonian cycles in a graph
• etc.

Couldn't one easily reframe many of them as optimization problems using a loss function as well? e.g. $$\text{argmin}_x f(x)$$, where $$f$$ is a measure of error defined on the solution space of the desired problem? Or is that reduction, despite its prevalence in e.g. ML, not always "easy", feasible or useful?

More generally, how does the family of complexity classes (and their associated types of reductions and definitions) for search, enumeration and counting relate to the family of their "reduction-equivalent" optimization problems?

• With "ML" you are referring to ML right? – uli Apr 22 at 12:49
• Thanks @uli. Sorry I wasn't clear. I was referring to machine learning. I updated the post accordingly. – Amelio Vazquez-Reina Apr 22 at 12:55
• Ah, all the young folks messing with the established abbreviations .... – uli Apr 22 at 13:01
• You can add an objective function to sorting so that the sorted sequence gets min cost/max points and then interpret the problem of sorting a sequence as the optimization problem of finding the sequence with min cost/max points (the sorted one). That just makes things more complicated. My guess for sorting is that the objective function should not be too hard to find. I guess it would fit on a single sheet of paper. But for anything more involved the objective function is most likely not "simple", "linear", has a closed form and fits on one sheet of paper. – uli Apr 22 at 15:12
• And constructing the objective functions in general or perhaps even automatically is probably a whole other matter. Take for example linear programming. If you are a carpenter or a tailor and want to solve the cutting-stock-problem via linear programming. You have to come up with the concrete objective function for the linear programm for your scenario to limit the waste of material. This is an art in itself. – uli Apr 22 at 15:19

• Thanks, but couldn't one reframe these problems as optimization problems using a loss function? e.g. $\text{argmin}_x f(x)$, where f is a measure of error defined against the result of the desired problem. In other words, couldn't one argue that (many?) non-optimization problems are "easily" reducible to optimization problems? Or is that not always feasible? – Amelio Vazquez-Reina Apr 21 at 12:01