Example #1
0
 def set_params(self,
                population: "Population",
                population_size: int = None,
                lattice_resolution: int = None,
                interact: bool = False,
                a_priori_preference: bool = False,
                generations_per_iteration: int = 10,
                iterations: int = 10,
                plotting: bool = True,
                logging: bool = False,
                logfile=None,
                **kwargs):
     lattice_resolution_options = {
         "2": 49,
         "3": 13,
         "4": 7,
         "5": 5,
         "6": 4,
         "7": 3,
         "8": 3,
         "9": 3,
         "10": 3,
     }
     if population.problem.num_of_objectives < 11:
         lattice_resolution = lattice_resolution_options[str(
             population.problem.num_of_objectives)]
     else:
         lattice_resolution = 3
     reference_vectors = ReferenceVectors(
         lattice_resolution, population.problem.num_of_objectives)
     nsga3params = {
         "population_size": reference_vectors.number_of_vectors,
         "lattice_resolution": lattice_resolution,
         "interact": interact,
         "a_priori": a_priori_preference,
         "generations": generations_per_iteration,
         "iterations": iterations,
         "ploton": plotting,
         "logging": logging,
         "logfile": logfile,
         "current_iteration_gen_count": 0,
         "current_iteration_count": 0,
         "current_total_gen_count": 0,
         "total_generations": iterations * generations_per_iteration,
         "reference_vectors": reference_vectors,
         "extreme_points": None,
     }
     nsga3params.update(kwargs)
     return nsga3params
Example #2
0
    def set_params(
        self,
        population: "Population",
        generations_per_iteration: int = 10,
        iterations: int = 10,
        Alpha: float = 2,
        ref_point: list = None,
        old_point: list = None,
        **kwargs
    ):
        """Set up the parameters. Save in RVEA.params. Note, this should be
        changed to align with the current structure.

        Parameters
        ----------
        population : Population
            Population object
        Alpha : float
            The alpha parameter of APD selection.
        plotting : bool
            Useless really.
        Returns
        -------

        """
        ref_vectors = ReferenceVectors(
            number_of_objectives=population.problem.num_of_objectives,
            creation_type="Sparse_Focused",
            ref_point=old_point,
        )
        if ref_point is None:
            ref_point = ref_vectors.values[0]
        rveaparams = {
            "reference_vectors": ref_vectors,
            "population_size": ref_vectors.number_of_vectors,
            "generations": generations_per_iteration,
            "iterations": iterations,
            "Alpha": Alpha,
            "current_iteration_gen_count": 0,
            "current_iteration_count": 0,
            "current_total_gen_count": 0,
            "total_generations": iterations * generations_per_iteration,
            "ref_point": ref_point,
        }
        rveaparams.update(kwargs)
        return rveaparams
Example #3
0
    def set_params(
        self,
        population: "Population",
        population_size: int = None,
        lattice_resolution: int = None,
        interact: bool = False,
        a_priori_preference: bool = False,
        generations_per_iteration: int = 10,
        iterations: int = 10,
        Alpha: float = 2,
        plotting: bool = True,
    ):
        """Set up the parameters. Save in RVEA.params. Note, this should be
        changed to align with the current structure.

        Parameters
        ----------
        population : Population
            Population object
        population_size : int
            Population Size
        lattice_resolution : int
            Lattice resolution
        interact : bool
            bool to enable or disable interaction. Enabled if True
        a_priori_preference : bool
            similar to interact
        generations_per_iteration : int
            Number of generations per iteration.
        iterations : int
            Total Number of iterations.
        Alpha : float
            The alpha parameter of APD selection.
        plotting : bool
            Useless really.
        Returns
        -------

        """
        lattice_resolution_options = {
            "2": 49,
            "3": 13,
            "4": 7,
            "5": 5,
            "6": 4,
            "7": 3,
            "8": 3,
            "9": 3,
            "10": 3,
        }
        if population.problem.num_of_objectives < 11:
            lattice_resolution = lattice_resolution_options[str(
                population.problem.num_of_objectives)]
        else:
            lattice_resolution = 3
        rveaparams = {
            "population_size":
            population_size,
            "lattice_resolution":
            lattice_resolution,
            "interact":
            interact,
            "a_priori":
            a_priori_preference,
            "generations":
            generations_per_iteration,
            "iterations":
            iterations,
            "Alpha":
            Alpha,
            "ploton":
            plotting,
            "current_iteration_gen_count":
            0,
            "current_iteration_count":
            0,
            "reference_vectors":
            ReferenceVectors(lattice_resolution,
                             population.problem.num_of_objectives),
        }
        return rveaparams