Variables#
from gana import Prg, I, V
p = Prg()
Index Sets#
Variables can (ideally should) be declared at some index
p.y = I(size=2, tag='year')
p.q = I(size=4, tag='quarter')
p.p = I('pv', 'wf', tag='variable renewable energy processes')
Non-negative Variables#
These are continuous variable sets with a lower bound of 0. In my experience, most variables are of this type which is why these are the default variable type!
p.cap = V(p.p, p.y, tag='Nameplate Capacity')
p.prod = V(p.p, p.y, p.q, tag='Process Utilized in time (t)')
p.prod.show()
\[\displaystyle {prod}_{p, y, q}\]
All variables inside the set can also be displayed.
p.cap.show(True)
\[\displaystyle {{cap}}_{pv, y{0}}\]
\[\displaystyle {{cap}}_{pv, y{1}}\]
\[\displaystyle {{cap}}_{wf, y{0}}\]
\[\displaystyle {{cap}}_{wf, y{1}}\]
Integer Variables#
These are non-negative discrete variables. Integer variables with an upper bound of zero are binary
p.x = V(p.p, p.y, bnr=True, tag='binary variable, 1 if process is set up')
p.n = V(p.p, p.y, itg=True, tag='integer variable, number of processes set up')
Free Variables#
p.rev = V(
p.p,
p.y,
p.q,
nn=False,
tag='unbounded variable, revenue can be positive or negative',
)
Note#
gana, at the moment, is not particularly adept at handling non-linear (\(x^{i}: i > 1\)) or free variables. It will be, give me time.