# Maximize: x in Vectors[5, R] is not a valid variable

I am learning how to do optimization with a variable number of variables in Mathematica. I tried to write one experiment that I need to do but I have failed to get even a stripped-down version working. The code is the following

y = {1, 2, 3, 4, 5}
Maximize[{Sum[Indexed[y, i]/Indexed[x, i], {i, 1, 5}],
ForAll[i,Indexed[y, i]^(1/4) <= Indexed[x, i] <= Indexed[y, i]^(1/2)]},
x ∈ Vectors[5, Reals]]


But it says

Maximize::ivar: x ∈ Vectors[5, Reals] is not a valid variable.


I have tried to re-write the optimization problems in different ways but nothing helped. Any advice on what I am doing wrong would be greatly appreciated.

I think there are two issues. One, the constraint using ForAll doesn't work, and two, Vectors[5, Reals] is not a region:

RegionQ[Vectors[5, Reals]]


False

So, one idea is to use VectorLessEqual instead of ForAll, and to use FullRegion as the region:

Maximize[
{y . (1/x), VectorLessEqual[{y^(1/4), x}] && VectorLessEqual[{x, y^(1/2)}]},
x ∈ FullRegion
]


{1 + 2 Sqrt + 2^(3/4) + 3^(3/4) + 5^( 3/4), {x -> {1, 2^(1/4), 3^(1/4), Sqrt, 5^(1/4)}}}

Here's one way to write this:

y = {1, 2, 3, 4, 5};
xvec = Array[x, 5];
NMaximize[{Total[y/xvec], Thread[y^(1/4) <= xvec <= y^(1/2)]}, xvec]

{11.1334, {x -> 1., x -> 1.18921, x -> 1.31607, x -> 1.41421, x -> 1.49535}}


The elements of xvec are the variables x, x, etc. The Threading is needed so that all the constraints are stated properly. It also works fine with Maximize instead of NMaximize:

Maximize[{Total[y/xvec], Thread[y^(1/4) <= xvec <= y^(1/2)]}, xvec]

{1 + 2 Sqrt + 2^(3/4) + 3^(3/4) + 5^(3/4),
{x -> 1, x -> 2^(1/4), x -> 3^(1/4), x -> Sqrt, x -> 5^(1/4)}}