Hi,
I am trying to create a range using pyomo parameter. Following is the code and I am getting following error
TypeError: Implicit conversion of Pyomo NumericValue type `floor' to an integer is disabled. This error is often the result of using Pyomo components as arguments to one of the Python built-in math module functions when defining expressions. Avoid this error by using Pyomo-provided math functions.
sum([(x[kj, lj, ij] ** i) / prod(j for j in range(1, i)) for i in range(0, math.floor(model.gamma[kj] * model.cap[kj, lj]))])
Thank you very much in advance.
math.floor(model.gamma[kj]
If gamma is a Param (or a Python variable), then you can compute the floor outside of this expression. If gamma is a Var, then you have a modeling problem: you will need to
create an integer Var that is constrained to be the floor of gamma.
Dave
--
You received this message because you are subscribed to the Google Groups "Pyomo Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
def P1_rule(model, kj, lj, ij):
return 1 - exp(-alpha_rule(model, kj, lj, ij) * sum([(alpha_rule(model, kj, lj, ij) ** i) / prod(j for j in range(1, i)) for i in range(0, floor(model.gamma[kj]*model.cap[kj,lj]))]))
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@googlegroups.com.