## apply subset-simulation

# initialization of lists
p_F_SS_list  = []
theta_list   = []
g_list       = []


print('\n> START Sampling')
start_time = timer.time()

for sim in range(0, n_simulations):
    # perform SubSim
    p_F_SS, theta, g = sus.subsetsim(p0, N, LSF, sampler)

    # save values in lists
    p_F_SS_list.append(p_F_SS)
    theta_list.append(theta)
    g_list.append(g)

    uutil.print_simulation_progress(sim, n_simulations, start_time)


# print("\n> Time needed for Sampling =", round(timer.time() - start_time, 2), "s")

# computing cov
print('\n> START Computing C.O.V')
startTime = timer.time()
        rho_k = np.sqrt(1 - sigma_p**2)
        sampler = cs.CondSampling(sample_marg_PDF_list, rho_k, 0)
    elif sampling_method == 'acs':
        sampler = acs.AdaptiveCondSampling(sample_marg_PDF_list, 0.1)
    
    ## apply subset-simulation

    # initialization
    pf_list    = []
    theta_list = []
    g_list     = []

    start_time = timer.time()
    for sim in range(0, n_simulations):
        pf_hat, theta_temp, g_temp = \
            sus.subsetsim(p0, N, LSF, sampler)

        # save simulation in list
        pf_list.append(pf_hat)
        g_list.append(g_temp)
        theta_list.append(theta_temp)

        if sampling_method == 'cs':
            # transform samples back from u to x-space
            for j in range(0, len(theta)):
                theta[j] = transform_U2X(theta[j])
        
        uutil.print_simulation_progress(sim, n_simulations, start_time)

    pf_sim_array = np.asarray(pf_list).reshape(-1)
    pf_mean      = np.mean(pf_sim_array)
Example #3
0
    sampler = cs.CondSampling(sample_marg_PDF_list, 0.8)
elif sampling_method == 'acs':
    sampler = acs.AdaptiveCondSampling(sample_marg_PDF_list, 0.1)

## apply subset-simulation

# initialization of lists
p_F_SS_list = []
theta_list = []
g_list = []

print('\n> START Sampling')
start_time = timer.time()
for sim in range(0, n_simulations):
    # perform SubSim
    p_F_SS, theta, g = sus.subsetsim(p0, n_samples_per_level, lsf, sampler)

    # save values in lists
    p_F_SS_list.append(p_F_SS)
    theta_list.append(theta)
    g_list.append(g)

    uutil.print_simulation_progress(sim, n_simulations, start_time)

print("\n> Time needed for Sampling =", round(timer.time() - start_time, 2),
      "s")

# computing cov
print('\n> START Computing C.O.V')
startTime = timer.time()