# print('THIS IS THE MU FOR EXC10')
mu_opt = [1.651891986460e+01, 1.692820877511e+01, 1.732387911116e+01, 1.746951227840e+01,
          1.812299797114e+01, 1.840759241105e+01, 1.693448657882e+01, 2.500000000000e-02,
          2.500000000000e-02, 2.500000000000e-02]
mu_opt_norm = np.linalg.norm(mu_opt)

sum_muerror_0 = []
sum_muerror_1 = []
sum_muerror_2 = []
sum_muerror_3 = []
sum_muerror_4 = []
sum_muerror_5 = []


for directory in directories:
    times_full_0 , _ , mu_error_0, FOC_0 = get_data(directory,method_tuple[0][0], mu_error_=True, FOC=True)
    total_time = times_full_0[-1]
    sum_muerror_0.append(mu_error_0[-1])
    sum_FOC_0.append(FOC_0[-1])
    sum_0.append(total_time)
    min_time_0 = min(min_time_0, total_time)
    max_time_0 = max(max_time_0, total_time)
    
    iterations = len(times_full_0)-1
    iters_0.append(iterations)
    min_iter_0 = min(min_iter_0, iterations)
    max_iter_0 = max(max_iter_0, iterations)
    
    times_full_1 , _ , mu_error_1, FOC_1 = get_data(directory,method_tuple[1][0], mu_error_=True, FOC=True)
    total_time = times_full_1[-1]
    sum_muerror_1.append(mu_error_1[-1])
Exemplo n.º 2
0
colorclass0 = (0.65, 0.00, 0.15)
colorclass1 = (0.84, 0.19, 0.15)
colorclass2 = (0.99, 0.68, 0.38)
colorclass3 = (0.96, 0.43, 0.26)
colorclass4 = 'black'
colorclass5 = (0.17, 0.25, 0.98)

# I want to have these methods in my plot:
method_tuple = [[1, 'FOM TR-Newton-CG'], [4, 'TR-RB Newton lag. '],
                [2, 'TR-RB Newton lag. optional '], [8, 'Keil et al. 2020'],
                [5, 'Keil et al. 2020 pr. New. '],
                [3, 'Alg. 1 Dir. Tay. Skip_enr. ']]

if mu_est is False and mu_error is False:
    times_full_0, J_error_0, FOC_0, _ = get_data(directory,
                                                 method_tuple[0][0],
                                                 FOC=True,
                                                 j_list=False)
    times_full_1, J_error_1, FOC_1, j_list_1 = get_data(directory,
                                                        method_tuple[1][0],
                                                        FOC=True)
    times_full_2, J_error_2, FOC_2, j_list_2 = get_data(directory,
                                                        method_tuple[2][0],
                                                        FOC=True)
    times_full_3, J_error_3, FOC_3, j_list_3 = get_data(directory,
                                                        method_tuple[3][0],
                                                        FOC=True)
    times_full_4, J_error_4, FOC_4, j_list_4 = get_data(directory,
                                                        method_tuple[4][0],
                                                        FOC=True)
    times_full_5, J_error_5, FOC_5, j_list_5 = get_data(directory,
                                                        method_tuple[5][0],
colorclass1 =(0.84, 0.19, 0.15)
colorclass2 =(0.96, 0.43, 0.26)
colorclass3 =(0.99, 0.68, 0.38)
colorclass4 = 'black'
colorclass5 =(0.67, 0.85, 0.91)

# I want to have these methods in my plot: 
method_tuple = [
                  [2 , '5. FOM proj. BFGS'],
                  [25,'1(a) standard lag.'],
                  [54,'1(b) standard uni.'],
                  [26,'Qian et al. 2017'],
                  ]

if mu_est is False and mu_error is False:
    times_full_0 , J_error_0, FOC_0 = get_data(directory,method_tuple[0][0], FOC=True)
    times_full_1 , J_error_1, FOC_1 = get_data(directory,method_tuple[1][0], FOC=True)
    times_full_2 , J_error_2, FOC_2 = get_data(directory,method_tuple[2][0], FOC=True)
    times_full_3 , J_error_3, FOC_3 = get_data(directory,method_tuple[3][0], FOC=True)
elif mu_est is False and mu_error is True:
    times_full_0 , J_error_0 , mu_error_0 , FOC_0 = get_data(directory,method_tuple[0][0] , mu_error_=mu_error, FOC=True)
    times_full_1 , J_error_1 , mu_error_1 , FOC_1 = get_data(directory,method_tuple[1][0] , mu_error_=mu_error, FOC=True)
    times_full_2 , J_error_2 , mu_error_2 , FOC_2 = get_data(directory,method_tuple[2][0] , mu_error_=mu_error, FOC=True)
    times_full_3 , J_error_3 , mu_error_3 , FOC_3 = get_data(directory,method_tuple[3][0] , mu_error_=mu_error, FOC=True)
elif mu_est is True:
    times_full_0 , J_error_0 , mu_error_0 , times_mu_0 , mu_est_0, FOC_0 = get_data(directory,method_tuple[0][0] , mu_est, mu_est, FOC=True)
    times_full_1 , J_error_1 , mu_error_1 , times_mu_1 , mu_est_1, FOC_1 = get_data(directory,method_tuple[1][0] , mu_est, mu_est, FOC=True)
    times_full_2 , J_error_2 , mu_error_2 , times_mu_2 , mu_est_2, FOC_2 = get_data(directory,method_tuple[2][0] , mu_est, mu_est, FOC=True)
    times_full_3 , J_error_3 , mu_error_3 , times_mu_3 , mu_est_3, FOC_3 = get_data(directory,method_tuple[3][0] , mu_est, mu_est, FOC=True)
    #fix mu_est_2
    times_mu_0 = [ti + times_full_0[0] for ti in times_mu_0]