0
$\begingroup$

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?

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

1 Answer 1

1
$\begingroup$

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...

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.