I want to multiply the range of each variable because I can't use more than 5 kg and 50 euros so I multiply the weight of each product and its value but instead, the program returns me an error that it's taking the value an instead of the range.
from constraint import *
problem = Problem()
problem.addVariable("a",range(0,51))
problem.addVariable("b",range(0,51))
problem.addVariable("c",range(0,11))
problem.addVariable("d",range(0,6))
problem.addConstraint(MaxSumConstraint(5000),['a'*340, 'b'*120,'c'*105,'d'*300])
problem.addConstraint(MaxSumConstraint(50),['a'*2,'b','c'*4,'d'*5])
soluciones = problem.getSolutions()
for solucion in soluciones:
solucion_string = ""
for i in range(4):
solucion_string += "("+str(i)+","+str(solucion[i])+")"
print(solucion_string)
print(len(soluciones))
I want to use the value of the range of each variable and multiply it.