Drivers

EasyDrivers

EasyScipyOptimizeDriver

class topfarm.easy_drivers.EasyScipyOptimizeDriver(optimizer='SLSQP', maxiter=200, tol=1e-08, disp=True, auto_scale=False, **kwargs)[source]
__init__(optimizer='SLSQP', maxiter=200, tol=1e-08, disp=True, auto_scale=False, **kwargs)[source]
Parameters:
  • optimizer ({'COBYLA', 'SLSQP'}) – Gradients are only supported by SLSQP

  • maxiter (int) – Maximum number of iterations.

  • tol (float) – Tolerance for termination. For detailed control, use solver-specific options.

  • disp (bool) – Set to False to prevent printing of Scipy convergence messages

  • auto_scale (bool) – Set to true to set ref0 and ref1 to boundaries of the desig variables for the drivers which support it (SLSQP, ).

EasyPyOptSparseIPOPT

class topfarm.easy_drivers.EasyPyOptSparseIPOPT(max_iter=200)[source]
__init__(max_iter=200)[source]

Initialize pyopt.

EasySimpleGADriver

class topfarm.easy_drivers.EasySimpleGADriver(max_gen=100, pop_size=25, Pm=None, Pc=0.5, elitism=True, bits={}, debug_print=[], run_parallel=False, random_state=None)[source]
__init__(max_gen=100, pop_size=25, Pm=None, Pc=0.5, elitism=True, bits={}, debug_print=[], run_parallel=False, random_state=None)[source]

SimpleGA driver with optional arguments

Parameters:
  • max_gen (int) – Number of generations before termination.

  • pop_size (int) – Number of points in the GA.

  • pm (float) – Probability of mutation.

  • pc (float) – Probability of cross over.

  • elitism (bool, optional) – If True, replace worst performing point with best from previous generation each iteration.

  • bits (dict, optional) – Number of bits of resolution. Default is an empty dict, where every unspecified variable is assumed to be integer, and the number of bits is calculated automatically. If you have a continuous var, you should set a bits value as a key in this dictionary. Ex: {‘x’:16,’y’:16}

  • debug_print (list, optional) – List of what type of Driver variables to print at each iteration. Valid items in list are ‘desvars’,’ln_cons’,’nl_cons’,’objs’

  • run_parallel (bool) – Set to True to execute the points in a generation in parallel.

EasyRandomSearchDriver

class topfarm.easy_drivers.EasyRandomSearchDriver(randomize_func, max_iter=100, max_time=600, disp=False, run_parallel=False)[source]
__init__(randomize_func, max_iter=100, max_time=600, disp=False, run_parallel=False)[source]

Easy initialization of RandomSearchDriver

Parameters:
  • randomize_func (f(desvar_dict)) – Function to randomize desired variables of desvar_dict

  • max_iter (int, optional) – Maximum iterations

  • max_time (int, optional) – Maximum time in seconds

  • disp (bool)

EasySGDDriver

class topfarm.easy_drivers.EasySGDDriver(maxiter=100, max_time=600, disp=False, run_parallel=False, learning_rate=10, upper=0.1, lower=0, beta1=0.1, beta2=0.2, gamma_min_factor=0.01, speedupSGD=False, sgd_thresh=0.1)[source]
__init__(maxiter=100, max_time=600, disp=False, run_parallel=False, learning_rate=10, upper=0.1, lower=0, beta1=0.1, beta2=0.2, gamma_min_factor=0.01, speedupSGD=False, sgd_thresh=0.1)[source]

Easy initialization of Stochastic Gradient Descent (SGD) Driver

Parameters:
  • maxiter (int, optional) – Maximum iterations

  • max_time (int) – Maximum evaluation time in seconds

  • learning_rate (int, optional) – determines the step size

  • gamma_min_factor (int, optional) – initial value for constraint aggregation multiplier