sfepy.solvers.optimize module

class sfepy.solvers.optimize.FMinSteepestDescent(conf, **kwargs)[source]
name = 'opt.fmin_sd'
static process_conf(conf, kwargs)[source]

Missing items are set to default values.

Example configuration, all items:

solver_0 = {
    'name'      : 'fmin_sd',
    'kind'      : 'opt.fmin_sd',

    'i_max'      : 10,
    'eps_rd'     : 1e-5, # Relative delta of objective function
    'eps_of'     : 1e-4,
    'eps_ofg'    : 1e-8,
    'norm'      : nm.Inf,
    'ls'        : True, # Linesearch.
    'ls_method'  : 'backtracking', # 'backtracking' or 'full'
    'ls0'       : 0.25,
    'ls_red'     : 0.5,
    'ls_red_warp' : 0.1,
    'ls_on'      : 0.99999,
    'ls_min'     : 1e-5,
    'check'     : 0,
    'delta'     : 1e-6,
    'output'    : None, # 'itc'
    'log'       : {'text' : 'output/log.txt',
                   'plot' : 'output/log.png'},
    'yscales'   : ['linear', 'log', 'log', 'linear'],
}
class sfepy.solvers.optimize.ScipyFMinSolver(conf, **kwargs)[source]

Interface to SciPy optimization solvers scipy.optimize.fmin_*.

name = 'nls.scipy_fmin_like'
static process_conf(conf, kwargs)[source]

Missing items are left to SciPy defaults. Unused options are ignored.

Besides ‘i_max’, use option names according to scipy.optimize function arguments. The ‘i_max’ translates either to ‘maxiter’ or ‘maxfun’ as available.

Example configuration:

solver_1 = {
    'name' : 'fmin',
    'kind' : 'nls.scipy_fmin_like',

    'method'  : 'bfgs',
    'i_max'   : 10,
    'verbose' : True,

    'gtol' : 1e-7
}
set_method(conf)[source]
sfepy.solvers.optimize.check_gradient(xit, aofg, fn_of, delta, check)[source]
sfepy.solvers.optimize.conv_test(conf, it, of, of0, ofg_norm=None)[source]
Returns:

flag : int

  • -1 ... continue
  • 0 ... small OF -> stop
  • 1 ... i_max reached -> stop
  • 2 ... small OFG -> stop
  • 3 ... small relative decrase of OF
sfepy.solvers.optimize.wrap_function(function, args)[source]