Skip to content

Commit 543b4b9

Browse files
committed
fix division by zero error in linear presolve
1 parent e22fbc8 commit 543b4b9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pyomo/repn/plugins/nl_writer.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1785,7 +1785,8 @@ def _linear_presolve(self, comp_by_linear_var, lcon_by_linear_nnz, var_bounds):
17851785
a = -coef2 / coef
17861786
x = id2
17871787
b = expr_info.const = (lb - expr_info.const) / coef
1788-
expr_info.linear[x] = a
1788+
if a != 0:
1789+
expr_info.linear[x] = a
17891790
substitutions_by_linear_var[x].add(_id)
17901791
eliminated_vars[_id] = expr_info
17911792
logger.debug(

0 commit comments

Comments
 (0)