本文整理汇总了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)
示例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)
示例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()
示例4: __init__
# 需要导入模块: from solver import Solver [as 别名]
# 或者: from solver.Solver import __init__ [as 别名]
def __init__(self):
Solver.__init__(self)
示例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
示例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
示例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