mutation=PolynomialMutation(probability=1.0 / problem.number_of_variables,
                                                    distribution_index=20),
                        leaders=CrowdingDistanceArchive(100),
                        termination_criterion=StoppingByEvaluations(max=max_evaluations)
                    ),
                    algorithm_tag='SMPSO',
                    problem_tag=problem_tag,
                    run=run,
                )
            )

    return jobs


if __name__ == '__main__':
    # Configure the experiments
    jobs = configure_experiment(problems={'ZDT1': ZDT1(), 'ZDT2': ZDT2(), 'ZDT3': ZDT3()}, n_run=31)

    # Run the study
    output_directory = 'data'

    experiment = Experiment(output_dir=output_directory, jobs=jobs)
    experiment.run()

    # Generate summary file
    generate_summary_from_experiment(
        input_dir=output_directory,
        reference_fronts='/home/user/jMetalPy/resources/reference_front',
        quality_indicators=[GenerationalDistance(), EpsilonIndicator(), HyperVolume([1.0, 1.0])]
    )
예제 #2
0
        for r, _, fl in os.walk(output_directory):
            for file in fl:
                if 'FUN' in file and prb in r:
                    with open(os.path.join(r, file), 'r') as f:
                        line = f.readline()
                        while line:
                            tokens = line.split()
                            fitness = [float(x) for x in tokens]
                            s = Solution(None, fitness)
                            population.append(s)
                            line = f.readline()

        population = non_dominated_population(population,
                                              maximize=False,
                                              filter_duplicate=False)
        # save to file
        pf_file = os.path.dirname(output_directory).join(prb + ".pf")
        with open(pf_file, 'w') as f:
            for s in population:
                f.write("".join([str(v) + "\t" for v in s.fitness]))
                f.write("\n")

    # Generate summary file
    generate_summary_from_experiment(
        input_dir=output_directory,
        quality_indicators=[
            GenerationalDistance(reference_front=output_directory),
            EpsilonIndicator(reference_front=output_directory),
            HyperVolume([0, 0])
        ])
예제 #3
0
                        termination_criterion=StoppingByEvaluationsCustom(max_evaluations=max_evaluations,
                                                                          reference_point=REFERENCE_POINT,
                                                                          AlgorithmName='SMPSO')
                    ),
                    algorithm_tag='SMPSO',
                    problem_tag=problem_tag,
                    run=run,
                )
            )
    return jobs


if __name__ == '__main__':
    # Configure the experiments
    jobs = configure_experiment(problems={'OTN': problemOTN}, n_run=TIMES_TO_RUN)

    # Run the study
    output_directory = 'data'
    experiment = Experiment(output_dir=output_directory, jobs=jobs)
    experiment.run()

    Filter.RemovePenalty(output_directory)

    # Reference fronts is the folder where is the reference to be compared with.
    generate_summary_from_experiment(
        input_dir=output_directory,
        reference_fronts='C:\\Users\\aryss\\Documents\\Repositories\\OTN_Mastering\\Output\\CT3\\8 services',
        quality_indicators=[InvertedGenerationalDistance(), EpsilonIndicator(), HyperVolume(REFERENCE_POINT)]
        #quality_indicators = [HyperVolume(REFERENCE_POINT)]
    )