1
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 such a variable to be multiplied by a -Lambda[i][t] parameter in a given situation and for the variable x[j][i][t] (changing the order of the indices) to be multiplied by a Lambda[i][t] parameter 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 have the following error:
cplex.exceptions.errors.CplexError: Inconsistent arguments
Can anyone help me? Follow below 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
Obs.: Summations consist of "subsets" of the initial variable x[i][j][t].