コード例 #1
0
def constraint(x):
    # x[0:10] in range(0,10); x[10:] in range(0,2)
    x = round(x).astype(int) # force round and convert type to int
    x0,x1 = x[:-2],x[-2:]
    x0 = clip(x0, 0,9)       #XXX: hack to impose bounds
    x1 = clip(x1, 0,1)       #XXX: hack to impose bounds
    x0 = unique(x0, range(0,10))
    return hstack([x0, x1])
コード例 #2
0
def constraint(x):
    x = round(x).astype(int) # force round and convert type to int
    x = clip(x, 1,n)         #XXX: impose bounds
    x = unique(x, range(1,n+1))
    return x
コード例 #3
0
ファイル: crypto.py プロジェクト: uqfoundation/mystic
def constraint(x):
    x = round(x).astype(int) # force round and convert type to int
    x = clip(x, 1,nletters)  #XXX: hack to impose bounds
    x = unique(x, list(range(1,nletters+1)))
    return x
コード例 #4
0
ファイル: crypto.py プロジェクト: vt100/mystic
def constraint(x):
    x = round(x).astype(int)  # force round and convert type to int
    x = clip(x, 1, nletters)  #XXX: hack to impose bounds
    x = unique(x, range(1, nletters + 1))
    return x