Adding new kinetic variable or exchange flux to model after setting expressions can mis-assign symbols
This issue came up when looking into parameter updating for issue #30. Currently, when the name
attribute of a derived optlang.symbolics.Symbol
object (e.g. KineticVariable
or ExchangeFlux
) is updated after adding another to the model (e.g. yval[0]
-> yval[1]
) after rhs_expression
, lower_bound_expression
or upper_bound_expression
attributes have been set, the corresponding expressions containing these symbols are not updated accordingly (e.g. yval[0]**2
would remain as is). The solution is non-trivial, even with possibility of using optlang.symbolics.Symbol
method subs
, because there is no way to keep track of previous value of name
for the respective optlang.symbolics.Symbol
object. To be safe, for now only define symbolic expressions using add_rhs_expression()
, add_exchange_flux_lb()
and add_exchange_flux_ub()
after ALL KineticVariable
and ExchangeFlux
objects have been added to the model (as done in all examples).