0

So I've combed through the various websites pertaining to Julia JuMP and using functions as arguments to @objective or @NLobjective, but let me try to state my problem. I'm certain that I'm doing something silly, and that this is a quick fix.

Here is a brief code snippet and what I would like to do:

using juMP;

tiLim = 1800;
x = range(1,1,M); # M stated elsewhere
solver_opt = "bonmin.time_limit=" * "$tiLim";
m = Model(solver=AmplNLSolver("bonmin",[solver_opt]));

@variables m begin
   T[x];
   ... # Have other decision variables which are matrices
end

@NLobjective(m,:Min,maximum(T[i] for i in x));

Now from my understanding, the `maximum' function makes the problem nonlinear and is not allowed inside the JuMP objective function, so people will do one of two things:

(1) play the auxiliary variable + constraint trick, or

(2) create a function and then `register' this function with JuMP.

However, I can't seem to do either correctly.

Here is an attempt at using the auxiliary variable + constraint trick:

mymx(vec::Array) = maximum(vec) #generic function in Julia

@variable(m, aux)
@constraint(m, aux==mymx(T))

@NLobjective(m,:Min,aux)

I was hoping to get some assistance with doing this seemingly trivial task of minimizing a maximum.

Also, it should be noted that this is a MILP problem which I'm trying to solve. I've previously implemented the problem in CPLEX using the ILOG script for OPL, where this objective function is much more straightforward it seems. Though it's probably just my ignorance of using JuMP.

Thanks.

1 Answers1

0

You can model this as a linear problem as follows:

@variable(m, aux)
for i in x
    @constraint(m, aux >= T[i]
end
@objective(m, Min, aux)
Benoît Legat
  • 958
  • 1
  • 8
  • 10