Skip to content

Instantly share code, notes, and snippets.

@samueleresca
Created May 1, 2021 19:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samueleresca/f1a43ab8acbc43b6f263a1aed2feaccb to your computer and use it in GitHub Desktop.
Save samueleresca/f1a43ab8acbc43b6f263a1aed2feaccb to your computer and use it in GitHub Desktop.
"""
Original code available at: https://github.com/mwhittaker/quoracle/blob/master/quoracle/quorum_system.py#L498
"""
def network() -> pulp.LpAffineExpression:
reads = fr * sum(
v * len(rq)
for (rq, v) in zip(read_quorums, read_quorum_vars)
)
writes = (1 - fr) * sum(
v * len(wq)
for (wq, v) in zip(write_quorums, write_quorum_vars)
)
return reads + writes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment