From a5da6df9b7cbcc0193b69cc52f74c0e2b80c127c Mon Sep 17 00:00:00 2001 From: Matthew Pearlson <45362680+matthewpearlson@users.noreply.github.com> Date: Wed, 15 Apr 2020 16:34:24 -0400 Subject: [PATCH] hot fix for ftot_pulp.py --- program/ftot_pulp.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/program/ftot_pulp.py b/program/ftot_pulp.py index 9ac855a..3fcd4dc 100644 --- a/program/ftot_pulp.py +++ b/program/ftot_pulp.py @@ -2182,7 +2182,7 @@ def create_opt_problem(logger, the_scenario, unmet_demand_vars, flow_vars, proce # demand_commodity_name = u[2] udp = u[3] unmet_demand_costs.append(udp * unmet_demand_vars[u]) - + with sqlite3.connect(the_scenario.main_db) as main_db_con: db_cur = main_db_con.cursor() @@ -2202,7 +2202,7 @@ def create_opt_problem(logger, the_scenario, unmet_demand_vars, flow_vars, proce flow_costs[edge_id] = edge_flow_cost # flow_costs.append(edge_flow_cost * flow_vars[(edge_id)]) - len(flow_costs))) + logger.info("check if candidate tables exist") sql = "SELECT name FROM sqlite_master WHERE type='table' " \ @@ -2225,14 +2225,13 @@ def create_opt_problem(logger, the_scenario, unmet_demand_vars, flow_vars, proce processor_build_cost_data = processor_build_cost.fetchall() - len(processor_build_cost_data))) + for row in processor_build_cost_data: candidate_proc_facility_id = row[0] proc_facility_build_cost = row[1] processor_build_costs.append( proc_facility_build_cost * processor_build_vars[candidate_proc_facility_id]) - len(processor_build_costs))) prob += (lpSum(unmet_demand_costs) + lpSum(flow_costs[k] * flow_vars[k] for k in flow_costs) + lpSum(