Skip to content

Instantly share code, notes, and snippets.

@wilsonianb
Created June 21, 2018 23:18
Show Gist options
  • Save wilsonianb/d17dc79f0e24ae030e225ed17a37c311 to your computer and use it in GitHub Desktop.
Save wilsonianb/d17dc79f0e24ae030e225ed17a37c311 to your computer and use it in GitHub Desktop.
from sympy import *
# nj is larger UNL size, o is common unl size, pi/pj is extra size of ni/nj, qj is nj's quorum, tj is fault tolerance of nj
nj, pi, pj, qj, tj = symbols("nj, pi, pj, qj, tj")
oij = nj - pj
ni = oij + pi
ti = ni/4 - pi/4 - pj/4
fork_safej = oij > (ni/2 + nj - qj + ti)
qj = solve(fork_safej,qj).args[1]
print 'qj >', qj
fork_firstj = (1-qj/nj)*nj > tj
print solve(fork_firstj,tj)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment