TITLE: Scaling a set of reals to be nearly integers
QUESTION [8 upvotes]: A version of this question was previously asked on MSE. I'll mention progress below.
A geometric construction I'm exploring
leads to a set $R$ of $n$ positive real numbers, for example:
$$
R = \{ \pi, e, \sqrt{2} \} \approx \{3.14159, 2.71828, 1.41421\} \;.
$$
Given some $\epsilon > 0$, I would like to find the smallest scale
factor $s$ so that, for each $x \in R$, $s x$ is within $\epsilon$ of a natural number (i.e., excluding $0$).
More precisely, if $[z]$ is $z$ rounded to the nearest integer, then $| sx - [sx] | < \epsilon$.
For example, if $\epsilon = 0.08$, then $s=7.018$ works for the above $R$:
$$
7.018 \, R \approx \{22.048, 19.077, 9.925\} \;,
$$
and the gaps to the nearest integers are
$$
\{0.048, 0.077, 0.075 \} \;,
$$
each less than $\epsilon$.
But I don't know that $7.018$ is the minimum.

Q. What is a general procedure to compute the smallest $s$, given $R$ and $\epsilon$? Ideally I would like an algorithm.

Two algorithms were proposed at MSE, both somewhat brute-force searches.
One searches through all
the integers to which the scaled reals might round.
The other searches
through rational approximations to pairwise ratios of the reals.
In my circumstance, $|R|$ might be $10$ or $20$, or even larger.
For fixed $R$, how the minimum $s$ varies with $\epsilon$ is of interest
to me, so I understand the tradeoffs between $s$ and $\epsilon$.
A comment at MSE suggests the relationship between $s$ and $\epsilon$
could behave "a bit wildly."

REPLY [2 votes]: Even though you asked for the optimal solution and others have already answered in this regard, I think it's still worth mentioning the following efficient approach to getting "good" solutions which may not be optimal:
Let me first mention a different but related problem: given $(\xi_1,\ldots,\xi_r) \in \mathbb{R}^r$ (all irrational, say), how can we simultaneously approximate the $\xi_i$ by rationals $p_i/q$ having the same denominator $q$?  I.e., how can we scale $(\xi_1,\ldots,\xi_r)$ by a $q\in\mathbb{N}_{>0}$ so that $|q\xi_i - p_i|$ are small without $q$ being too large?
Dirichlet tells us that there exist $q$ arbitrarily large so that $|q\xi_i - p_i| \leq q^{-1/r}$ where $p_i = \lceil q\xi_i \rfloor$ ("closest integer to"); it doesn't help us find them, unfortunately.  But here's how we can obtain a not-quite-so-good approximation in an algorithmically convenient way: for $A>0$ real, consider the image of the $\mathbb{Z}$-linear map $\mathbb{Z}^{r+1} \to \mathbb{R}^{r+1}$ taking $(p_1,\ldots,p_r,q)$ to $(A(q\xi_1-p_1),\ldots,A(q\xi_r-p_r),q/A^r)$.  This is a lattice in $\mathbb{R}^{r+1}$, which I just described through a matrix, and we are trying to find short nonzero vectors in it: using the LLL algorithm we can find something like $|q\xi_i - p_i| \leq 2^{r/2}/A$ with $q\leq 2^{r/2} A^r$.
As for your original problem, if we are given $(\xi_0,\ldots,\xi_r)$, you can first scale by $\xi_0^{-1}$, say putting $\xi'_i = \xi_i/\xi_0$ so that $\xi'_0 = 1$, forget about this one and apply what I just said to $(\xi'_1,\ldots,\xi'_r)$: this gives you a scale factor $s := q/\xi_0$ such that $s\xi_i \approx p_i$ is close to an integer and $s\xi_0 = q$ is an integer.
Given that the problem of finding the shortest nonzero vector in a lattice is hard (in various practical or conjectural ways), I suspect your problem is algorithmically hard if you insist on getting the optimal solution and if $r$ (your $n-1$) is large.  But I thought the LLL algorithm deserved at least a mention.