Esempio n. 1
0
    swarm_size = 100

    reference_point = [[0.1, 0.8], [0.6, 0.1]]
    archives_with_reference_points = []

    for point in reference_point:
        archives_with_reference_points.append(
            CrowdingDistanceArchiveWithReferencePoint(
                int(swarm_size / len(reference_point)), point))

    max_evaluations = 50000
    algorithm = SMPSORP(problem=problem,
                        swarm_size=swarm_size,
                        mutation=PolynomialMutation(
                            probability=1.0 / problem.number_of_variables,
                            distribution_index=20),
                        reference_points=reference_point,
                        leaders=archives_with_reference_points,
                        termination_criterion=StoppingByEvaluations(
                            max_evaluations=max_evaluations))

    algorithm.observable.register(
        observer=VisualizerObserver(reference_front=problem.reference_front,
                                    reference_point=reference_point))

    algorithm.run()
    front = algorithm.get_result()

    # Plot front
    plot_front = Plot(title='Pareto front approximation. Problem: ' +
                      problem.get_name(),