Good evening,
I'm doing an implementation of a mathematical optimization model in Python 3.4. I need to do a multiplication of a "Lambda" parameter indexed in i, j, tt and an "x" variable indexed in i, t. The multiplication is contained in a sum of i, j, tt and t. However, when I implement it in Python and try to solve the problem through Cplex I get the following message:
cplex.exceptions.errors.CplexError: Inconsistent arguments
Part of the code with the error
dat.IT = [(i,t) for i in dat.I for t in dat.T[i]]
nx = ["x(" + str(i) + "," + str(t) + ")" for (i,t) in dat.IT]
Lambda = [[[0.0 for t in dat.T[j]] for j in dat.I] for i in dat.I]
When declaring the objective function of the problem:
sp.variables.add(obj = [-Lambda[i][j][tt] for i in dat.I for j in dat.I if i != j for tt in dat.T[j] for t in range(max(0, tt - dat.p[i][0] - dat.SETUP[i][j][0] + 1), min(tt + dat.p[j][0] + dat.SETUP[j][i][0] - 1, dat.h[i] - dat.p[i][0] + 1) + 1)], names = nx)
I'm sure the error is this multiplication. Can anyone help me?