From 94e97322db2e3f91f59cb938ad518d06b0a5e683 Mon Sep 17 00:00:00 2001 From: Jason Yao Date: Mon, 16 Dec 2024 09:52:02 -0500 Subject: [PATCH] add additional logging information --- pyomo/contrib/pyros/pyros_algorithm_methods.py | 7 +++++++ pyomo/contrib/pyros/separation_problem_methods.py | 10 ++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/pyomo/contrib/pyros/pyros_algorithm_methods.py b/pyomo/contrib/pyros/pyros_algorithm_methods.py index 86e5d52935b..ba2ba2362c6 100644 --- a/pyomo/contrib/pyros/pyros_algorithm_methods.py +++ b/pyomo/contrib/pyros/pyros_algorithm_methods.py @@ -273,6 +273,13 @@ def ROSolver_iterative_solve(model_data): # terminate on time limit if separation_results.time_out or separation_results.subsolver_error: + # report PyROS failure to find violated constraint for subsolver error + if separation_results.subsolver_error: + config.progress_logger.warning( + "PyROS failed to find a constraint violation and " + "will terminate with sub-solver error." + ) + pyros_term_cond = ( pyrosTerminationCondition.time_out if separation_results.time_out diff --git a/pyomo/contrib/pyros/separation_problem_methods.py b/pyomo/contrib/pyros/separation_problem_methods.py index e39d0e4edf1..241763a86b8 100644 --- a/pyomo/contrib/pyros/separation_problem_methods.py +++ b/pyomo/contrib/pyros/separation_problem_methods.py @@ -469,8 +469,8 @@ def get_worst_discrete_separation_solution( results_list = [] # check if there were any failed scenarios for subsolver_error - # this only needs to be returned once for the subsolver error efficiency - if any(np.isnan(violations_of_ss_ineq_con)) and is_optimized_ss_ineq_con: + # if there are failed scenarios, subsolver error triggers for all ineq + if any(np.isnan(violations_of_ss_ineq_con)): subsolver_error_flag = True else: subsolver_error_flag = False @@ -1164,6 +1164,12 @@ def discrete_solve( for param, coord_val in zip(uncertain_param_vars, scenario): param.fix(coord_val) + # debug statement for solving square problem for each scenario + # TODO add information on total number of scenarios not added to MP + config.progress_logger.debug( + f"Attempting to solve square problem for discrete scenario {scenario_idx}" + ) + # obtain separation problem solution solve_call_results = solver_call_separation( separation_data=separation_data,