@@ -209,6 +209,10 @@ def define_components(mod):
209209 become non-linear.
210210
211211 """
212+ # When this variable is True we only allow positive fuel costs
213+ # This simplifies the model since we can set some of our constraints
214+ # as greater than instead of equals.
215+ ONLY_POSITIVE_RFM_COSTS = False
212216
213217 mod .REGIONAL_FUEL_MARKETS = Set (dimen = 1 )
214218 mod .rfm_fuel = Param (mod .REGIONAL_FUEL_MARKETS , within = mod .FUELS )
@@ -244,7 +248,9 @@ def zone_rfm_init(m, load_zone, fuel):
244248 dimen = 3 ,
245249 validate = lambda m , r , p , st : (r in m .REGIONAL_FUEL_MARKETS and p in m .PERIODS ),
246250 )
247- mod .rfm_supply_tier_cost = Param (mod .RFM_SUPPLY_TIERS , within = Reals )
251+ mod .rfm_supply_tier_cost = Param (
252+ mod .RFM_SUPPLY_TIERS , within = PositiveReals if ONLY_POSITIVE_RFM_COSTS else Reals
253+ )
248254 mod .rfm_supply_tier_limit = Param (
249255 mod .RFM_SUPPLY_TIERS , within = NonNegativeReals , default = float ("inf" )
250256 )
@@ -365,13 +371,20 @@ def GENS_FOR_RFM_PERIOD_rule(m, rfm, p):
365371 enforce_fuel_consumption_scaling_factor = 1e-2
366372
367373 def Enforce_Fuel_Consumption_rule (m , rfm , p ):
368- return m .FuelConsumptionInMarket [
369- rfm , p
370- ] * enforce_fuel_consumption_scaling_factor == enforce_fuel_consumption_scaling_factor * sum (
374+ lhs = (
375+ m .FuelConsumptionInMarket [rfm , p ] * enforce_fuel_consumption_scaling_factor
376+ )
377+ rhs = enforce_fuel_consumption_scaling_factor * sum (
371378 m .GenFuelUseRate [g , t , m .rfm_fuel [rfm ]] * m .tp_weight_in_year [t ]
372379 for g in m .GENS_FOR_RFM_PERIOD [rfm , p ]
373380 for t in m .TPS_IN_PERIOD [p ]
374381 )
382+ # If we have only positive costs, FuelConsumptionInMarket will automatically
383+ # try to be minimized in which case we can use a one-sided constraint
384+ if ONLY_POSITIVE_RFM_COSTS :
385+ return lhs >= rhs
386+ else :
387+ return lhs == rhs
375388
376389 mod .Enforce_Fuel_Consumption = Constraint (
377390 mod .REGIONAL_FUEL_MARKETS , mod .PERIODS , rule = Enforce_Fuel_Consumption_rule
0 commit comments