GeomScale / dingo

A python library for metabolic networks sampling and analysis
GNU Lesser General Public License v3.0
41 stars 27 forks source link

fast_inner_ball computes negative radius #20

Closed vissarion closed 2 years ago

vissarion commented 2 years ago

Describe the bug The following code:

import unittest
import os
import scipy
import numpy as np
from dingo import MetabolicNetwork, PolytopeSampler
from dingo.gurobi_based_implementations import fast_inner_ball

current_directory = os.getcwd()
input_file_json = current_directory + "/ext_data/iSB619.json"

model = MetabolicNetwork.from_json(input_file_json)
model.set_fast_mode()

sampler = PolytopeSampler(model)
sampler.set_fast_mode()

steady_states = sampler.generate_steady_states()

returns

The radius calculated has negative value. The polytope is infeasible or something went wrong with the solver
Traceback (most recent call last):
  File "tests/parallel.py", line 27, in <module>
    steady_states = sampler.generate_steady_states()
  File "/home/vissarion/workspace/dingo/dingo/PolytopeSampler.py", line 136, in generate_steady_states
    self._A, self._b, Tr, Tr_shift, samples = P.fast_mmcs(
  File "dingo/volestipy.pyx", line 219, in volestipy.HPolytope.fast_mmcs
    temp_center, radius = fast_inner_ball(self._A, self._b)
TypeError: 'NoneType' object is not iterable

Desktop:

OS: Ubuntu 20.04.2 LTS
python: Python 3.8.5 [GCC 9.3.0]