I am attempting to implement a simple CP-SAT where the objective is to minimize the largest value assigned across all decision variables. I can minimize any individual variable or a linear function of variables, but it seems I am unable to minimize the maximum of variables. Is there a way to achieve this? Perhaps a way to linearize a max() function?
Note: I do have constraints in my model, but I'm omitting them here as I do not believe they are relevant to my question.
from ortools.sat.python import cp_model
model = cp_model.CpModel()
num_vars = 50
variables = {}
for i in range(num_vars):
variables[i] = model.NewIntVar(0,i,'n_%i'% i)
The following line always results in an error, as does alternative arguments, e.g., an iterator.
model.Minimize(max(variables))