Attribute Suffixes#
Attribute suffixed can be used to provide bounds on aspects, set nominals and normalize, provide optionality
Category |
Keywords |
|---|---|
upper bound |
max, ub, UB, leq |
lower bound |
min, lb, LB, geq |
set nominal |
nominal, nom |
normalize |
norm, normalize |
optionality |
optional, report |
Take the example below.
consume_max and consume_ub are equivalent. Note that the bind for r1 is written per q as it is a list of four parameters that matches the length
For r3 the demand (maps to release) is normalized (by default) and multiplied by the nominal
r4 release is neither normalized nor multiplied with a nominal
from energia import *
m = Model()
m.q = Periods()
m.y = 4 * m.q
m.r1 = Resource(consume_max=[100] * 4)
m.r2 = Resource(consume_ub=100 * 4)
m.r3 = Resource(demand_nominal=180, demand_min=[0.6, 0.7, 0.8, 0.3])
m.r4 = Resource(release_leq = [4, 5, 6, 7], release_normalize = False)
m.show(True)
Mathematical Program for Program(m)
Index Sets
\[\displaystyle {locations} = \{ {{l0}} \}\]
\[\displaystyle {y} = \{ {{{{y}_{0}}}} \}\]
\[\displaystyle {q} = \{ {{{{q}_{0}}}, {{{q}_{1}}}, {{{q}_{2}}}, {{{q}_{3}}}} \}\]
\[\displaystyle {resources} = \{ {{r1}, {r2}, {r3}, {r4}} \}\]
s.t.
Balance Constraints
\[\displaystyle [0]\text{ }{\mathbf{{cons}}}_{{r1},{l0},{{{y}_{0}}},{{{q}_{0}}}} = 0\]
\[\displaystyle [1]\text{ }{\mathbf{{cons}}}_{{r1},{l0},{{{y}_{0}}},{{{q}_{1}}}} = 0\]
\[\displaystyle [2]\text{ }{\mathbf{{cons}}}_{{r1},{l0},{{{y}_{0}}},{{{q}_{2}}}} = 0\]
\[\displaystyle [3]\text{ }{\mathbf{{cons}}}_{{r1},{l0},{{{y}_{0}}},{{{q}_{3}}}} = 0\]
\[\displaystyle [8]\text{ }{\mathbf{{cons}}}_{{r2},{l0},{{{y}_{0}}}} = 0\]
\[\displaystyle [10]\text{ }-{\mathbf{{rlse}}}_{{r3},{l0},{{{y}_{0}}},{{{q}_{0}}}} = 0\]
\[\displaystyle [11]\text{ }-{\mathbf{{rlse}}}_{{r3},{l0},{{{y}_{0}}},{{{q}_{1}}}} = 0\]
\[\displaystyle [12]\text{ }-{\mathbf{{rlse}}}_{{r3},{l0},{{{y}_{0}}},{{{q}_{2}}}} = 0\]
\[\displaystyle [13]\text{ }-{\mathbf{{rlse}}}_{{r3},{l0},{{{y}_{0}}},{{{q}_{3}}}} = 0\]
\[\displaystyle [18]\text{ }-{\mathbf{{rlse}}}_{{r4},{l0},{{{y}_{0}}},{{{q}_{0}}}} = 0\]
\[\displaystyle [19]\text{ }-{\mathbf{{rlse}}}_{{r4},{l0},{{{y}_{0}}},{{{q}_{1}}}} = 0\]
\[\displaystyle [20]\text{ }-{\mathbf{{rlse}}}_{{r4},{l0},{{{y}_{0}}},{{{q}_{2}}}} = 0\]
\[\displaystyle [21]\text{ }-{\mathbf{{rlse}}}_{{r4},{l0},{{{y}_{0}}},{{{q}_{3}}}} = 0\]
Binds Constraints
\[\displaystyle [4]\text{ }{\mathbf{{cons}}}_{{r1},{l0},{{{y}_{0}}},{{{q}_{0}}}} - 100.0 \leq 0\]
\[\displaystyle [5]\text{ }{\mathbf{{cons}}}_{{r1},{l0},{{{y}_{0}}},{{{q}_{1}}}} - 100.0 \leq 0\]
\[\displaystyle [6]\text{ }{\mathbf{{cons}}}_{{r1},{l0},{{{y}_{0}}},{{{q}_{2}}}} - 100.0 \leq 0\]
\[\displaystyle [7]\text{ }{\mathbf{{cons}}}_{{r1},{l0},{{{y}_{0}}},{{{q}_{3}}}} - 100.0 \leq 0\]
\[\displaystyle [9]\text{ }{\mathbf{{cons}}}_{{r2},{l0},{{{y}_{0}}}} - 400.0 \leq 0\]
\[\displaystyle [14]\text{ }-{\mathbf{{rlse}}}_{{r3},{l0},{{{y}_{0}}},{{{q}_{0}}}} + 134.99999999999997 \leq 0\]
\[\displaystyle [15]\text{ }-{\mathbf{{rlse}}}_{{r3},{l0},{{{y}_{0}}},{{{q}_{1}}}} + 157.49999999999997 \leq 0\]
\[\displaystyle [16]\text{ }-{\mathbf{{rlse}}}_{{r3},{l0},{{{y}_{0}}},{{{q}_{2}}}} + 180.0 \leq 0\]
\[\displaystyle [17]\text{ }-{\mathbf{{rlse}}}_{{r3},{l0},{{{y}_{0}}},{{{q}_{3}}}} + 67.49999999999999 \leq 0\]
\[\displaystyle [22]\text{ }{\mathbf{{rlse}}}_{{r4},{l0},{{{y}_{0}}},{{{q}_{0}}}} - 4.0 \leq 0\]
\[\displaystyle [23]\text{ }{\mathbf{{rlse}}}_{{r4},{l0},{{{y}_{0}}},{{{q}_{1}}}} - 5.0 \leq 0\]
\[\displaystyle [24]\text{ }{\mathbf{{rlse}}}_{{r4},{l0},{{{y}_{0}}},{{{q}_{2}}}} - 6.0 \leq 0\]
\[\displaystyle [25]\text{ }{\mathbf{{rlse}}}_{{r4},{l0},{{{y}_{0}}},{{{q}_{3}}}} - 7.0 \leq 0\]