I am new to gurobipy
and I am trying to model this linear program the objective value and constraints are seen in this picture:
This is the code I have written for the objective function and constraints
#objective function
obj_fn = - quicksum(quicksum(R[k,r] * C[k,r] for k in ns) for r in nr) + quicksum(V[j] for j in np) * quicksum(W[k,j] for k in ns)
#constraints
c1 = model.addConstrs(quicksum(W[k,j] for j in np) <= quicksum(R[k,r] for r in nr) for k in ns)
c2 = model.addConstrs((R[k,r] <= P[k,r] for k in ns for r in nr))
c3 = model.addConstrs(quicksum(R[k,r] for k in ns) <= R[r] for r in nr)
c4 = model.addConstrs((quicksum(R[k,r] * X[i,k] for k in ns) <= R[r] * Z[i,r] for i in nc for r in nr))
c5 = model.addConstrs(LQ[j] <= quicksum(W[k,j] for k in ns) <= UQ[j] for j in np)
c6 = model.addConstrs((LY[i,j] <= quicksum(W[k,j] * X[i,k] for k in ns)/(quicksum(W[k,j] for k in ns)) <= UY[i,j] for i in nc for j in np))
c7 = model.addConstrs((LX[i,k] <= X[i,k] <= UX[i,k] for i in nc for k in ns))
c8 = model.addConstrs((quicksum(H[i,j,k] * X[i,k] for i in nc) == D[j,k] for j in E for k in ns))
But I am having trouble with implementing the decision variables so that I can solve the problem. I know the dimensions of each decision variable. For example, R will have different values corresponding with the kth and rth elements it possesses. Do I assign R as a matrix decision variable or just as a continuous decision variable?
Any help would be greatly appreciated.