From a8ba77a31e187a6f55800b0f4fb480a0dd2e3801 Mon Sep 17 00:00:00 2001 From: Bernard Knueven Date: Thu, 21 Nov 2024 10:53:50 -0700 Subject: [PATCH] mapping inf to large value --- doc/src/extensions.rst | 3 +++ mpisppy/opt/presolve.py | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/src/extensions.rst b/doc/src/extensions.rst index cc223f5d5..1cc8ee90e 100644 --- a/doc/src/extensions.rst +++ b/doc/src/extensions.rst @@ -179,6 +179,9 @@ In its current state, the user might opt-in to presolve for two reasons: 2. For problems where a "fixer" extension or spoke is used, determining tight bounds on the non-anticipative variables may improve the fixer's performance. +.. Note:: + Like many solvers, the presolver will convert infinite bounds to 1e+100. + .. Note:: This capability requires the auto-persistent pyomo solver interface (APPSI) extensions for Pyomo to be built on your system. This can be achieved by running ``pyomo build-extensions`` diff --git a/mpisppy/opt/presolve.py b/mpisppy/opt/presolve.py index 4418c9e82..c368e5847 100644 --- a/mpisppy/opt/presolve.py +++ b/mpisppy/opt/presolve.py @@ -26,6 +26,7 @@ from mpisppy import MPI +_INF = 1e+100 class _SPPresolver(abc.ABC): """Defines a presolver for distributed stochastic optimization problems @@ -379,7 +380,7 @@ def _lb_generator(var_iterable): for v in var_iterable: lb = v.lb if lb is None: - yield -np.inf + yield -_INF yield lb @@ -387,7 +388,7 @@ def _ub_generator(var_iterable): for v in var_iterable: ub = v.ub if ub is None: - yield np.inf + yield _INF yield ub