Skip to content

Commit

Permalink
Change to manual_allocation property
Browse files Browse the repository at this point in the history
  • Loading branch information
cmutel committed Jul 8, 2024
1 parent 8f6037a commit f6b48be
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ There is currently no built-in functionality to determine if an edge is function

* `price`: Does economic allocation based on the property "price" in each functional edge.
* `mass`: Does economic allocation based on the property "mass" in each functional edge.
* `manual`: Does allocation based on the property "manual" in each functional edge. Doesn't normalize by amount of production exchange.
* `manual_allocation`: Does allocation based on the property "manual_allocation" in each functional edge. Doesn't normalize by amount of production exchange.
* `equal`: Splits burdens equally among all functional edges.

Property-based allocation assumes that each functional edge has a `properties` dictionary, and this dictionary has the relevant key with a corresponding numeric value. For example, for `price` allocation, each functional edge needs to have `'properties' = {'price': some_number}`.
Expand Down
2 changes: 1 addition & 1 deletion multifunctional/allocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def property_allocation(

allocation_strategies = {
"price": property_allocation("price"),
"manual": property_allocation("manual", normalize_by_production_amount=False),
"manual_allocation": property_allocation("manual_allocation", normalize_by_production_amount=False),
"mass": property_allocation("mass"),
"equal": partial(generic_allocation, func=lambda x, y: 1.0),
}
4 changes: 2 additions & 2 deletions tests/fixtures/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"properties": {
"price": 7,
"mass": 6,
"manual": 2,
"manual_allocation": 2,
},
},
{
Expand All @@ -34,7 +34,7 @@
"properties": {
"price": 12,
"mass": 4,
"manual": 8,
"manual_allocation": 8,
},
},
{
Expand Down
2 changes: 1 addition & 1 deletion tests/test_allocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def test_price_allocation(basic):


def test_manual_allocation(basic):
basic.metadata["default_allocation"] = "manual"
basic.metadata["default_allocation"] = "manual_allocation"
bd.get_node(code="1").allocate()
check_basic_allocation_results(
0.2 * 10, 0.8 * 10, basic
Expand Down

0 comments on commit f6b48be

Please sign in to comment.