Skip to content

Commit

Permalink
fix sympy parsing problem
Browse files Browse the repository at this point in the history
  • Loading branch information
axelvonkamp committed Jan 25, 2024
1 parent 2f0f898 commit fa33831
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% set version = '0.0.8' %}
{% set version = '0.0.9' %}

package:
name: optlang_enumerator
Expand All @@ -19,6 +19,7 @@ requirements:
- optlang
- cobra
- efmtool_link
- sympy>=1.12


build:
Expand Down
6 changes: 3 additions & 3 deletions optlang_enumerator/mcs_computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,14 @@ def parse_relation(lhs : str, rhs : float, reac_id_symbols=None):
denominator = lhs[slash+1:]
numerator = lhs[0:slash]
denominator = parse_expr(denominator, transformations=transformations, evaluate=False, local_dict=reac_id_symbols)
denominator = sympy.collect(denominator, denominator.free_symbols)
denominator = sympy.collect(sympy.expand(denominator), denominator.free_symbols)
numerator = parse_expr(numerator, transformations=transformations, evaluate=False, local_dict=reac_id_symbols)
numerator = sympy.collect(numerator, numerator.free_symbols)
numerator = sympy.collect(sympy.expand(numerator), numerator.free_symbols)
lhs = numerator - rhs*denominator
rhs = 0
else:
lhs = parse_expr(lhs, transformations=transformations, evaluate=False, local_dict=reac_id_symbols)
lhs = sympy.collect(lhs, lhs.free_symbols, evaluate=False)
lhs = sympy.collect(sympy.expand(lhs), lhs.free_symbols, evaluate=False)

return lhs, rhs

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from setuptools import setup

setup(name='optlang_enumerator',
version='0.0.8',
version='0.0.9',
description='Enumeration of multiple solutions to a MILP with optlang.',
url='https://github.com/cnapy-org/optlang_enumerator.git',
author='Axel von Kamp',
author_email='[email protected]',
license='Apache License 2.0',
packages=['optlang_enumerator'],
install_requires=['numpy<1.24', 'scipy', 'cobra', 'optlang', 'efmtool_link', 'sympy', 'swiglpk'],
install_requires=['numpy<1.24', 'scipy', 'cobra', 'optlang', 'efmtool_link', 'sympy>=1.12', 'swiglpk'],
zip_safe=False)

0 comments on commit fa33831

Please sign in to comment.