HYPE¶
HYPE is a hypervolume-indicator-based evolutionary algorithm: it uses exact hypervolume contribution to rank and select solutions, which makes it accurate but computationally expensive on larger populations or evaluation budgets.
from jmetal.algorithm.multiobjective.hype import HYPE
from jmetal.core.solution import FloatSolution
from jmetal.operator.crossover import SBXCrossover
from jmetal.operator.mutation import PolynomialMutation
from jmetal.problem import ZDT1
from jmetal.util.solution import (
print_function_values_to_file,
print_variables_to_file,
read_solutions,
)
from jmetal.util.termination_criterion import StoppingByEvaluations
if __name__ == "__main__":
problem = ZDT1()
problem.reference_front = read_solutions(filename="resources/reference_fronts/ZDT1.pf")
reference_point = FloatSolution(
[0],
[1],
problem.number_of_objectives(),
)
reference_point.objectives = [1.0, 1.0] # Mandatory for HYPE
algorithm = HYPE(
problem=problem,
reference_point=reference_point,
population_size=100,
offspring_population_size=100,
mutation=PolynomialMutation(
probability=1.0 / problem.number_of_variables(), distribution_index=20
),
crossover=SBXCrossover(probability=1.0, distribution_index=20),
termination_criterion=StoppingByEvaluations(25000),
)
algorithm.run()
front = algorithm.result()
# Save results to file
print_function_values_to_file(front, "FUN." + algorithm.label)
print_variables_to_file(front, "VAR." + algorithm.label)
print(f"Algorithm: {algorithm.get_name()}")
print(f"Problem: {problem.name()}")
print(f"Computing time: {algorithm.total_computing_time}")