Closed jgtz closed 4 years ago
Note: I added a print statement before the "PyBoolNet.BooleanLogic.minimize_espresso" error to see the function,
It looks like this error is in the rspace construction part, not the network reduction part. I'll look into it though. Thanks for the detailed report!
I think I've got it. It was that I wasn't handling the case when we get information from the TR stable motifs, but not the single-node drivers. Since it was such a small bugfix (2 lines), I've pushed directly to the master branch.
The example you gave now runs. I'll leave it to you to close the issue when you're convinced the bug isn't popping up in your other tests.
Found a problem that, I think, is related to the fix (I think when the list you added to fix the problem is empty?)
Code:
start=default_timer()
rules=rbn_ensemble[0]
rules = sm.Format.booleannet2bnet(rules)
primes = PyBoolNet.FileExchange.bnet2primes(rules)
PyBoolNet.PrimeImplicants._percolation(primes,True)
end=default_timer()
print("Time (s) creating reduced networks:",end-start)
print("Reduced network size: ",str(len(primes)))
#sm.Format.pretty_print_prime_rules(primes)
N=1000
K=2
p=sm.RandomBooleanNetworks.get_criticality_p_Kauffman(K)[0]
N_ensemble=10
seed=1000
rbn_ensemble=sm.RandomBooleanNetworks.Random_Boolean_Network_Ensemble_Kauffman(N,K,p,N_ensemble,seed=seed,write_Boolean_network=True)
start=default_timer()
diag = sm.Succession.build_succession_diagram(primes)
end=default_timer()
print("Time (s) finding atttactors:",end-start)
print("Number of attractors: ",str(len(diag.attractor_fixed_nodes_list)))
diag.attractor_candidate_summary()
Error
Time (s) creating reduced networks: 0.25272280399999403
Reduced network size: 355
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-5-5ac000e2c334> in <module>
10
11 start=default_timer()
---> 12 diag = sm.Succession.build_succession_diagram(primes)
13 end=default_timer()
14 print("Time (s) finding atttactors:",end-start)
~/anaconda3/envs/py37_SM/lib/python3.7/site-packages/StableMotifs/Succession.py in build_succession_diagram(primes, fixed, motif_history, diagram, merge_equivalent_motifs, max_simulate_size, prioritize_source_motifs)
608 diagram, merge_equivalent_motifs=merge_equivalent_motifs,
609 max_simulate_size=max_simulate_size,
--> 610 prioritize_source_motifs=prioritize_source_motifs)
611 return diagram
612
~/anaconda3/envs/py37_SM/lib/python3.7/site-packages/StableMotifs/Succession.py in build_succession_diagram(primes, fixed, motif_history, diagram, merge_equivalent_motifs, max_simulate_size, prioritize_source_motifs)
585 if fixed is None:
586 fixed = {}
--> 587 myMotifReduction=sm_reduction.MotifReduction(motif_history,fixed.copy(),primes,max_simulate_size=max_simulate_size,prioritize_source_motifs=prioritize_source_motifs)
588 if diagram is None:
589 diagram = SuccessionDiagram()
~/anaconda3/envs/py37_SM/lib/python3.7/site-packages/StableMotifs/Reduction.py in __init__(self, motif_history, fixed, reduced_primes, max_simulate_size, prioritize_source_motifs)
247 #self.fixed_rspace_nodes =sm_rspace.fixed_rspace_nodes(self.rspace,self.reduced_primes)
248 self.rspace = sm_rspace.reduce_rspace(self.rspace,self.reduced_primes)
--> 249 self.fixed_rspace_nodes = self.rspace[0][0]
250
251 for motif in self.stable_motifs:
IndexError: list index out of range
Okay, I think I fixed it for real this time.
I also fixed another small bug that appeared in this example; the formatter that passes rules to espresso wasn't handling trivial rules (e.g., n26*=0) properly in certain circumstances during reduction.
I have not found any more problems with this when testing, so I think I will close it.
During network reduction, a function has a he form "() & (X)", which causes problems downstream.
Here is an example:
Here is the error: