示例#1
0
    result = []
    time = []
    bestR = []
    bestD = 10**(20)
    dict = []
    constk = 10
    for idx in range(5):
        result = []
        k = (idx + 1) * constk
        # percent = 0.1 + 0.1*idx
        ep = []

        #get the time
        tools = Tool(data)
        start = datetime.datetime.now().timestamp()
        a, b, c = tools.Generic_Algorithm(k, t, percent)
        end = datetime.datetime.now().timestamp()
        time.append(end - start)

        for i in range(10):
            np.random.shuffle(data)
            tools = Tool(data)
            a, b, c, e = tools.Generic_Algorithm_Epoch(k, t, percent, epoch)
            ep.append(e)
            if b < bestD:
                bestR = np.copy(a)
                bestD = b
                dict = copy.deepcopy(c)

        ep = np.asarray(ep)
        resultSum.append(np.sum(ep, axis=0).tolist())