NumberChemHO
PyCellChemistry documentation index
source code: src/NumberChemHO.py

#---------------------------------------------------------------------------
#
# NumberChemHO.py:
# a reimplementation of NumChem.py using HighOrderChem.py
#
# by Lidia Yamamoto, Belgium, May 2014
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# Copyright (C) 2015 Lidia A. R. Yamamoto
# Contact: http://www.artificial-chemistries.org/
#
# This file is part of PyCellChemistry.
#
# PyCellChemistry is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 3, as published by the Free Software Foundation.
#
# PyCellChemistry is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with PyCellChemistry, see file COPYING. If not, see
# http://www.gnu.org/licenses/
#


Modules
numpy
re
sys


Classes
HighOrderChem.HighOrderChem
NumberChemHO


class NumberChemHO(HighOrderChem.HighOrderChem)
Methods defined here:
__init__(self, popsize=100, minn=2, maxn=1000)
create a random soup of 'popsize' numbers ranging from 'minn'
to 'maxn'
divrule(self, m1, m2)
division rule from NumberChem.py, but now as a separate function
nprimes(self)
count the number of prime numbers in the soup
run(self, niter=10000)
run 'niter' iterations of the number chemistry,
by binding as many molecules as needed at once
trace(self, i, reaction)
print a tab-separated data line for plotting
trace_title(self)
print a tab-separated title line for plotting

Methods inherited from HighOrderChem.HighOrderChem:
is_effective(self, educts, products)
true if the reaction defined by educts --> products is
effective, that is the product multiset is different from the
educt multiset
isrule(self, mol)
true if molecule 'mol' contains a reaction rule of the form
function(args), where function is a python function call
and args are the parameters for the function
iterate(self)
run one iteration of high-order algorithm: pick a random
reaction rule, fill its binding sites with as many molecules
as needed, and fire it.
returns a triple (r, e, p) where r is the rule that has
been fired, 'e' is the educt list and 'p' is the product
list


Functions
isprime(n)
check if n is a prime, adapted from:
http://www.daniweb.com/software-development/python/code/216880/
check-if-a-number-is-a-prime-number-python


Generated automatically by pydoc, July 10, 2015


Generated automatically by pydoc, July 10, 2015