示例#1
0
    time = []

    bestR = []
    bestD = 10**(20)
    dict = []
    st_root = 1
    for idx in range(5):
        result = []
        alpha = alpha_root - 0.1 * idx
        # st = st_root + 2*idx
        tmin = alpha**(m)
        ep = []

        tools = Tool(data)
        start = datetime.datetime.now().timestamp()
        a, b, c = tools.Stimulated_Annealing(t0, tmin, alpha, st)
        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.Stimulated_Annealing_Epoch(
                t0, tmin, alpha, st, epoch)
            ep.append(e)
            if b < bestD:
                bestR = np.copy(a)
                bestD = b
                dict = copy.deepcopy(c)

        ep = np.asarray(ep)