@@ 1129-1149 (lines=21) @@ | ||
1126 | else: |
|
1127 | return 0 |
|
1128 | ||
1129 | def _minimum_investment_constraint(self): |
|
1130 | """Constraint factory for a minimum investment""" |
|
1131 | m = self.parent_block() |
|
1132 | ||
1133 | def _min_invest_rule(_): |
|
1134 | """Rule definition for applying a minimum investment""" |
|
1135 | for i, o in self.NON_CONVEX_INVESTFLOWS: |
|
1136 | for p in m.PERIODS: |
|
1137 | expr = ( |
|
1138 | m.flows[i, o].investment.minimum[p] |
|
1139 | * self.invest_status[i, o, p] |
|
1140 | <= self.invest[i, o, p] |
|
1141 | ) |
|
1142 | self.minimum_rule.add((i, o, p), expr) |
|
1143 | ||
1144 | self.minimum_rule = Constraint( |
|
1145 | self.NON_CONVEX_INVESTFLOWS, m.PERIODS, noruleinit=True |
|
1146 | ) |
|
1147 | self.minimum_rule_build = BuildAction(rule=_min_invest_rule) |
|
1148 | ||
1149 | return self.minimum_rule |
|
1150 | ||
1151 | def _maximum_investment_constraint(self): |
|
1152 | """Constraint factory for a maximum investment""" |
@@ 335-358 (lines=24) @@ | ||
332 | + investment_costs |
|
333 | ) |
|
334 | ||
335 | def _minimum_invest_constraint(self): |
|
336 | r""" |
|
337 | .. math:: |
|
338 | P_{invest, min} \cdot Y_{invest, status} \le P_{invest} |
|
339 | """ |
|
340 | m = self.parent_block() |
|
341 | ||
342 | def _min_invest_rule(_): |
|
343 | """Rule definition for applying a minimum investment""" |
|
344 | for i, o in self.OFFSET_INVEST_NON_CONVEX_FLOWS: |
|
345 | for p in m.PERIODS: |
|
346 | expr = ( |
|
347 | m.flows[i, o].investment.minimum[p] |
|
348 | * self.invest_status[i, o, p] |
|
349 | <= self.invest[i, o, p] |
|
350 | ) |
|
351 | self.minimum_investment.add((i, o, p), expr) |
|
352 | ||
353 | self.minimum_investment = Constraint( |
|
354 | self.INVEST_NON_CONVEX_FLOWS, m.PERIODS, noruleinit=True |
|
355 | ) |
|
356 | self.minimum_rule_build = BuildAction(rule=_min_invest_rule) |
|
357 | ||
358 | return self.minimum_investment |
|
359 | ||
360 | def _maximum_invest_constraint(self): |
|
361 | r""" |