IN-CORE / pyincore

pyIncore is a component of IN-CORE. It is a python package consisting of two primary components: 1) a set of service classes to interact with the IN-CORE web services, and 2) IN-CORE analyses . The pyIncore allows users to apply various hazards to infrastructure in selected areas, propagating the effect of physical infrastructure damage and loss of functionality to social and economic impacts.
Mozilla Public License 2.0
25 stars 7 forks source link

INDP solver failed #585

Closed longshuicy closed 1 month ago

longshuicy commented 3 months ago

glpk


AttributeError Traceback (most recent call last) Cell In[22], line 2 1 # Run Analysis ----> 2 indp_analysis.run_analysis()

File ~/opt/miniconda3/envs/incoreRC1.19.0rc2/lib/python3.9/site-packages/pyincore/baseanalysis.py:399, in BaseAnalysis.run_analysis(self) 396 print("Error reading parameter: " + result[1]) 397 return result --> 399 return self.run()

File ~/opt/miniconda3/envs/incoreRC1.19.0rc2/lib/python3.9/site-packages/pyincore/analyses/indp/indp.py:96, in INDP.run(self) 93 if save_model is None: 94 save_model = False ---> 96 action_result, cost_result, runtime_result = self.run_method(fail_sce_param, RC, layers, method=method, 97 t_steps=t_steps, 98 misc={'DYNAMIC_PARAMS': dynamic_params, 99 'EXTRA_COMMODITY': extra_commodity, 100 'TIME_RESOURCE': time_resource}, 101 save_model=save_model) 103 self.set_result_csv_data("action", action_result, name="actions.csv") 104 self.set_result_csv_data("cost", cost_result, name="costs.csv")

File ~/opt/miniconda3/envs/incoreRC1.19.0rc2/lib/python3.9/site-packages/pyincore/analyses/indp/indp.py:279, in INDP.run_method(self, fail_sce_param, v_r, layers, method, t_steps, misc, save_model) 276 raise ValueError('Wrong failure scenario data type.') 278 if params["ALGORITHM"] == "INDP": --> 279 indp_results = self.run_indp(params, layers=params['L'], controlled_layers=params['L'], 280 T=params["T"], save_model=save_model, print_cmd_line=False, 281 co_location=False) 282 for t in indp_results.results: 283 actions = indp_results[t]['actions']

File ~/opt/miniconda3/envs/incoreRC1.19.0rc2/lib/python3.9/site-packages/pyincore/analyses/indp/indp.py:389, in INDP.run_indp(self, params, layers, controlled_layers, functionality, T, save, suffix, forced_actions, save_model, print_cmd_line, co_location) 386 DislocationUtil.dynamic_parameters(interdependent_net, original_N, 0, 387 params['DYNAMIC_PARAMS']['DEMAND_DATA']) 388 v_0 = {x: 0 for x in params["V"].keys()} --> 389 results = self.indp(interdependent_net, v_0, 1, layers, controlled_layers=controlled_layers, 390 functionality=functionality, co_location=co_location) 391 indp_results = results[1] 392 if save_model:

File ~/opt/miniconda3/envs/incoreRC1.19.0rc2/lib/python3.9/site-packages/pyincore/analyses/indp/indp.py:653, in INDP.indp(self, N, v_r, T, layers, controlled_layers, functionality, fixed_nodes, print_cmd, co_location) 647 m.arc_equality = pyo.Constraint(m.a_hat_prime, 648 m.time_step, 649 rule=INDPUtil.arc_equality_rule, 650 doc='Arc reconstruction equality') 652 # Conservation of flow constraint. (2) in INDP paper. --> 653 m.flow_conserv_node = pyo.Constraint(m.delta_p_index_0, 654 m.time_step, 655 rule=INDPUtil.flow_conserv_node_rule, 656 doc='Flow conservation') 657 # Flow functionality constraints. 658 m.flow_in_functionality = pyo.Constraint(m.a_hat, m.time_step, rule=INDPUtil.flow_in_functionality_rule, 659 doc='Flow In Functionality')

File ~/opt/miniconda3/envs/incoreRC1.19.0rc2/lib/python3.9/site-packages/pyomo/core/base/block.py:550, in BlockData.getattr(self, val) 547 return _component_decorator(self, ModelComponentFactory.get_class(val)) 548 # Since the base classes don't support getattr, we can just 549 # throw the "normal" AttributeError --> 550 raise AttributeError( 551 "'%s' object has no attribute '%s'" % (self.class.name, val) 552 )

AttributeError: 'ConcreteModel' object has no attribute 'delta_p_index_0'

navarroc commented 3 months ago

Some extra details:

I downgraded pyomo to 6.6.2 and scip to 8.0.3 and INDP runs without issue. If I just downgrade pyomo, SCIP gives an error that "Solver (scip) did not exit normally"