• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python solvers.make_get_conf函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sfepy.solvers.solvers.make_get_conf函数的典型用法代码示例。如果您正苦于以下问题:Python make_get_conf函数的具体用法?Python make_get_conf怎么用?Python make_get_conf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了make_get_conf函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: process_conf

    def process_conf(conf, kwargs):
        """
        Missing items are set to default values.

        Example configuration, all items::

            solver_1 = {
                'name' : 'ls',
                'kind' : 'ls.petsc_parallel',

                'log_dir' : '.', # Store logs here.
                'n_proc' : 5, # Number of processes to run.

                'method' : 'cg', # ksp_type
                'precond' : 'bjacobi', # pc_type
                'sub_precond' : 'icc', # sub_pc_type
                'eps_a' : 1e-12, # abstol
                'eps_r' : 1e-12, # rtol
                'eps_d' : 1e5, # divtol
                'i_max' : 1000, # maxits
            }
        """
        get = make_get_conf(conf, kwargs)
        common = PETScKrylovSolver.process_conf(conf, kwargs)

        return Struct(log_dir=get('log_dir', '.'),
                      n_proc=get('n_proc', 1),
                      sub_precond=get('sub_precond', 'icc')) + common
开发者ID:LeiDai,项目名称:sfepy,代码行数:28,代码来源:ls.py


示例2: process_conf

    def process_conf(conf, kwargs):
        """
        Missing items are set to default values.

        Example configuration, all items::

            solver_1100 = {
                'name' : 'dls1100',
                'kind' : 'ls.scipy_direct',

                'method' : 'superlu',
                'presolve' : False,
                'warn' : True,
            }
        """
        get = make_get_conf(conf, kwargs)
        common = LinearSolver.process_conf(conf)

        return (
            Struct(
                method=get("method", "auto"),
                presolve=get("presolve", False),
                warn=get("warn", True),
                i_max=None,
                eps_a=None,
                eps_r=None,
            )
            + common
        )
开发者ID:ZJLi2013,项目名称:sfepy,代码行数:29,代码来源:ls.py


示例3: process_conf

    def process_conf(conf, kwargs):
        """
        Missing items are set to default values.

        Example configuration, all items::

            solver_2 = {
                'name' : 'eigen1',
                'kind' : 'eig.pysparse',

                'i_max' : 150,
                'eps_a' : 1e-5,
                'tau' : -10.0,
                'method' : 'qmrs',
                'verbosity' : 0,
                'strategy' : 1,
            }
        """
        get = make_get_conf(conf, kwargs)
        common = EigenvalueSolver.process_conf(conf)

        return Struct(i_max=get('i_max', 100),
                      eps_a=get('eps_a', 1e-5),
                      tau=get('tau', 0.0),
                      method=get('method', 'qmrs'),
                      verbosity=get('verbosity', 0),
                      strategy=get('strategy', 1)) + common
开发者ID:renatocoutinho,项目名称:sfepy,代码行数:27,代码来源:eigen.py


示例4: process_conf

    def process_conf(conf, kwargs):
        """
        Missing items are left to scipy defaults. Unused options are ignored.

        Example configuration, all items::

            solver_1 = {
                'name' : 'broyden',
                'kind' : 'nls.scipy_broyden_like',

                'method'  : 'broyden3',
                'i_max'   : 10,
                'alpha'   : 0.9,
                'M'       : 5,
                'w0'      : 0.1,
                'verbose' : True,
            }
        """
        get = make_get_conf(conf, kwargs)
        common = NonlinearSolver.process_conf(conf)

        return Struct(method=get('method', 'broyden3'),
                      i_max=get('i_max', 10),
                      alpha=get('alpha', 0.9),
                      M=get('M', 5),
                      w0=get('w0', 0.1),
                      verbose=get('verbose', False)) + common
开发者ID:mikegraham,项目名称:sfepy,代码行数:27,代码来源:nls.py


示例5: process_conf

    def process_conf(conf, kwargs):
        """
        Missing items are set to default values.

        Example configuration, all items::

            solver_1 = {
                'name' : 'oseen',
                'kind' : 'nls.oseen',

                'needs_problem_instance' : True,
                'stabil_mat' : 'stabil',

                'adimensionalize' : False,
                'check_navier_stokes_rezidual' : False,

                'i_max'      : 10,
                'eps_a'      : 1e-8,
                'eps_r'      : 1.0,
                'macheps'    : 1e-16,
                'lin_red'    : 1e-2, # Linear system error < (eps_a * lin_red).
                'log'        : {'text' : 'oseen_log.txt',
                                'plot' : 'oseen_log.png'},
            }
        """
        get = make_get_conf(conf, kwargs)
        common = NonlinearSolver.process_conf(conf)

        # Compulsory.
        needs_problem_instance = get('needs_problem_instance', True)
        if not needs_problem_instance:
            msg = 'set solver option "needs_problem_instance" to True!'
            raise ValueError(msg)

        stabil_mat = get('stabil_mat', None, 'missing "stabil_mat" in options!')

        # With defaults.
        adimensionalize = get('adimensionalize', False)
        if adimensionalize:
            raise NotImplementedError

        check = get('check_navier_stokes_rezidual', False)

        log = get_logging_conf(conf)
        log = Struct(name='log_conf', **log)
        is_any_log = (log.text is not None) or (log.plot is not None)

        return Struct(needs_problem_instance=needs_problem_instance,
                      stabil_mat=stabil_mat,
                      adimensionalize=adimensionalize,
                      check_navier_stokes_rezidual=check,
                      i_max=get('i_max', 1),
                      eps_a=get('eps_a', 1e-10),
                      eps_r=get('eps_r', 1.0),
                      macheps=get('macheps', nm.finfo(nm.float64).eps),
                      lin_red=get('lin_red', 1.0),
                      lin_precision=get('lin_precision', None),
                      log=log,
                      is_any_log=is_any_log) + common
开发者ID:andy-c-huang,项目名称:sfepy,代码行数:59,代码来源:oseen.py


示例6: process_conf

    def process_conf(conf, kwargs):
        """
        Missing items are set to default values for a linear problem.

        Example configuration, all items::

            solver_1 = {
                'name' : 'newton',
                'kind' : 'nls.newton',

                'i_max' : 2,
                'eps_a' : 1e-8,
                'eps_r' : 1e-2,
                'macheps' : 1e-16,
                'lin_red' : 1e-2, # Linear system error < (eps_a * lin_red).
                'lin_precision' : None,
                'ls_red' : 0.1,
                'ls_red_warp' : 0.001,
                'ls_on' : 0.99999,
                'ls_min' : 1e-5,
                'give_up_warp' : False,
                'check' : 0,
                'delta' : 1e-6,
                'is_plot' : False,
                'log' : None, # 'nonlinear' or 'linear' (ignore i_max)
                'problem' : 'nonlinear',
            }
        """
        get = make_get_conf(conf, kwargs)
        common = NonlinearSolver.process_conf(conf)

        log = get_logging_conf(conf)
        log = Struct(name="log_conf", **log)
        is_any_log = (log.text is not None) or (log.plot is not None)

        return (
            Struct(
                i_max=get("i_max", 1),
                eps_a=get("eps_a", 1e-10),
                eps_r=get("eps_r", 1.0),
                macheps=get("macheps", nm.finfo(nm.float64).eps),
                lin_red=get("lin_red", 1.0),
                lin_precision=get("lin_precision", None),
                ls_red=get("ls_red", 0.1),
                ls_red_warp=get("ls_red_warp", 0.001),
                ls_on=get("ls_on", 0.99999),
                ls_min=get("ls_min", 1e-5),
                give_up_warp=get("give_up_warp", False),
                check=get("check", 0),
                delta=get("delta", 1e-6),
                is_plot=get("is_plot", False),
                problem=get("problem", "nonlinear"),
                log=log,
                is_any_log=is_any_log,
            )
            + common
        )
开发者ID:taldcroft,项目名称:sfepy,代码行数:57,代码来源:nls.py


示例7: process_conf

    def process_conf(conf, kwargs):
        """
        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'],
            }
        """
        get = make_get_conf(conf, kwargs)
        common = OptimizationSolver.process_conf(conf)

        log = get_logging_conf(conf)
        log = Struct(name='log_conf', **log)
        is_any_log = (log.text is not None) or (log.plot is not None)

        return Struct(i_max=get('i_max', 10),
                      eps_rd=get('eps_rd', 1e-5),
                      eps_of=get('eps_of', 1e-4),
                      eps_ofg=get('eps_ofg', 1e-8),
                      norm=get('norm', nm.Inf),
                      ls=get('ls', True),
                      ls_method=get('ls_method', 'backtracking'),
                      ls0=get('ls0', 0.25),
                      ls_red=get('ls_red', 0.5),
                      ls_red_warp=get('ls_red_warp', 0.1),
                      ls_on=get('ls_on', 0.99999),
                      ls_min=get('ls_min', 1e-5),
                      check=get('check', 0),
                      delta=get('delta', 1e-6),
                      output=get('output', None),
                      yscales=get('yscales',
                                  ['linear', 'log', 'log', 'linear']),
                      log=log,
                      is_any_log=is_any_log) + common
开发者ID:taldcroft,项目名称:sfepy,代码行数:56,代码来源:optimize.py


示例8: process_conf

    def process_conf(conf, kwargs):
        """
        Process configuration options.
        """
        get = make_get_conf(conf, kwargs)
        common = SimpleTimeSteppingSolver.process_conf(conf, kwargs)

        return Struct(mass=get('mass', None,
                               'missing "mass" in options!'),
                      lumped=get('lumped', False)) + common
开发者ID:AshitaPrasad,项目名称:sfepy,代码行数:10,代码来源:ts_solvers.py


示例9: process_conf

    def process_conf(conf, kwargs):
        """
        Missing items are set to default values.

        Example configuration, all items::

            solver_1 = {
                'name' : 'semismooth_newton',
                'kind' : 'nls.semismooth_newton',

                'semismooth' : True,

                'i_max'      : 10,
                'eps_a'      : 1e-8,
                'eps_r'      : 1e-2,
                'macheps'   : 1e-16,
                'lin_red'    : 1e-2, # Linear system error < (eps_a * lin_red).
                'ls_red_reg' : 0.1,
                'ls_red_alt' : 0.01,
                'ls_red_warp' : 0.001,
                'ls_on'      : 0.9,
                'ls_min'     : 1e-10,
                'log'        : {'plot' : 'convergence.png'},
            }
        """
        get = make_get_conf(conf, kwargs)
        common = NonlinearSolver.process_conf(conf)

        log = get_logging_conf(conf)
        log = Struct(name='log_conf', **log)
        is_any_log = (log.text is not None) or (log.plot is not None)

        return Struct(semismooth=get('semismooth', True),
                      i_max=get('i_max', 1),
                      eps_a=get('eps_a', 1e-10),
                      eps_r=get('eps_r', 1.0),
                      macheps=get('macheps', nm.finfo(nm.float64).eps),
                      lin_red=get('lin_red', 1.0),
                      ls_red=get('ls_red', 0.1),
                      ls_red_warp=get('ls_red_warp', 0.001),
                      ls_on=get('ls_on', 0.99999),
                      ls_min=get('ls_min', 1e-5),
                      log=log,
                      is_any_log=is_any_log) + common
开发者ID:AshitaPrasad,项目名称:sfepy,代码行数:44,代码来源:semismooth_newton.py


示例10: process_conf

    def process_conf(conf, kwargs):
        """
        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
            }
        """
        get = make_get_conf(conf, kwargs)
        common = OptimizationSolver.process_conf(conf)

        opts = Struct(method=get('method', 'fmin'),
                      i_max=get('i_max', 10),
                      verbose=get('verbose', False)) + common

        other = {}
        keys = opts.to_dict().keys()

        for key, val in conf.to_dict().iteritems():
            if key not in keys:
                other[key] = val

        return opts + Struct(**other)
开发者ID:renatocoutinho,项目名称:sfepy,代码行数:36,代码来源:optimize.py



注:本文中的sfepy.solvers.solvers.make_get_conf函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python solvers.LinearSolver类代码示例发布时间:2022-05-27
下一篇:
Python solvers.Solver类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap