SURGroup / UQpy

UQpy (Uncertainty Quantification with python) is a general purpose Python toolbox for modeling uncertainty in physical and mathematical systems.
MIT License
271 stars 79 forks source link

FORM does not respect n_iter option value #58

Closed mcfarljm closed 3 years ago

mcfarljm commented 3 years ago

The FORM.run iteration loop does not actually respect the value of n_iter for breaking out of the loop. This can result in the actual iterations exceeding the value of n_iter, which subsequently produces an IndexError because arrays have been dimensioned by n_iter. The IndexError comes from line 950:

    dg_u_record[k + 1, :] = dg_u
IndexError: index 2 is out of bounds for axis 0 with size 2

The array is first dimenioned here: https://github.com/SURGroup/UQpy/blob/80884c6578dab6d70a9e83a3e61bf47bdb2e9a99/src/UQpy/Reliability.py#L917

But n_iter is not ever accessed until the check that is done after the iteration loop has been exited: https://github.com/SURGroup/UQpy/blob/80884c6578dab6d70a9e83a3e61bf47bdb2e9a99/src/UQpy/Reliability.py#L1045

Should be a simple fix to just add another elif check that sets conv_flag to True based on n_iter.

mds2120 commented 3 years ago

Yes, we will correct this. Thank you.

mds2120 commented 3 years ago

This issue has been resolved.