Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Add sample steady state payout computation #1396

Merged
merged 2 commits into from
Sep 6, 2013
Merged

Add sample steady state payout computation #1396

merged 2 commits into from
Sep 6, 2013

Conversation

carsomyr
Copy link
Contributor

@carsomyr carsomyr commented Sep 6, 2013

This is the long promised steady state payout computation for issue #449.

chadwhitacre added a commit that referenced this pull request Sep 6, 2013
Add sample steady state payout computation
@chadwhitacre chadwhitacre merged commit b6db5f9 into gratipay:master Sep 6, 2013
@chadwhitacre
Copy link
Contributor

Thanks @carsomyr! Great to have this in the repo finally. :-)

@MikeFair
Copy link

MikeFair commented Dec 2, 2013

Spoke with carsomyr this evening; we're both agreed that trying to get matrices to be the primary method of calculation and using them to crunch steady state is likely to get exponentially large very quickly.

So it looks like the next item on the agenda for me is calculating each iteration of the graph directly through a cypher query in neo4j and only using python (or some other external processor) as a pump to keep the process going while there are still residual balances in the system to push through (and possibly to detect non-converging states).

@carsomyr
Copy link
Contributor Author

carsomyr commented Dec 2, 2013

@MikeFair That's a quadratic blowup, but it's bad enough, and I'll be looking into efficient ways to calculate degeneracy of an adjacency matrix.

@MikeFair
Copy link

MikeFair commented Dec 2, 2013

@carsomyr

Switching gears to the "heartbeat", 'Clockwork", or "Bang the Gong" model
where the distribution of funds is iterated one-step along the graph in
neo4j every turn;
here's the neo4j CYPHER query that will execute one iteration for all nodes
that have a give_amt greater than 1e-18 (and return the set of nodes
updated):

match n-[r:GIVES_TO]->m
where n.give_amt > 0.0000000000000000001
with n, sum(r.units)*1.0 as total, n.give_amt as give_amt
match n-[r:GIVES_TO]->m
SET m.give_amt = m.give_amt + r.units/total * give_amt
, n.give_amt = case when n.give_amt > 0.0000000000000000001 then
(n.give_amt - r.units/total * give_amt) else 0 end
return n.id, m.id, n.give_amt, m.give_amt

It currently throws away values less than 1e-18.
It takes 32 iterations on the current graph I'm using to converge.

On Sun, Dec 1, 2013 at 10:37 PM, Roy Liu notifications@github.com wrote:

@MikeFair https://github.com/MikeFair That's a quadratic blowup, but
it's bad enough, and I'll be looking into efficient ways to calculate
degeneracy of an adjacency matrix.


Reply to this email directly or view it on GitHubhttps://github.com//pull/1396#issuecomment-29597359
.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants