From afec9f68d8ce6f510feb042eec72fb80134440f6 Mon Sep 17 00:00:00 2001 From: chen Date: Tue, 9 Apr 2019 15:39:38 -0400 Subject: [PATCH 1/3] fix scenario error caused by very large budget --- bpfin/financials/loan_allocation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bpfin/financials/loan_allocation.py b/bpfin/financials/loan_allocation.py index 5962fbb..8baaa18 100644 --- a/bpfin/financials/loan_allocation.py +++ b/bpfin/financials/loan_allocation.py @@ -89,7 +89,7 @@ def loan_allocation( sum_loan_max_amount = sum(list(current_loan.max_amount for current_loan in loan_list)) if (sum_loan_max_amount + downpayment_max) <= cost: # print('\n!alert!: not financiable') - return [0] * len(loan_list) + return [0] * len(loan_list), 0 # linear programming (LP) # Set LP constrains. -- GitLab From 570a75fac2bc191c6dcf557430a3143a47c8bb7b Mon Sep 17 00:00:00 2001 From: chen Date: Tue, 9 Apr 2019 17:21:23 -0400 Subject: [PATCH 2/3] Fix feature_data for budget simulator test --- bpfin/tests/testdata/feature_data.py | 69 ++++++++++++---------------- 1 file changed, 29 insertions(+), 40 deletions(-) diff --git a/bpfin/tests/testdata/feature_data.py b/bpfin/tests/testdata/feature_data.py index 9b0981e..f4555fd 100644 --- a/bpfin/tests/testdata/feature_data.py +++ b/bpfin/tests/testdata/feature_data.py @@ -768,46 +768,35 @@ historical_cagr = 0.01242283656582921 growth_rate_flag = -2.0 budget_simulation_result = [ - [['saving_percentage', 0, 0.1, 0.2, 0.30000000000000004, 0.4, 0.5], [ - 'Budget', 0.0, 37723.783022506694, 68031.962268808478, - 68031.962268808478, 68031.962268808478, 68031.962268808478 - ], ['NYSERDA', 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], - ['Joe Fund', 0.0, 37723.783022506694, 50000.0, 50000.0, 50000.0, - 50000.0], [ - 'Tooraj Capital', 0.0, 0.0, 18031.962268808486, 18031.962268808486, - 18031.962268808486, 18031.962268808486 - ], ['Self Finance', 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]], - [['saving_percentage', 0, 0.1, 0.2, 0.30000000000000004, 0.4, 0.5], [ - 'Budget', 0.0, 43031.145022506695, 87828.359268808475, - 118031.96226880848, 118031.96226880848, 118031.96226880848 - ], ['NYSERDA', 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], - ['Joe Fund', 0.0, 37723.783022506694, 50000.0, 50000.0, 50000.0, - 50000.0], [ - 'Tooraj Capital', 0.0, 0.0, 18031.962268808486, 18031.962268808486, - 18031.962268808486, 18031.962268808486 - ], [ - 'Self Finance', 0.0, 5307.3620000000001, 19796.397000000001, 50000.0, - 50000.0, 50000.0 - ]], [['saving_percentage', 0, 0.1, 0.2, 0.30000000000000004, 0.4, 0.5], [ - 'Budget', 0.0, 55957.052946537078, 97453.214271294448, - 118031.96226880848, 118031.96226880848, 118031.96226880848 - ], ['NYSERDA', 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [ - 'Joe Fund', 0.0, 5957.0529465370792, 47453.214271294455, 50000.0, - 50000.0, 50000.0 - ], [ - 'Tooraj Capital', 0.0, 0.0, 0.0, 18031.962268808486, - 18031.962268808486, 18031.962268808486 - ], ['Self Finance', 0.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0]], - [['saving_percentage', 0, 0.1, 0.2, 0.30000000000000004, 0.4, 0.5], [ - 'Budget', 50000.0, 87723.783022506686, 118031.96226880848, - 118031.96226880848, 118031.96226880848, 118031.96226880848 - ], ['NYSERDA', 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], - ['Joe Fund', 0.0, 37723.783022506694, 50000.0, 50000.0, 50000.0, 50000.0], - [ - 'Tooraj Capital', 0.0, 0.0, 18031.962268808486, 18031.962268808486, - 18031.962268808486, 18031.962268808486 - ], ['Self Finance', 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0]] -] + [ + ['saving_percentage', 0, 0.1, 0.2, 0.30000000000000004, 0.4, 0.5], + ['Budget', 0.0, 38401.46572920159, 69293.66516557403, 69293.66516557403, 69293.66516557403, 69293.66516557403], + ['NYSERDA', 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + ['Joe Fund', 0.0, 38401.46572920159, 50000.0, 50000.0, 50000.0, 50000.0], + ['Tooraj Capital', 0.0, 0.0, 19293.665165574028, 19293.665165574028, 19293.665165574028, 19293.665165574028], + ['Self Finance', 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]], + [ + ['saving_percentage', 0, 0.1, 0.2, 0.30000000000000004, 0.4, 0.5], + ['Budget', 0.0, 43708.82772920159, 89090.06216557403, 119293.66516557403, 119293.66516557403, 119293.66516557403], + ['NYSERDA', 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + ['Joe Fund', 0.0, 38401.46572920159, 50000.0, 50000.0, 50000.0, 50000.0], + ['Tooraj Capital', 0.0, 0.0, 19293.665165574028, 19293.665165574028, 19293.665165574028, 19293.665165574028], + ['Self Finance', 0.0, 5307.362, 19796.397, 50000.0, 50000.0, 50000.0]], + [ + ['saving_percentage', 0, 0.1, 0.2, 0.30000000000000004, 0.4, 0.5], + ['Budget', 0.0, 56064.06744617847, 98305.67974830023, 119293.66516557403, 119293.66516557403, 119293.66516557403], + ['NYSERDA', 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + ['Joe Fund', 0.0, 6064.06744617847, 48305.67974830022, 50000.0, 50000.0, 50000.0], + ['Tooraj Capital', 0.0, 0.0, 0.0, 19293.665165574028, 19293.665165574028, 19293.665165574028], + ['Self Finance', 0.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0]], + [ + ['saving_percentage', 0, 0.1, 0.2, 0.30000000000000004, 0.4, 0.5], + ['Budget', 50000.0, 88401.46572920159, 119293.66516557403, 119293.66516557403, 119293.66516557403, 119293.66516557403], + ['NYSERDA', 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], + ['Joe Fund', 0.0, 38401.46572920159, 50000.0, 50000.0, 50000.0, 50000.0], + ['Tooraj Capital', 0.0, 0.0, 19293.665165574028, 19293.665165574028, 19293.665165574028, 19293.665165574028], + ['Self Finance', 50000.0, 50000.0, 50000.0, 50000.0, 50000.0, 50000.0]] + ] post_annual_bill = { UTILITY_TYPE_LIST[0]: { -- GitLab From fedbeab1fc4bbbc2d053db82f81f8fdd2f7906e3 Mon Sep 17 00:00:00 2001 From: chen Date: Wed, 10 Apr 2019 17:26:50 -0400 Subject: [PATCH 3/3] update bpfin v0.2.7 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index bb10cb6..cf54941 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ reqs = [str(req.req) for req in install_reqs] setup( name='bpfin', - version='0.2.6', + version='0.2.7', description='Finance models and utilites', author='BlocPower', author_email='admin@blocpower.org', -- GitLab