@@ -257,15 +257,10 @@ def room(model, reference=None, cache={}, volatile=True, delta=0.03, epsilon=0.0
257
257
258
258
if not volatile and constraint_a_id in cache ['constraints' ]:
259
259
constraint_a = cache ['constraints' ][constraint_a_id ]
260
- constraint_a ._set_coefficients_low_level ({var : - reaction .upper_bound + w_u })
260
+ constraint_a ._set_coefficients_low_level ({var : reaction .upper_bound - w_u })
261
261
constraint_a .ub = w_u
262
262
else :
263
-
264
- # vi - yi(vmaxi + w_ui) >= w_ui
265
- expression = add ([
266
- reaction .variable ,
267
- mul ([RealNumber (- reaction .upper_bound + w_u ), var ])])
268
-
263
+ expression = reaction .flux_expression - var * (reaction .upper_bound - w_u )
269
264
constraint_a = (model .solver .interface .Constraint (expression , ub = w_u , sloppy = True ))
270
265
if not volatile :
271
266
cache ['constraints' ][constraint_a_id ] = constraint_a
@@ -276,14 +271,10 @@ def room(model, reference=None, cache={}, volatile=True, delta=0.03, epsilon=0.0
276
271
277
272
if not volatile and constraint_b_id in cache ['constraints' ]:
278
273
constraint_b = cache ['constraints' ][constraint_b_id ]
279
- constraint_b ._set_coefficients_low_level ({var : - reaction .lower_bound + w_l })
274
+ constraint_b ._set_coefficients_low_level ({var : reaction .lower_bound - w_l })
280
275
constraint_b .lb = w_l
281
276
else :
282
- # vi - yi(vmini - w_li) <= w_li
283
- expression = add ([
284
- reaction .variable ,
285
- mul ([RealNumber (- reaction .lower_bound + w_l ), var ])])
286
-
277
+ expression = reaction .flux_expression - var * (reaction .lower_bound - w_l )
287
278
constraint_b = (model .solver .interface .Constraint (expression , lb = w_l , sloppy = True ))
288
279
if not volatile :
289
280
cache ['constraints' ][constraint_b_id ] = constraint_b
0 commit comments