I would like to maximize the maximum of a vector that is a function of my optimization variables.

Basically, I want to do the following, but in a “JuMP way”.

@objective(model, Max, max(my_vec...))

On the tips and tricks site in the JuMP docs there’s a similar trick for doing this with the “min of min”. But as it is already stated there, this trick cannot easily be used for a max of max.

Maybe someone knows a trick for implementing this?

Essentially, I have a function g(...) of some optimization variables and I want to maximize it across different dimensions and stages of the optimization variables.
So something like

@variable(model, X[1:3, 1:100])
my_vec = [g(x) for x in reshape(X, 3*100, 1)]
@objective(model, Max, max(my_vec...))

The function g is convex in most cases, but I would like a general way of implementing this.
Thanks for your help so far. I will take a closer look at the options you already sent as soon as I can

Okay, I’ve had some time to implement some of your options.
I had tried using max(my_vec...)with Ipopt before and remember running into problems with that. It just never finds a solution for my problem and reaches the maximum number of iterations even after (appropriately) increasing the number of allowed iterations.

I quite like the binary variable/indicator constraint options. They are easy to understand and seem to work fine for what I’m doing. Also, wow, Gurobi is fast. I only installed it now to exactly recreate your code snippets and will use it a lot more now!

Just to complete the conversation, another way of solving this is running a separate maximization problem for each element of my_vec and then comparing the results.