Skip to content

Commit

Permalink
Correction for FORM
Browse files Browse the repository at this point in the history
  • Loading branch information
dimtsap committed Jan 16, 2023
1 parent 8917c83 commit 02a53b6
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/UQpy/reliability/taylor_series/FORM.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def run(self, seed_x: Union[list, np.ndarray] = None,
g_record.append(0.0)
dg_u_record = np.zeros([self.n_iterations + 1, self.dimension])

while not converged:
while not converged and k < self.n_iterations:
self.logger.info("Number of iteration: %i", k)
# FORM always starts from the standard normal space
if k == 0:
Expand Down Expand Up @@ -303,6 +303,7 @@ def run(self, seed_x: Union[list, np.ndarray] = None,
else:
k = k + 1


elif (self.tol1 is None) and (self.tol2 is not None) and (self.tol3 is not None):
error2 = np.linalg.norm(beta[k + 1] - beta[k])
error3 = np.linalg.norm(dg_u_record[k + 1, :] - dg_u_record[k, :])
Expand All @@ -312,10 +313,8 @@ def run(self, seed_x: Union[list, np.ndarray] = None,
else:
k = k + 1

self.logger.error("Error: %s", error_record[-1])
self.logger.info("Error: %s", error_record[-1])

if converged is True or k > self.n_iterations:
break

if k > self.n_iterations:
self.logger.info("UQpy: Maximum number of iterations {0} was reached before convergence."
Expand Down

0 comments on commit 02a53b6

Please sign in to comment.