I'm trying to maximize a polynomial which has ${n\choose 3}$ variables: For starters I'm planning to do this for $n=7$.
$\displaystyle\sum_{1\leq i<j<k<l\le n}x_{ijk}x_{ikl}+x_{ijl}x_{jkl}-x_{ijk}x_{ijl}-x_{ijl}x_{ikl}-x_{ikl}x_{jkl}-x_{jkl}x_{ijk}+x_{ijk}x_{ijl}x_{ikl}x_{jkl}$
over $\{-1,1\}^{n\choose3}$.
My arguments so far:
Note that this is a discrete set. But since the polynomial is linear in each variable (checked by taking second derivative w.r.t. each variable), we can maximize over the entire cube $[-1,1]^{n\choose3}$ and deduce by working our way from an interior point to a corner by replacing each co-ordinate with a 1 or a -1 depending on which one gives a bigger value. Thus optimizing over a cube will automatically give a maximum on a corner.
This is where I'm stuck. What else should I do before running an optimization problem (if that)? Has anyone used Gloptipoly to optimize polynomials?
If more than one variable is fractional, your rounding procedure no longer works since the first rounding affects the second one. Although indeed the value increases in each stage, the greedy approach does not necessarily find the optimal value. Otherwise you might as well start the rounding procedure from a random point.
You have a difficult function (from an optimization perspective), yet only have $2^{35} \approx 34 \cdot 10^9$ feasible points. My suggestion is to compute the objective value for each feasible point.
Since Python is a scripted language, $2^{35}$ could still be a challenge. If you do not want to use a compiled language, look into Numba and @jit. You may have to write out the full polynomial. The following code should solve your problem in a few hours: