# clarification on the definition of loss function

Given $$X$$ the set of all possible solutions, and $$A \subseteq X$$ the set of admissible solutions; a cost function is defined like this: $$f:X \rightarrow R$$.

But it is not clear to me what the function intuitively represents (for example, how is it possible that the solutions are only real numbers? Can't they be, say, strings, pairs of numbers, etc?)

We want to measure the quality of a solution, that is given two solutions, $$x, y \in A$$, I want to tell if $$x$$ is a better solution than $$y$$.
For example, for a minimization problem, we can say that $$x$$ is a better solution than $$y$$ if $$f(x) < f(y)$$.
However, in general, of course, it is possible that you might want to measure something based on different quantity and obtained a tuple instead. You can define own notion of comparison, $$<$$. For example, we might want to define things to be compared lexicographically. It is possible but for the scope of the text/paper that you read, they might want to study a particular class of problem.