In my introduction to optimization course, we are given the following problem as an example:
Sorting task: Given real numbers $c_1, c_2, \ldots, c_n \in \mathbb{R}$, we want to find the $k$ smallest numbers. This is the $k$-smallest numbers optimization problem: $$ \begin{align*} &\min_{x_1, \ldots, x_n} &c_1 x_1 + c_2 x_2 + \cdots + c_n x_n\\ &\textrm{subject to} &x_1 + x_2 + \cdots + x_n = k\\ & &\textrm{for all } i=1, \ldots, n: 0 \leq x_i \leq 1 \end{align*} $$
I don't understand what this is trying to achieve. If you are trying to find the 1st to $k$'th smallest numbers, why are $x_i$ real numbers instead of integers where $x_i \in \{0, 1\}$? If they were integers, then when $x_i = 0$, it would mean that $c_i$ is not among the $k$-smallest numbers (not selected), while $x_i= 1$ means that $c_i$ is selected. Or is this problem trying to minimize the weighted sum of $c_1, \ldots, c_n$? Why must all $x_i$ sum to $k$?