Ejemplo n.º 1
0
    print("optimizing for planet : {}".format(p_name))
    print("radius : {}".format(radius))
    print("density: {}".format(density))
    print("escape velocity: {}".format(escape_velocity))
    print("surface temperature : {}".format(surface_temperature))
    print("")

    problem = get_modified_crs_objective(radius, density, escape_velocity,
                                         surface_temperature)

    # problem = get_modified_drs_objective(radius, density, escape_velocity,surface_temperature)

    algorithm = MOQPSO(problem=problem,
                       swarm_size=100,
                       max_evaluations=100000,
                       mutation=Polynomial(probability=0.3,
                                           distribution_index=20),
                       leaders=CrowdingDistanceArchive(500),
                       reference_point=[0, 0])

    # algorithm = SMPSO(
    #         problem=problem,
    #         swarm_size=100,
    #         max_evaluations=100000,
    #         mutation=Polynomial(probability=0.2, distribution_index=10),
    #         leaders=CrowdingDistanceArchive(100),
    #         reference_point=[0] * problem.number_of_objectives
    #     )

    try:
        algorithm.run()
        front = algorithm.get_result()
Ejemplo n.º 2
0
from jmetal.algorithm import NSGAII
from jmetal.operator import Polynomial, SBX, BinaryTournamentSelection
from jmetal.component import RankingAndCrowdingDistanceComparator, BasicAlgorithmObserver

from jmetal.problem import ZDT1

algorithm = NSGAII(problem=ZDT1(),
                   population_size=100,
                   max_evaluations=25000,
                   mutation=Polynomial(probability=1.0 /
                                       problem.number_of_variables,
                                       distribution_index=20),
                   crossover=SBX(probability=1.0, distribution_index=20),
                   selection=BinaryTournamentSelection(
                       comparator=RankingAndCrowdingDistanceComparator()))

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