def main(): # print(random.random()) # time.sleep(1.) ''' INITIAL STATE ''' LookForTarget = True # slow_base_filename = './data/1_lone_wolf.npy' # slow_base_filename = './data/1_1_short_ellipse.npy' # slow_base_filename = './data/1_1_long_ellipse.npy' # slow_base_filename = './data/1_1_cercle.npy' slow_base_filename = './data/2_cercle.npy' # slow_base_filename = './data/3_cercle.npy' # slow_base_filename = './data/3_huit.npy' # slow_base_filename = './data/3_heart.npy' # slow_base_filename = './data/4_trefoil.npy' # slow_base_filename = './data/1x4_trefoil.npy' # fast_base_filename_list = ['./data/1_lone_wolf.npy' ] fast_base_filename_list = ['./data/2_cercle.npy'] # fast_base_filename_list = ['./data/3_cercle.npy' ] # fast_base_filename_list = ['./data/3_huit.npy' ] # fast_base_filename_list = ['./data/3_heart.npy' ] # fast_base_filename_list = ['./data/3_dbl_heart.npy' ] # fast_base_filename_list = ['./data/4_13_2_2_cercle.npy'] # fast_base_filename_list = ['./data/4_trefoil.npy'] # fast_base_filename_list = ['./data/2_cercle.npy','./data/3_huit.npy' ] # fast_base_filename_list = ['./data/1_lone_wolf.npy','./data/2_cercle.npy' ] # fast_base_filename_list = ['./data/1_lone_wolf.npy','./data/1_lone_wolf.npy' ] # fast_base_filename_list = ['./data/1_lone_wolf.npy','./data/1_lone_wolf.npy' ,'./data/1_lone_wolf.npy','./data/1_lone_wolf.npy' ] # fast_base_filename_list = ['./data/1_lone_wolf.npy','./data/2_cercle.npy' ,'./data/1_lone_wolf.npy','./data/2_cercle.npy' ] # fast_base_filename_list = ['./data/1_lone_wolf.npy','./data/1_lone_wolf.npy' ,'./data/1_lone_wolf.npy','./data/3_huit.npy' ] nfl = len(fast_base_filename_list) mass_mul = [1] nTf = [13] nbs = [2] nbf = [2] epsmul = 0. # mass_mul = [1,1,1,1] # mass_mul = [1.,1.+epsmul,1.+2*epsmul,1.+3*epsmul] # nTf = [1,1,1,1] # nbs = [1,1,1,1] # nbf = [1,1,1,1] # mass_mul = [1,1] # mass_mul = [3,2] # nTf = [37,37] # nbs = [1,1] # nbf = [2,3] mul_loops_ini = True # mul_loops_ini = False # mul_loops_ini = (np.random.random() > 1./2.) mul_loops = [mul_loops_ini for _ in range(nfl)] # Remove_Choreo_Sym = mul_loops Remove_Choreo_Sym = [True, False] # Remove_Choreo_Sym = [False,False] # Rotate_fast_with_slow = True Rotate_fast_with_slow = False # Rotate_fast_with_slow = (np.random.random() > 1./2.) # Optimize_Init = True Optimize_Init = False Randomize_Fast_Init = True # Randomize_Fast_Init = False all_coeffs_slow_load = np.load(slow_base_filename) all_coeffs_fast_load_list = [] nbpl = [] mass = [] for i in range(nfl): fast_base_filename = fast_base_filename_list[i] all_coeffs_fast_load = np.load(fast_base_filename) if Remove_Choreo_Sym[i]: all_coeffs_fast_load_list_temp = [] for ib in range(nbf[i]): tshift = (ib * 1.0) / nbf[i] all_coeffs_fast_load_list_temp.append( choreo.Transform_Coeffs(np.identity(choreo.ndim), 1, tshift, 1, all_coeffs_fast_load)) nbpl.append(nbs[i]) mass.extend([mass_mul[i] for j in range(nbs[i])]) all_coeffs_fast_load_list.append( np.concatenate(all_coeffs_fast_load_list_temp, axis=0)) else: all_coeffs_fast_load_list.append(all_coeffs_fast_load) nbpl.append(nbs[i] * nbf[i]) mass.extend([mass_mul[i] for j in range(nbs[i] * nbf[i])]) mass = np.array(mass, dtype=np.float64) coeff_ampl_o = 1e-16 k_infl = 1 k_max = 200 coeff_ampl_min = 1e-16 ''' SYMMETRIES ''' Sym_list = [] the_lcm = m.lcm(*nbpl) SymName = None Sym_list, nbody = choreo.Make2DChoreoSymManyLoops(nbpl=nbpl, SymName=SymName) # mass = np.ones((nbody))*mass_mul # ibody = 0 # rot_angle = 0. # s = -1 # st = -1 # Sym_list.append(ChoreoSym( # LoopTarget=ibody, # LoopSource=ibody, # SpaceRot = np.array([[s*np.cos(rot_angle),-s*np.sin(rot_angle)],[np.sin(rot_angle),np.cos(rot_angle)]],dtype=np.float64), # TimeRev=st, # TimeShift=fractions.Fraction(numerator=0,denominator=1) # )) # MomConsImposed = True MomConsImposed = False ''' I/O ''' file_basename = '' store_folder = os.path.join(__PROJECT_ROOT__, 'Target_res/') store_folder = store_folder + str(nbody) if not (os.path.isdir(store_folder)): os.makedirs(store_folder) save_init = False # save_init = True Save_img = True # Save_img = False # Save_thumb = True Save_thumb = False # img_size = (12,12) # Image size in inches img_size = (8, 8) # Image size in inches thumb_size = (2, 2) # Image size in inches nint_plot_img = 10000 color = "body" # color = "loop" # color = "velocity" # color = "all" Save_anim = True # Save_anim = False vid_size = (8, 8) # Image size in inches nint_plot_anim = 2 * 2 * 2 * 3 * 3 * 5 # nperiod_anim = 1./nbody dnint = 30 nint_plot_img = nint_plot_anim * dnint try: the_lcm except NameError: period_div = 1. else: period_div = the_lcm nperiod_anim = 1. / period_div Plot_trace_anim = True # Plot_trace_anim = False # Save_Newton_Error = True Save_Newton_Error = False ''' SOLVER & SOLVER LOOP ''' Use_exact_Jacobian = True # Use_exact_Jacobian = False Look_for_duplicates = True # Look_for_duplicates = False Check_Escape = True # Check_Escape = False n_reconverge_it_max = 4 # n_reconverge_it_max = 1 # ncoeff_init = 300 # ncoeff_init = 600 ncoeff_init = 900 # ncoeff_init = 1800 disp_scipy_opt = False # disp_scipy_opt = True max_norm_on_entry = 1e20 Newt_err_norm_max = 1e-10 # Newt_err_norm_max_save = Newt_err_norm_max*1000 Newt_err_norm_max_save = 1e-1 duplicate_eps = 1e-8 krylov_method = 'lgmres' # krylov_method = 'gmres' # krylov_method = 'bicgstab' # krylov_method = 'cgs' # krylov_method = 'minres' # line_search = 'armijo' line_search = 'wolfe' gradtol_list = [1e-3, 1e-5, 1e-7, 1e-9, 1e-11, 1e-13, 1e-15] maxiter_list = [1000, 1000, 1000, 500, 500, 300, 100] inner_maxiter_list = [30, 50, 60, 70, 80, 100, 100] outer_k_list = [5, 5, 5, 5, 7, 7, 7] store_outer_Av_list = [False, False, False, False, True, True, True] n_optim_param = len(gradtol_list) gradtol_max = 100 * gradtol_list[n_optim_param - 1] # foundsol_tol = 1000*gradtol_list[0] foundsol_tol = 1e10 n_grad_change = 1. # n_grad_change = 1.5 freq_erase_dict = 1000 hash_dict = {} # n_opt_max = 1 # n_opt_max = 5 n_opt_max = 1e10 all_kwargs = choreo.Pick_Named_Args_From_Dict(choreo.Find_Choreo, dict(globals(), **locals())) choreo.Find_Choreo(**all_kwargs)
def main(): input_folder = os.path.join(__PROJECT_ROOT__,'Sniff_all_sym/3/') # input_folder = os.path.join(__PROJECT_ROOT__,'Sniff_all_sym/copy/') # input_folder = os.path.join(__PROJECT_ROOT__,'Sniff_all_sym/keep/13') # ''' Include all files in tree ''' # input_names_list = [] # for root, dirnames, filenames in os.walk(input_folder): # # for filename in filenames: # file_path = os.path.join(root, filename) # file_root, file_ext = os.path.splitext(os.path.basename(file_path)) # # if (file_ext == '.txt' ): # # file_path = os.path.join(root, file_root) # the_name = file_path[len(input_folder):] # input_names_list.append(the_name) ''' Include all files in folder ''' input_names_list = [] for file_path in os.listdir(input_folder): file_path = os.path.join(input_folder, file_path) file_root, file_ext = os.path.splitext(os.path.basename(file_path)) if (file_ext == '.txt' ): input_names_list.append(file_root) # input_names_list = ['00006'] store_folder = os.path.join(__PROJECT_ROOT__,'Sniff_all_sym/mod') # store_folder = input_folder Save_All_Coeffs = True # Save_All_Coeffs = False Save_All_Coeffs_No_Sym = True # Save_All_Coeffs_No_Sym = False # Save_Newton_Error = True Save_Newton_Error = False Save_img = True # Save_img = False # # Save_thumb = True Save_thumb = False # img_size = (12,12) # Image size in inches img_size = (8,8) # Image size in inches thumb_size = (2,2) # Image size in inches color = "body" # color = "loop" # color = "velocity" # color = "all" Save_anim = True # Save_anim = False Save_ODE_anim = True # Save_ODE_anim = False # ODE_method = 'RK23' # ODE_method = 'RK45' ODE_method = 'DOP853' # ODE_method = 'Radau' # ODE_method = 'BDF' atol_ode = 1e-10 rtol_ode = 1e-12 vid_size = (8,8) # Image size in inches # nint_plot_anim = 2*2*2*3*3 nint_plot_anim = 2*2*2*3*3*5 dnint = 30 nint_plot_img = nint_plot_anim * dnint min_n_steps_ode = 1*nint_plot_anim try: the_lcm except NameError: period_div = 1. else: period_div = the_lcm # nperiod_anim = 1. # nperiod_anim = 1./period_div Plot_trace_anim = True # Plot_trace_anim = False GradActionThresh = 1e-8 for the_name in input_names_list: print('') print(the_name) input_filename = os.path.join(input_folder,the_name) input_filename = input_filename + '.npy' bare_name = the_name.split('/')[-1] all_coeffs = np.load(input_filename) theta = 2*np.pi * 0.5 SpaceRevscal = 1. SpaceRot = np.array( [[SpaceRevscal*np.cos(theta) , SpaceRevscal*np.sin(theta)] , [-np.sin(theta),np.cos(theta)]]) TimeRev = 1. TimeShiftNum = 0 TimeShiftDen = 2 all_coeffs = choreo.Transform_Coeffs(SpaceRot, TimeRev, TimeShiftNum, TimeShiftDen, all_coeffs) ncoeff_init = all_coeffs.shape[2] the_i = -1 the_i_max = 20 Gradaction_OK = False while (not(Gradaction_OK) and (the_i < the_i_max)): the_i += 1 # p = 1 p_list = range(the_i_max) # p_list = [3] p = p_list[the_i%len(p_list)] nc = 3 mm = 1 # mm_list = [1] # mm = mm_list[the_i%len(mm_list)] nbpl=[nc] SymType = { 'name' : 'D', 'n' : nc, 'm' : mm, 'l' : 0, 'k' : 1, 'p' : p, 'q' : nc, } Sym_list = choreo.Make2DChoreoSym(SymType,range(nc)) nbody = nc mass = np.ones((nbody),dtype=np.float64) # MomConsImposed = True MomConsImposed = False n_reconverge_it_max = 0 n_grad_change = 1. callfun = choreo.setup_changevar(nbody,ncoeff_init,mass,n_reconverge_it_max,Sym_list=Sym_list,MomCons=MomConsImposed,n_grad_change=n_grad_change,CrashOnIdentity=False) x = choreo.Package_all_coeffs(all_coeffs,callfun) Action,Gradaction = choreo.Compute_action(x,callfun) Gradaction_OK = (np.linalg.norm(Gradaction) < GradActionThresh) if not(Gradaction_OK): raise(ValueError('Correct Symmetries not found')) filename_output = os.path.join(store_folder,bare_name) print('Saving solution as '+filename_output+'.*') choreo.Write_Descriptor(x,callfun,filename_output+'.txt') if Save_img : choreo.plot_all_2D(x,nint_plot_img,callfun,filename_output+'.png',fig_size=img_size,color=color) if Save_thumb : choreo.plot_all_2D(x,nint_plot_img,callfun,filename_output+'_thumb.png',fig_size=thumb_size,color=color) if Save_anim : choreo.plot_all_2D_anim(x,nint_plot_anim,callfun,filename_output+'.mp4',nperiod_anim,Plot_trace=Plot_trace_anim,fig_size=vid_size,dnint=dnint) if Save_Newton_Error : choreo.plot_Newton_Error(x,callfun,filename_output+'_newton.png') if Save_All_Coeffs: np.save(filename_output+'.npy',all_coeffs) if Save_All_Coeffs_No_Sym: all_coeffs_nosym = choreo.RemoveSym(x,callfun) np.save(filename_output+'_nosym.npy',all_coeffs_nosym) if Save_ODE_anim: y0 = choreo.Compute_init_pos_vel(x,callfun).reshape(-1) t_eval = np.array([i/nint_plot_img for i in range(nint_plot_img)]) ode_res = scipy.integrate.solve_ivp(fun=choreo.Compute_ODE_RHS, t_span=(0.,1.), y0=y0, method=ODE_method, t_eval=t_eval, dense_output=False, events=None, vectorized=False, args=callfun,max_step=1./min_n_steps_ode,atol=atol_ode,rtol=rtol_ode) all_pos_vel = ode_res['y'].reshape(2,nbody,choreo.ndim,nint_plot_img) all_pos_ode = all_pos_vel[0,:,:,:] choreo.plot_all_2D_anim(x,nint_plot_anim,callfun,filename_output+'_ode.mp4',nperiod_anim,Plot_trace=Plot_trace_anim,fig_size=vid_size,dnint=dnint,all_pos_trace=all_pos_ode,all_pos_points=all_pos_ode) y0 = choreo.Compute_init_pos_vel(x,callfun).reshape(-1) t_eval = np.array([0.,1.]) ode_res = scipy.integrate.solve_ivp(fun=choreo.Compute_ODE_RHS, t_span=(0.,1.), y0=y0, method=ODE_method, t_eval=t_eval, dense_output=False, events=None, vectorized=False, args=callfun,max_step=1./min_n_steps_ode,atol=atol_ode,rtol=rtol_ode) all_pos_vel = ode_res['y'].reshape(2,nbody,choreo.ndim,2) all_pos_ode = all_pos_vel[0,:,:,:] print(np.linalg.norm(all_pos_ode[:,:,0]-all_pos_ode[:,:,1]))
def main(): input_folder = os.path.join(__PROJECT_ROOT__,'Sniff_all_sym/mod') # input_folder = os.path.join(__PROJECT_ROOT__,'Sniff_all_sym/10/') # input_folder = os.path.join(__PROJECT_ROOT__,'Sniff_all_sym/copy/') # input_folder = os.path.join(__PROJECT_ROOT__,'Sniff_all_sym/keep/13') # ''' Include all files in tree ''' # input_names_list = [] # for root, dirnames, filenames in os.walk(input_folder): # # for filename in filenames: # file_path = os.path.join(root, filename) # file_root, file_ext = os.path.splitext(os.path.basename(file_path)) # # if (file_ext == '.txt' ): # # file_path = os.path.join(root, file_root) # the_name = file_path[len(input_folder):] # input_names_list.append(the_name) ''' Include all files in folder ''' input_names_list = [] for file_path in os.listdir(input_folder): file_path = os.path.join(input_folder, file_path) file_root, file_ext = os.path.splitext(os.path.basename(file_path)) if (file_ext == '.txt' ): # input_names_list.append(file_root) input_names_list.append(file_root+'_nosym') # input_names_list = ['00006'] # input_names_list = ['00006_nosym'] GradActionThresh = 1e-8 for the_name in input_names_list: print('') print(the_name) input_filename = os.path.join(input_folder,the_name) input_filename = input_filename + '.npy' bare_name = the_name.split('/')[-1] all_coeffs = np.load(input_filename) theta = 2*np.pi * 0.5 SpaceRevscal = 1. SpaceRot = np.array( [[SpaceRevscal*np.cos(theta) , SpaceRevscal*np.sin(theta)] , [-np.sin(theta),np.cos(theta)]]) TimeRev = 1. TimeShiftNum = 0 TimeShiftDen = 2 all_coeffs = choreo.Transform_Coeffs(SpaceRot, TimeRev, TimeShiftNum, TimeShiftDen, all_coeffs) ncoeff_init = all_coeffs.shape[2] the_i = -1 the_i_max = 0 Gradaction_OK = False while (not(Gradaction_OK) and (the_i < the_i_max)): the_i += 1 p = 1 # p_list = range(the_i_max) # p_list = [3] # p = p_list[the_i%len(p_list)] nc = 3 mm = 1 # mm_list = [1] # mm = mm_list[the_i%len(mm_list)] # nbpl=[nc] nbpl=[1 for i in range(nc)] # # SymType = { # 'name' : 'D', # 'n' : nc, # 'm' : mm, # 'l' : 0, # 'k' : 1, # 'p' : p, # 'q' : nc, # } # Sym_list = choreo.Make2DChoreoSym(SymType,range(nc)) # nbody = nc Sym_list,nbody = choreo.Make2DChoreoSymManyLoops(nbpl=nbpl,SymName='C') mass = np.ones((nbody),dtype=np.float64) # MomConsImposed = True MomConsImposed = False n_reconverge_it_max = 0 n_grad_change = 1. callfun = choreo.setup_changevar(nbody,ncoeff_init,mass,n_reconverge_it_max,Sym_list=Sym_list,MomCons=MomConsImposed,n_grad_change=n_grad_change,CrashOnIdentity=False) x = choreo.Package_all_coeffs(all_coeffs,callfun) Action,Gradaction = choreo.Compute_action(x,callfun) Gradaction_OK = (np.linalg.norm(Gradaction) < GradActionThresh) if not(Gradaction_OK): raise(ValueError('Correct Symmetries not found')) n_eig = 10 HessMat = choreo.Compute_action_hess_LinOpt(x,callfun) w ,v = scipy.sparse.linalg.eigsh(HessMat,k=n_eig,which='SA') print(w)
def main(the_i=0): # if (the_i != 0): # # preprint_msg = str(the_i).zfill(2)+' : ' # # def print(*args, **kwargs): # """My custom print() function.""" # builtins.print(preprint_msg,end='') # return builtins.print(*args, **kwargs) # file_basename = '' np.random.seed(int(time.time() * 10000) % 5000) LookForTarget = True # slow_base_filename = './data/1_lone_wolf.npy' # slow_base_filename = './data/1_1_short_ellipse.npy' # slow_base_filename = './data/1_1_long_ellipse.npy' slow_base_filename = './data/1_1_cercle.npy' # slow_base_filename = './data/2_cercle.npy' # slow_base_filename = './data/3_cercle.npy' # slow_base_filename = './data/3_huit.npy' # slow_base_filename = './data/3_heart.npy' # slow_base_filename = './data/4_trefoil.npy' # slow_base_filename = './data/1x4_trefoil.npy' # fast_base_filename_list = ['./data/1_lone_wolf.npy' ] # fast_base_filename_list = ['./data/2_cercle.npy' ] # fast_base_filename_list = ['./data/3_cercle.npy' ] # fast_base_filename_list = ['./data/3_huit.npy' ] # fast_base_filename_list = ['./data/3_heart.npy' ] # fast_base_filename_list = ['./data/3_dbl_heart.npy' ] # fast_base_filename_list = ['./data/4_13_2_2_cercle.npy'] # fast_base_filename_list = ['./data/4_trefoil.npy'] # fast_base_filename_list = ['./data/2_cercle.npy','./data/2_cercle.npy' ] # fast_base_filename_list = ['./data/3_cercle.npy' ,'./data/3_cercle.npy' ] fast_base_filename_list = ['./data/2_cercle.npy', './data/3_huit.npy'] # fast_base_filename_list = ['./data/1_lone_wolf.npy','./data/1_lone_wolf.npy' ] # fast_base_filename_list = ['./data/1_lone_wolf.npy','./data/1_lone_wolf.npy' ,'./data/1_lone_wolf.npy','./data/1_lone_wolf.npy' ] # fast_base_filename_list = ['./data/1_lone_wolf.npy','./data/2_cercle.npy' ,'./data/1_lone_wolf.npy','./data/2_cercle.npy' ] # fast_base_filename_list = ['./data/1_lone_wolf.npy','./data/1_lone_wolf.npy' ,'./data/1_lone_wolf.npy','./data/3_huit.npy' ] nfl = len(fast_base_filename_list) mass_mul = [3, 2] nTf = [13, 13] nbs = [1, 1] nbf = [2, 3] epsmul = 0. # mass_mul = [1,1,1,1] # mass_mul = [1.,1.+epsmul,1.+2*epsmul,1.+3*epsmul] # nTf = [1,1,1,1] # nbs = [1,1,1,1] # nbf = [1,1,1,1] # mass_mul = [1,1] # mass_mul = [3,2] # nTf = [37,37] # nbs = [1,1] # nbf = [2,3] mul_loops_ini = True # mul_loops_ini = False # mul_loops_ini = (np.random.random() > 1./2.) mul_loops = [mul_loops_ini for _ in range(nfl)] Remove_Choreo_Sym = mul_loops # Remove_Choreo_Sym = [False,False] # Remove_Choreo_Sym = [False,False] Rotate_fast_with_slow = True # Rotate_fast_with_slow = False # Rotate_fast_with_slow = (np.random.random() > 1./2.) # Optimize_Init = True Optimize_Init = False # Optimize_Init = (np.random.random() > 1./2.) Randomize_Fast_Init = True # Randomize_Fast_Init = False all_coeffs_slow_load = np.load(slow_base_filename) all_coeffs_fast_load_list = [] nbpl = [] mass = [] for i in range(nfl): fast_base_filename = fast_base_filename_list[i] all_coeffs_fast_load = np.load(fast_base_filename) if Remove_Choreo_Sym[i]: all_coeffs_fast_load_list_temp = [] for ib in range(nbf[i]): tshift = (ib * 1.0) / nbf[i] all_coeffs_fast_load_list_temp.append( choreo.Transform_Coeffs(np.identity(2), 1, tshift, 1, all_coeffs_fast_load)) nbpl.append(nbs[i]) mass.extend([mass_mul[i] for j in range(nbs[i])]) all_coeffs_fast_load_list.append( np.concatenate(all_coeffs_fast_load_list_temp, axis=0)) else: all_coeffs_fast_load_list.append(all_coeffs_fast_load) nbpl.append(nbs[i] * nbf[i]) mass.extend([mass_mul[i] for j in range(nbs[i] * nbf[i])]) mass = np.array(mass, dtype=np.float64) Sym_list = [] the_lcm = m.lcm(*nbpl) SymName = None Sym_list, nbody = choreo.Make2DChoreoSymManyLoops(nbpl=nbpl, SymName=SymName) # mass = np.ones((nbody))*mass_mul # for ibody in range(6): # # for ibody in [0,2]: # # for ibody in [0]: # # l_rot = 11 # k_rot = 13 # rot_angle = 2* np.pi * l_rot / k_rot # s = 1 # st = 1 # # Sym_list.append(choreo.ChoreoSym( # LoopTarget=ibody, # LoopSource=ibody, # SpaceRot = np.array([[s*np.cos(rot_angle),-s*np.sin(rot_angle)],[np.sin(rot_angle),np.cos(rot_angle)]],dtype=np.float64), # TimeRev=st, # TimeShift=fractions.Fraction(numerator=1,denominator=k_rot) # )) # # MomConsImposed = True MomConsImposed = False store_folder = './Target_res/' store_folder = store_folder + str(nbody) if not (os.path.isdir(store_folder)): os.makedirs(store_folder) Use_exact_Jacobian = True # Use_exact_Jacobian = False Look_for_duplicates = True # Look_for_duplicates = False Check_Escape = True # Check_Escape = False # Penalize_Escape = True Penalize_Escape = False # # save_first_init = False save_first_init = True # save_all_inits = False # save_all_inits = True Save_img = True # Save_img = False Save_thumb = True # Save_thumb = False # img_size = (12,12) # Image size in inches img_size = (8, 8) # Image size in inches thumb_size = (2, 2) # Image size in inches nint_plot_img = 10000 color = "body" # color = "loop" # color = "velocity" # color = "all" Save_anim = True # Save_anim = False vid_size = (8, 8) # Image size in inches nint_plot_anim = 2 * 2 * 2 * 3 * 3 * 5 # nperiod_anim = 1./nbody dnint = 30 nint_plot_img = nint_plot_anim * dnint try: the_lcm except NameError: period_div = 1. else: period_div = the_lcm nperiod_anim = 1. / period_div Plot_trace_anim = True # Plot_trace_anim = False # Save_Newton_Error = True Save_Newton_Error = False n_reconverge_it_max = 3 # n_reconverge_it_max = 1 # ncoeff_init = 102 # ncoeff_init = 800 # ncoeff_init = 201 # ncoeff_init = 300 # ncoeff_init = 600 ncoeff_init = 900 # ncoeff_init = 1800 # ncoeff_init = 3600 # ncoeff_init = 1206 # ncoeff_init = 90 disp_scipy_opt = False # disp_scipy_opt = True max_norm_on_entry = 1e20 Newt_err_norm_max = 1e-10 # Newt_err_norm_max_save = Newt_err_norm_max*1000 Newt_err_norm_max_save = 1e-1 duplicate_eps = 1e-8 krylov_method = 'lgmres' # krylov_method = 'gmres' # krylov_method = 'bicgstab' # krylov_method = 'cgs' # krylov_method = 'minres' # line_search = 'armijo' line_search = 'wolfe' gradtol_list = [1e-3, 1e-5, 1e-7, 1e-9, 1e-11, 1e-13, 1e-15] inner_maxiter_list = [30, 50, 60, 70, 80, 100, 100] maxiter_list = [1000, 1000, 1000, 500, 500, 300, 100] outer_k_list = [5, 5, 5, 5, 7, 7, 7] store_outer_Av_list = [False, False, False, False, True, True, True] n_optim_param = len(gradtol_list) gradtol_max = 100 * gradtol_list[n_optim_param - 1] # foundsol_tol = 1000*gradtol_list[0] foundsol_tol = 1e10 escape_fac = 1e0 # escape_fac = 1e-1 # escape_fac = 1e-2 # escape_fac = 1e-3 # escape_fac = 1e-4 # escape_fac = 1e-5 # escape_fac = 0 escape_min_dist = 1 escape_pow = 2.0 # escape_pow = 2.5 # escape_pow = 1.5 # escape_pow = 0.5 n_grad_change = 1. # n_grad_change = 1.5 coeff_ampl_o = 1e-16 k_infl = 200 k_max = 800 coeff_ampl_min = 1e-16 freq_erase_dict = 1000 hash_dict = {} n_opt = 0 n_opt_max = 1 # n_opt_max = 5 # n_opt_max = 0 all_kwargs = choreo.Pick_Named_Args_From_Dict(choreo.Find_Choreo, dict(globals(), **locals())) choreo.Find_Choreo(**all_kwargs)