-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed error with distribute subsidies optimization.
Added new data files with firm configurations.
- Loading branch information
1 parent
a55855f
commit 26040ad
Showing
7 changed files
with
57 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import random | ||
|
||
def distribute_funding(history, subsidies, firm_number): | ||
distributed_subsidies = [] | ||
subsidies_mean = history['subsidies'].mean() | ||
subsidies_sd = history['subsidies'].std() | ||
for i in range(firm_number): | ||
new_subsidy = random.normalvariate(subsidies_mean, subsidies_sd) | ||
new_subsidy = new_subsidy if new_subsidy > 0 else 0 | ||
distributed_subsidies.append(new_subsidy) | ||
total = sum(distributed_subsidies) | ||
total = total if total != 0 else 1 | ||
for i in range(firm_number): | ||
distributed_subsidies[i] = distributed_subsidies[i] * subsidies / total | ||
return distributed_subsidies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
number;workers;sd | ||
10000;5;1 | ||
1000;25;10 | ||
100;110;20 | ||
10;1000;300 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
number;workers;sd | ||
1000;25;10 | ||
10;110;20 | ||
10;1000;300 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
number;workers;sd | ||
169162;25;10 | ||
6156;110;20 | ||
1510;1000;300 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters