Created
June 21, 2018 23:17
-
-
Save wilsonianb/c6fa4ed18601a62d42b533b32a9409e3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sympy import * | |
# ni is smaller UNL size, o is common unl size, pi/pj is extra size of ni/nj, qi is ni's quorum, ti is fault tolerance of all UNLs | |
ni, pi, pj, qi, ti = symbols("ni, pi, pj, qi, ti") | |
oij = ni - pi | |
nj = oij + pj | |
fork_safei = oij > (nj/2 + ni - qi + ti) | |
fork_firsti = (1-qi/ni)*ni <= ti | |
print solve(fork_safei,ti) | |
# For what qi are they equal? | |
qi = solve(solve(fork_safei,ti).args[1] - solve(fork_firsti, ti).args[1],qi)[0] | |
print 'qi >', qi | |
fork_firsti = (1-qi/ni)*ni > ti | |
print solve(fork_firsti,ti) | |
fork_safei = oij > (nj/2 + ni - qi + ti) | |
print solve(fork_safei,ti) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment