# Constrained optimization with a vector of (many) variables

I want to solve the following problem:

$ArgMax_{\bf x}$ $f({\bf x})$, where ${\bf x}\in\mathbb{R}^{100}$ with $x_i\in[0,10],\forall i\in\{1,...,100\}$.

I can do this with

ArgMax[{f[x1,...,x100],assumption}, {x1,...,x100}]


where

assumption = x1\[Element][0,10] && ... && x100\[Element][0,10]


but typing those 100 entries seems so unnecessary. Is there a compact way to do this?

• Something along the lines of xx = Array[x, 100]; ArgMax[Prepend[Thread[0 <= xx <= 10], f @@ xx], xx] should do... – Henrik Schumacher Apr 22 '18 at 13:03
• That actually helped me out! Thanks a lot! – juror Apr 22 '18 at 14:20
• You're welcome! – Henrik Schumacher Apr 22 '18 at 14:21

## 1 Answer

The answer by @henrik-schumacher in the comments (quoted below) helps with this.

Something along the lines of xx = Array[x, 100]; ArgMax[Prepend[Thread[0 <= xx <= 10], f @@ xx], xx] should do...