Beispiel #1
0
def hv_pop():
    # ref_point = [2, 2]
    # points = [[1, 2], [0.5, 3], [0.1, 3.1]]
    udp = pg.dtlz(prob_id=1, dim=5, fdim=3)
    pop = pg.population(prob=udp, size=2)
    # hv = pg.hypervolume(pop=pop)
    udp.plot(pop)
    print(pop)
Beispiel #2
0
async def evaluate(X, configs={'prob_id': 1, 'D': 30, 'O': 2, 'wall_time': 1}):
    assert type(X) == np.ndarray, 'Input X must be a numpy array'

    prob_id, D, O, wall_time = itemgetter('prob_id', 'D', 'O',
                                          'wall_time')(configs)

    prob = pg.problem(pg.dtlz(prob_id=prob_id, dim=D, fdim=O))
    lower_bound, upper_bound = prob.get_bounds()
    # denormalize the parameters
    X = lower_bound + (upper_bound - lower_bound) * X

    Y = []
    start_time = time.time()
    await asyncio.sleep(wall_time)
    for x in X:
        y = prob.fitness(x)
        Y.append(y)
    end_time = time.time()
    Y = np.array(Y)
    print(f'time cost: {(end_time - start_time) * 1e3:.3f} ms')

    return Y
Beispiel #3
0
def draw_dtlz(prob_id, dim=5, fdim=3, alph=0.5, individual_size=20):
    udp = pg.dtlz(prob_id=prob_id, dim=dim, fdim=fdim)
    pop = pg.population(udp, individual_size)
    udp.plot(pop)  # doctest: +SKIP
    pass
Beispiel #4
0
def dtlz_p1():
    udp = pg.dtlz(prob_id=1, dim=5, fdim=3)
    pop = pg.population(udp, 40)
    hv = pg.hypervolume(pop)
    udp.plot(pop)  # doctest: +SKIP
Beispiel #5
0
def dtlz_p6():
    udp = pg.dtlz(prob_id=6, fdim=3, dim=5)
    pop = pg.population(udp, 40)
    udp.plot(pop)  # doctest: +SKIP