GeomScale / dingo

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

`NameError` when using the `sample_from_polytope` function #24

Closed hariszaf closed 3 years ago

hariszaf commented 3 years ago

For a A and b numpy objects, the sample_from_polytope function of dingo's PolytopeSampler class returns a NameError: name 'self' is not defined.

Here is an example case that will lead you to this error:

from dingo import PolytopeSampler
import numpy as np

# Build a random A matrix and a b vecrtor to use them to build a polytope
A = np.random.random([32,21])
b = np.random.random([32,])

# Now, try to sample using the sample_from_polytope method of the PolytopeSampler class
samples = PolytopeSampler.sample_from_polytope(A,b)

And here is the full error message returned:

   173         P = HPolytope(A, b)
    174 
--> 175         if self._parameters["fast_computations"]:
    176             A, b, Tr, Tr_shift, samples = P.fast_mmcs(
    177                 ess, psrf, parallel_mmcs, num_threads

We probably need to add a check for gurobi as in line 52.