Esempio n. 1
0
def benchmark_as_pandas_2025_items(benchmark):
    dim = 45
    archive = GridArchive((dim, dim), [(-1, 1), (-1, 1)])
    archive.initialize(10)

    for x in np.linspace(-1, 1, dim):
        for y in np.linspace(-1, 1, dim):
            sol = np.random.random(10)
            sol[0] = x
            sol[1] = y
            archive.add(sol, 1.0, np.array([x, y]))

    # Archive should be full.
    assert len(archive.as_pandas()) == dim * dim

    benchmark(archive.as_pandas)
Esempio n. 2
0
                plt.ylabel(bc_names[opt.bcs[1]])  #objective 1
                '''
                plt.tick_params(
                    axis='y',          # changes apply to the x-axis
                    which='both',      # both major and minor ticks are affected
                    left=False,      # ticks along the bottom edge are off
                    right=False,         # ticks along the top edge are off
                    labelleftFalse) # labels along the bottom edge are off
                '''

                figname = '/map_' + str(i)
                plt.savefig(logdir + figname)
                plt.close()

                #save the archive
                df = archive.as_pandas(include_solutions=True)
                df.to_pickle(logdir + "/archive.zip")

    else:
        ##############################################################################################
        #cma/pycma implementation

        n_features = 100  #number of input features for the noise vector generator. other tolerance options available.

        #get the size of the noise map that TOAD-GAN will need
        vec_size = 0
        n_pad = int(1 * opt.num_layer)
        for noise_map in noise_maps:
            nzx = int(round((noise_map.shape[-2] - n_pad * 2) * opt.scale_v))
            nzy = int(round((noise_map.shape[-1] - n_pad * 2) * opt.scale_h))
            vec_size += 12 * nzx * nzy * opt.num_samples