#include #include using std::cout; inline bool validnet(const int &activators, const int &repressors) { return (activators & repressors) == 0; } inline bool isfp(int activators, int repressors, int state) { int ns = 0; for(int b = 0; b < 4; ++b) { int a = activators & 0xf; int r = repressors & 0xf; // Require that all regulated bits = 1 // It matters not whether the unregulated genes are all 0 or all 1. if((state & a) == a && (~state & r) == r) ns |= 1 << b; activators >>= 4; repressors >>= 4; } return ns == state; } inline int fixedpoints(int activators, int repressors) { int fps = 0; for(int state = 0; state < 16; ++state) if(isfp(activators, repressors, state)) ++fps; return fps; } void printfphistogram() { std::vector fphistogram(17, 0); for(int act = 0; act < 0x10000; ++act) for(int rep = 0; rep < 0x10000; ++rep) if(validnet(act, rep)) ++fphistogram[fixedpoints(act, rep)]; cout << "#FPs\tcount\n"; for(int i = 0; i < 17; ++i) cout << i << "\t" << fphistogram[i] << "\n"; } int main() { printfphistogram(); } /* Output: #FPs count 0 13109930 1 19907908 2 7666109 3 1811682 4 426406 5 92895 6 24358 7 5033 8 1830 9 335 10 204 11 0 12 30 13 0 14 0 15 0 16 1 */