Skip to content

Commit

Permalink
added warning
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewellis55 committed Sep 20, 2024
1 parent cd4747f commit bbc1c6f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pyoptsparse/pySLSQP/pySLSQP.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import datetime
import os
import time
import warnings

Check warning on line 10 in pyoptsparse/pySLSQP/pySLSQP.py

View check run for this annotation

Codecov / codecov/patch

pyoptsparse/pySLSQP/pySLSQP.py#L10

Added line #L10 was not covered by tests

# External modules
import numpy as np
Expand Down Expand Up @@ -166,6 +167,9 @@ def __call__(
# SLSQP - Objective/Constraint Values Function
# =================================================================
def slfunc(m, me, la, n, f, g, x):
if (x < blx).any() or (x > bux).any():
warnings.warn("Values in x were outside bounds during a "
"minimize step, clipping to bounds", RuntimeWarning)
fobj, fcon, fail = self._masterFunc(np.clip(x, blx, bux), ["fobj", "fcon"])
f = fobj
g[0:m] = -fcon
Expand Down

0 comments on commit bbc1c6f

Please sign in to comment.