예제 #1
0
 def __init__(self, node_name):
     self.constant = constant(NodeName, node_name)
예제 #2
0
 def __init__(self, attr_value):
     self.constant = constant(AttributeValue, attr_value)
예제 #3
0
 def __init__(self, axis_name):
     self.constant = constant(Axis, axis_name)
예제 #4
0
 def __init__(self, attr_name):
     self.constant = constant(AttributeName, attr_name)
예제 #5
0
 def __init__(self, expression):
     self.constant = constant(Expression, expression)
예제 #6
0
 def __init__(self, n):
     self.constant = constant(Number, str(n))
예제 #7
0
@params(float)
@rtype('assign_score_inc')
@priority(weight['special'])
def assign_score_inc(rhs):
    return """double lhs = score_inc;
new_score_inc = {};""".format(rhs)


@params('assign_unbumped', 'assign_new_score', 'assign_score_inc')
@rtype('heuristic')
@priority(weight['special'])
def heuristic(a, b, c):
    return [a, b, c]


constant(int, str(0), weight['constant'])
for i in range(1, 10):
    constant('nonzero', str(i), weight['constant'])
for i in range(1, 11):
    constant('nonzero', str(2**i), weight['constant'])
for i in range(1, 10):
    constant(float, str(i / 10), weight['constant'])
constant('nonzero', 'stats.conflicts', weight['i'])
constant(float, 'lhs', weight['lhs'])
constant(float, 'score_inc', weight['inc'])

free(int, 'nonzero', weight['conversion'])


def selection_strategy(parent, children):
    ret = []
예제 #8
0
@params(Real, Real)
@rtype(Real)
@ignore(float('inf'), ZeroDivisionError)
def div(x, y):
    return x / y


@params(Real, Real)
@rtype(Real)
@ignore(float('inf'), ZeroDivisionError)
def exp(x, y):
    return x**y


one = constant(Real, 1)
zero = constant(Real, 0)
two = constant(Real, 2)
half = constant(Real, 0.5)


@params(func(Real, Real, Real), Real)
@rtype(func(Real, Real))
def num_partial(fn, arg):
    return lambda x: fn(arg, x)


@params(func(Real, Real), [Real])
@rtype([Real])
def num_map(fn, nums):
    return map(fn, nums)