valnet / valuenetwork

Resource Planning and Value Accounting for Value Networks
http://mikorizal.org
GNU Affero General Public License v3.0
99 stars 25 forks source link

Resource contributions not computed correctly in flows from use events #477

Open bhaugen opened 8 years ago

bhaugen commented 8 years ago

Income distributions which explode through use events need to include the use value as a factor in the income share calculation. This works for everything else (as far as I know), but not for resource contributions.

sqykly commented 6 years ago

This seems pretty fundamental. But I don't understand the calculation well enough to determine if it's fixed or not. Do you remember fixing this?

bhaugen commented 6 years ago

This is deep in the weeds. I would need to add a test case with the expected result and see what happens.

See https://github.com/valnet/valuenetwork/blob/master/valuenetwork/valueaccounting/tests/test_value_equations.py and NRP value equation algorithm

I'll take a look through the code later today.

bhaugen commented 6 years ago

@sqykly

The situation here is a contributed resource (like some equipment) that is used to produce other resources. A resource is contributed through a Resource Contribution Transfer Type in a Material Contribution Exchange Type

If some income derives from the produced resource, a share of that income should be distributed to the agent who contributed the resource, based on the use value of the use event. ("Use" is an event type that does not consume the resource but does add value to other resources produced by using it in a production process.)

Some relevant notes, from various sources:

From the NRP value equation algorithm:

  • Use events are not contributions, although money and work that went into the usable resource (for example, a community-funded 3D printer) are contributions.
    • The amount of a contribution that went into a process is determined by the use value of the use event (hours * value per unit of use), and each contribution’s share of the value of the usable resource.

The relevant code starts here: https://github.com/valnet/valuenetwork/blob/master/valuenetwork/valueaccounting/models.py#L4552

(That line number was accurate as of 2018-03-20. If the code has changed, search for "#use events are not contributions, but their resources may have contributions".)

That calls resource.compute_income_shares_for_use

That method does check for resource contribution events and includes the use value of the event in its computation. I haven't followed the code path from there - I would probably need to set up that test case and walk it thru in the debugger. It might be ok.

I'm explaining all this to you because the value equations are such a critical part of what Sensorica does, and the code is complex. Some of that is necessary complexity, some probably unnecessary (could be rethought-refactored in a new NRP project).

I don't know if they will have any upcoming cases of using a contributed resource in a production process, which would affect the priority of this issue.

bhaugen commented 6 years ago

@sqykly did that compute at all for you?

sqykly commented 6 years ago

Mostly. I get that conceptually there is reason to reward an equipment donor for value obtained through use of the donated equipment. I am not ready to claim that I can follow the code calculating said value entirely - mostly because there seems to be a lot of it. The different measures of value in different fields (some of which are probably empty) are tough to follow, too.

Devil's advocate - is there anything preventing someone from donating something vital and demanding profit from it in perpetuity? It seems that could theoretically allow some abusive capitalism; or is there some other aspect of the calculation or the NRP that reduces that risk?

I believe there are going to be several labs added, though I don't know what part of the space and equipment can be considered donated.

bhaugen commented 6 years ago

@sqykly

Devil's advocate - is there anything preventing someone from donating something vital and demanding profit from it in perpetuity? It seems that could theoretically allow some abusive capitalism; or is there some other aspect of the calculation or the NRP that reduces that risk?

Good question! A value equation has a field called Claim rule type that determines the terms for which a contribution is eligible for income:

I am not ready to claim that I can follow the code calculating said value entirely - mostly because there seems to be a lot of it. The different measures of value in different fields (some of which are probably empty) are tough to follow, too.

Yeah, the code got pretty complicated. That was a hard test to write. But it works. I'm not sure this issue is an outstanding bug, but so far, it is the only one we have heard of.

We do get complaints from Tibi that it is difficult to understand, but then, Sensorica actually wanted all those options...there's an idea from Bayle Shanks about detailed logs of what happened in a distribution that would be good to implement and might help.

fosterlynn commented 6 years ago

Devil's advocate - is there anything preventing someone from donating something vital and demanding profit from it in perpetuity? It seems that could theoretically allow some abusive capitalism; or is there some other aspect of the calculation or the NRP that reduces that risk?

Also, in general, the value equations are meant to be decided on democratically by the project, so everyone agrees on the calculations for how people receive income from different kinds of contributions.