Beispiel #1
0
def main() -> None:
    problem = Kursawe()
    algorithm = NSGAII[FloatSolution, List[FloatSolution]](
        problem=problem,
        population_size=100,
        max_evaluations=25000,
        mutation=Polynomial(1.0/problem.number_of_variables, distribution_index=20),
        crossover=SBX(1.0, distribution_index=20),
        selection = BinaryTournament(RankingAndCrowdingDistanceComparator()))

    algorithm.run()
    result = algorithm.get_result()

    SolutionListOutput[FloatSolution].print_function_values_to_file("FUN."+problem.get_name(), result)

    logger.info("Algorithm (continuous problem): " + algorithm.get_name())
    logger.info("Problem: " + problem.get_name())
Beispiel #2
0
def main() -> None:
    problem = Kursawe()
    algorithm = SMPSO(problem=problem,
                      swarm_size=100,
                      max_evaluations=25000,
                      mutation=Polynomial(1.0 / problem.number_of_variables,
                                          distribution_index=20),
                      leaders=CrowdingDistanceArchive(100))

    algorithm.run()
    result = algorithm.get_result()

    SolutionListOutput[FloatSolution].print_function_values_to_file(
        "FUN." + problem.get_name(), result)

    logger.info("Algorithm (continuous problem): " + algorithm.get_name())
    logger.info("Problem: " + problem.get_name())
def main() -> None:
    problem = Kursawe()
    algorithm = NSGAII[FloatSolution, List[FloatSolution]](
        problem,
        population_size=100,
        max_evaluations=25000,
        mutation=Polynomial(1.0 / problem.number_of_variables,
                            distribution_index=20),
        crossover=SBX(1.0, distribution_index=20),
        selection=BinaryTournamentSelection())

    algorithm.run()
    result = algorithm.get_result()

    SolutionListOutput[FloatSolution].plot_scatter_to_file(result,
                                                           file_name="FUN." +
                                                           problem.get_name(),
                                                           output_format='eps',
                                                           dpi=200)
    SolutionListOutput[FloatSolution].plot_scatter_to_screen(result)

    logger.info("Algorithm (continuous problem): " + algorithm.get_name())
    logger.info("Problem: " + problem.get_name())
Beispiel #4
0
 def test_should_get_name_return_the_right_name(self):
     problem = Kursawe()
     self.assertEqual("Kursawe", problem.get_name())
 def test_should_get_name_return_the_right_name(self):
     problem = Kursawe()
     self.assertEqual("Kursawe", problem.get_name())