Here’s an improved version of your message with clearer details about the error and your model setup:
Hello,
I’m working on a GAMS model where I have a variable L
representing the battery’s level of charge in MWh over time periods t
. One of my constraints involves limiting the change in charge level between consecutive time periods.
Here’s the formula I’m trying to use:
pow[t] = (L[t+1] - L[t]) <= C
However, I encounter this error:
TypeError: Domain item must be type Set, Alias, ImplicitSet or str but found <class 'gamspy._algebra.expression.Expression'>
It seems the error arises because of L[t+1]
.
How can I reference the next value of L
(i.e., L[t+1]
) within the same constraint, so I can calculate the difference with L[t]
?