当前位置: 首页>>代码示例>>Python>>正文


Python Solver.__init__方法代码示例

本文整理汇总了Python中solver.Solver.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Solver.__init__方法的具体用法?Python Solver.__init__怎么用?Python Solver.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在solver.Solver的用法示例。


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

示例1: __init__

# 需要导入模块: from solver import Solver [as 别名]
# 或者: from solver.Solver import __init__ [as 别名]
    def __init__(self, dim, integrator_type, h0, eps, k, g1, g2, alpha, beta,
                 gamma=1.4, xsph_eps=0,
                 kernel=base.CubicSplineKernel, hks=True):

        # solver dimension
        self.dim = dim

        # Hernquist and Katz normalization
        self.hks = hks

        # the SPH kernel to use
        self.kernel = kernel(dim)

        self.defaults = dict(alpha=alpha,
                             beta=beta,
                             gamma=gamma,
                             adke_eps=eps,
                             adke_k=k,
                             adke_h0=h0,
                             g1=g1,
                             g2=g2,
                             xsph_eps=xsph_eps)

        # base class constructor
        Solver.__init__(self, dim, integrator_type)
开发者ID:sabago,项目名称:pysph,代码行数:27,代码来源:shock_tube_solver.py

示例2: __init__

# 需要导入模块: from solver import Solver [as 别名]
# 或者: from solver.Solver import __init__ [as 别名]
 def __init__(self, dst_point, vertex_rect):
   Solver.__init__(self, dst_point, vertex_rect)
   self.vertex_rect = self.neighbor_lst
   # init wgt_lst as [0.0, 0.0, 0.0, 0.0]
   self.wgt_lst.append(0.0)
   self.wgt_lst.append(0.0)
   self.wgt_lst.append(0.0)
   self.wgt_lst.append(0.0)
开发者ID:xunzhang,项目名称:Threp,代码行数:10,代码来源:bilinear_solver.py

示例3: __init__

# 需要导入模块: from solver import Solver [as 别名]
# 或者: from solver.Solver import __init__ [as 别名]
    def __init__(self, p, name='some solver'):
        """p is a problem instance of type MPProb"""
        Solver.__init__(self, p, name)
        self.lp = glpk.LPX()    # Construct an empty linear program.
        self.lp.name = self.name
        self.lp.obj.maximize = self.p.maximize

        # columns
        self.lp.cols.add(self.p.numcols)
        self.lp.obj[:] = list(self.p.obj)
        for c, lb, ub, in zip(self.lp.cols, self.p.lb, self.p.ub):
            if np.isinf(lb):
                lb = None
            if np.isinf(ub):
                ub = None
            c.bounds = lb, ub

        # set variable types
        self.changeVarType(self.p.ctype)

        # rows
        if self.p.numrows > 0:
            self.lp.rows.add(self.p.numrows)
        for i in range(self.p.numrows):
            row = self.lp.rows[i]
            if self.p.sense[i] == 'E':
                row.bounds = self.p.rhs[i]
            elif self.p.sense[i] == 'L':
                row.bounds = None, self.p.rhs[i]
            elif self.p.sense[i] == 'G':
                row.bounds = self.p.rhs[i], None
            else:
                assert False, "wrong sense %s" % (self.p.sense[i],)

        # matrix coefficients
        self.lp.matrix = self.p.A.to_coordinate()
开发者ID:dariux,项目名称:mpsolver,代码行数:38,代码来源:glpksolver.py

示例4: __init__

# 需要导入模块: from solver import Solver [as 别名]
# 或者: from solver.Solver import __init__ [as 别名]
 def __init__(self):
     Solver.__init__(self)
开发者ID:Sandy4321,项目名称:lin-train,代码行数:4,代码来源:leastsquares.py

示例5: __init__

# 需要导入模块: from solver import Solver [as 别名]
# 或者: from solver.Solver import __init__ [as 别名]
    def __init__(self, alpha=0.1, intercept=True):
        Solver.__init__(self)

        # parameters
        self.alpha = alpha # regularization constant
        self.intercept = intercept # automatically gues intercept and do not regularize
开发者ID:nathanntg,项目名称:lin-train,代码行数:8,代码来源:ridgeregression.py

示例6: __init__

# 需要导入模块: from solver import Solver [as 别名]
# 或者: from solver.Solver import __init__ [as 别名]
 def __init__(self, dst_point, pole_pnts, n):
   Solver.__init__(self, dst_point, pole_pnts)
   self.num = n
开发者ID:xunzhang,项目名称:Threp,代码行数:5,代码来源:pole_solver.py

示例7: __init__

# 需要导入模块: from solver import Solver [as 别名]
# 或者: from solver.Solver import __init__ [as 别名]
 def __init__(self, dst_point, neighbor_lst, eps = 1.0e-6, power = 2):
   Solver.__init__(self, dst_point, neighbor_lst)
   self.eps = eps
   self.power = power
开发者ID:xunzhang,项目名称:Threp,代码行数:6,代码来源:idw_solver.py


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