def get_setup(n_obj):
    if n_obj == 3:
        pop_size = 92
        ref_dirs = UniformReferenceDirectionFactory(n_obj, n_partitions=12).do()
    elif n_obj == 5:
        pop_size = 212
        ref_dirs = UniformReferenceDirectionFactory(n_obj, n_partitions=6).do()
    elif n_obj == 8:
        pop_size = 156
        ref_dirs = MultiLayerReferenceDirectionFactory([
            UniformReferenceDirectionFactory(n_obj, n_partitions=3, scaling=1.0),
            UniformReferenceDirectionFactory(n_obj, n_partitions=2, scaling=0.5)]).do()
    elif n_obj == 10:
        pop_size = 276
        ref_dirs = MultiLayerReferenceDirectionFactory([
            UniformReferenceDirectionFactory(n_obj, n_partitions=3, scaling=1.0),
            UniformReferenceDirectionFactory(n_obj, n_partitions=2, scaling=0.5)]).do()
    elif n_obj == 15:
        pop_size = 136
        ref_dirs = MultiLayerReferenceDirectionFactory([
            UniformReferenceDirectionFactory(n_obj, n_partitions=2, scaling=1.0),
            UniformReferenceDirectionFactory(n_obj, n_partitions=1, scaling=0.5)]).do()

    return {
        'ref_dirs': ref_dirs,
        'pop_size': pop_size,
        'crossover': SimulatedBinaryCrossover(1.0, 30),
        'mutation': PolynomialMutation(20)
    }
Exemple #2
0
    def _do(self):
        ref_dirs = MultiLayerReferenceDirectionFactory([
            UniformReferenceDirectionFactory(n_dim=self.n_dim,
                                             n_partitions=12,
                                             scaling=1),
            UniformReferenceDirectionFactory(n_dim=self.n_dim,
                                             n_partitions=12,
                                             scaling=0.7)
        ]).do()

        #UniformReferenceDirectionFactory(n_dim=self.n_dim,n_points=self.n_points, n_partitions=self.n_partitions, scaling=self.scaling).do()
        self.n_points = ref_dirs.shape[0]
        self.seq = np.tile(self.seq, [ref_dirs.shape[0], 1])
        ref_dirs = np.multiply(ref_dirs, self.seq)
        sum = np.sum(ref_dirs, axis=1)
        sum = np.tile(sum, [ref_dirs.shape[1], 1]).transpose()
        ref_dirs = np.divide(ref_dirs, sum)
        return ref_dirs
Exemple #3
0
from pymoo.experimental.pbi import ReferenceDirectionSurvivalPBI
from pymoo.optimize import minimize
from pymoo.util.reference_direction import UniformReferenceDirectionFactory, MultiLayerReferenceDirectionFactory
from pymop.factory import get_problem

import matplotlib.pyplot as plt

import numpy as np

problem = get_problem("dtlz3", n_var=None, n_obj=15, k=10)

n_gen = 2000
pop_size = 136
ref_dirs = MultiLayerReferenceDirectionFactory([
    UniformReferenceDirectionFactory(15, n_partitions=2, scaling=1.0),
    UniformReferenceDirectionFactory(15, n_partitions=1, scaling=0.5)
]).do()

# create the pareto front for the given reference lines
pf = problem.pareto_front(ref_dirs)

ideal_point = []
nadir_point = []


def my_callback(algorithm):
    ideal_point.append(np.copy(algorithm.survival.ideal_point))
    nadir_point.append(np.copy(algorithm.survival.nadir_point))


res = minimize(problem,