I have a binary variable x [i] [j] [t] defined in the range
for i in dat.I for j in dat.I if i != j for t in range(len(dat.H[0]) + 1)
I need this variable to be multiplied by a -Lambda [i] [t] parameter in a given situation and that the variable x [j] [i] [t] (changing the order of the indexes) is multiplied by a lambda parameter [i] [t] considering the following summations:
-Lambda[i][t] for i in dat.I for j in dat.I if i != j for t in range(dat.p[i][0] + dat.SETUP[i][j][0],min(len(dat.H[0]) - dat.p[i][0] + 1,len(dat.H[0]) - dat.p[j][0] + 1))
and
Lambda[i][t] for j in dat.I for i in dat.I if i != j for t in range(dat.p[j][0] + dat.SETUP[j][i][0],min(len(dat.H[0]) - dat.p[i][0] + 1,len(dat.H[0]) - dat.p[j][0] + 1))
However, when I declare this objective function I get the following error:
cplex.exceptions.errors.CplexError: Inconsistent arguments
Can anyone help me? Here is part of the code that causes the error:
IT = [(i,j,t) for i in dat.I for j in dat.I if i != j for t in range(len(dat.H[0]) + 1)]
nx = ["x(" + str(i) + "," + str(j) + "," + str(t) + ")" for i in dat.I for j in dat.I if i != j for t in range(len(dat.H[0]) + 1)]
sp.variables.add(obj = [-Lambda[i][t] for i in dat.I for j in dat.I if i != j for t in range(dat.p[i][0] + dat.SETUP[i][j][0],min(len(dat.H[0]) - dat.p[i][0] + 1,len(dat.H[0]) - dat.p[j][0] + 1))],\
types = ['B'] * len(IT),\
names = nx) #Variável x binária
sp.variables.add(obj = [Lambda[i][t] for j in dat.I for i in dat.I if i != j for t in range(dat.p[j][0] + dat.SETUP[j][i][0],min(len(dat.H[0]) - dat.p[i][0] + 1,len(dat.H[0]) - dat.p[j][0] + 1))],\
types = ['B'] * len(IT),\
names = nx) #Variável x binária
Note: Summaries consist of "subsets" of the initial variable x [i] [j] [t].