diff --git a/src/math/simplex/model_based_opt.cpp b/src/math/simplex/model_based_opt.cpp index fbbe05801..5321d2d0c 100644 --- a/src/math/simplex/model_based_opt.cpp +++ b/src/math/simplex/model_based_opt.cpp @@ -489,6 +489,8 @@ namespace opt { if (m_type == t_mod) return *this; rational D(abs(m_coeff)); + if (D == 0) + D = 1; for (auto const& [id, coeff] : m_vars) if (coeff != 0) D = lcm(D, abs(coeff));