From cd54e6f72563f46adbfd8b61ac76e6d7f0d53824 Mon Sep 17 00:00:00 2001 From: robbybp Date: Thu, 7 Mar 2024 18:05:22 -0700 Subject: [PATCH] re-add exception I accidentally deleted --- pyomo/contrib/incidence_analysis/scc_solver.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pyomo/contrib/incidence_analysis/scc_solver.py b/pyomo/contrib/incidence_analysis/scc_solver.py index 76eb7f91cb0..eff4f5ae5fa 100644 --- a/pyomo/contrib/incidence_analysis/scc_solver.py +++ b/pyomo/contrib/incidence_analysis/scc_solver.py @@ -175,7 +175,15 @@ def solve_strongly_connected_components( ) timer.stop("calc-var-from-con") else: - inputs = list(scc.input_vars.values()) + if solver is None: + var_names = [var.name for var in scc.vars.values()][:10] + con_names = [con.name for con in scc.cons.values()][:10] + raise RuntimeError( + "An external solver is required if block has strongly\n" + "connected components of size greater than one (is not" + " a DAG).\nGot an SCC of size %sx%s including" + " components:\n%s\n%s" % (N, N, var_names, con_names) + ) if log_blocks: _log.debug(f"Solving {N}x{N} block.") timer.start("scc-subsolver")