Let $f\,\colon\,\Lambda\to\mathbb R$ be a real-valued function, where $\Lambda$ is a finite integer lattice. Say, $\Lambda=\mathbb Z_3^n=\{\vec x\,\mid\, x_i=0,1,2\}$ for some $n\in\mathbb N$. I'd like to compute $$ \operatorname*{arg\, min}_{\vec x\in\Lambda} |f(\vec x)| $$
A possibility is to brute-force through all lattice points,
MinimalBy[Λ, Abs@*f] (* untested but hopefully you get the idea *)
but this becomes way too slow for large $|\Lambda|=3^n$ (and I run out of memory). For this reason, I would settle for a local minimum. In other words, given some initial point $\vec x_0\in\Lambda$, I'd like to compute the minimum of $f(\vec x)$ as $\vec x$ takes values around $\vec x_0$. If $\vec x$ were to take continuous values, I'd use a gradient descent approach, but I don't know how to use something similar in the discrete case. What is the most efficient way to do this?
For the sake of definiteness, let $n=3$:
Λ = Table[{x1, x2, x3}, {x1, 0, 2}, {x2, 0, 2}, {x3, 0, 2}];
f = Sqrt[2] #1 + Sqrt[3] #2 + Sqrt[5] #3 - 1;
In a more realistic case, $n\sim 50$ and f
has the same form as above (linear in $\vec x$, with algebraic coefficients, with a constant inhomogeneous term at the end). Evaluating f
is fast, but Λ
is way too large. How can I find a local minimum of $|f(\vec x)|$ without running out of memory and in a reasonable amount of time?