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])
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
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
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