Core

This subpackage store templates used in jMetalPy.

Algorithm

class jmetal.core.algorithm.Algorithm

Bases: typing.Generic, threading.Thread

get_current_computing_time() → float
get_evaluations() → int
get_name() → str
get_result() → R
Returns:Final population.
class jmetal.core.algorithm.EvolutionaryAlgorithm

Bases: jmetal.core.algorithm.Algorithm

create_initial_population() → typing.List[S]
evaluate_population(population: typing.List[S]) → typing.List[S]
init_progress() → None
is_stopping_condition_reached() → bool
replacement(population: typing.List[S], offspring_population: typing.List[S]) → typing.List[S]
reproduction(population: typing.List[S]) → typing.List[S]
run()
  • Step One: Generate the initial population of individuals randomly. (First generation)

  • Step Two: Evaluate the fitness of each individual in that population

  • Step Three: Repeat the following regenerational steps until termination

    1. Select the best-fit individuals for reproduction. (Parents)
    2. Breed new individuals through crossover and mutation operations to give birth to offspring.
    3. Evaluate the individual fitness of new individuals.
    4. Replace least-fit population with new individuals.

Note

To develop an EA, all the abstract the methods used in the run() method must be implemented.

selection(population: typing.List[S]) → typing.List[S]
update_progress()
class jmetal.core.algorithm.ParticleSwarmOptimization

Bases: jmetal.core.algorithm.Algorithm

create_initial_swarm() → typing.List[jmetal.core.solution.FloatSolution]
evaluate_swarm(swarm: typing.List[jmetal.core.solution.FloatSolution]) → typing.List[jmetal.core.solution.FloatSolution]
init_progress() → None
initialize_global_best(swarm: typing.List[jmetal.core.solution.FloatSolution]) → None
initialize_particle_best(swarm: typing.List[jmetal.core.solution.FloatSolution]) → None
initialize_velocity(swarm: typing.List[jmetal.core.solution.FloatSolution]) → None
is_stopping_condition_reached() → bool
perturbation(swarm: typing.List[jmetal.core.solution.FloatSolution]) → None
run()
update_global_best(swarm: typing.List[jmetal.core.solution.FloatSolution]) → None
update_particle_best(swarm: typing.List[jmetal.core.solution.FloatSolution]) → None
update_position(swarm: typing.List[jmetal.core.solution.FloatSolution]) → None
update_progress() → None
update_velocity(swarm: typing.List[jmetal.core.solution.FloatSolution]) → None
jmetal.core.algorithm.R = ~R

Operator

class jmetal.core.operator.Crossover(probability: float)

Bases: jmetal.core.operator.Operator

Class representing crossover operator.

execute(source: S) → R
get_name() → str
get_number_of_parents()
class jmetal.core.operator.Mutation(probability: float)

Bases: jmetal.core.operator.Operator

Class representing mutation operator.

execute(source: S) → R
get_name() → str
class jmetal.core.operator.Operator

Bases: typing.Generic

Class representing operator

execute(source: S) → R
get_name() → str
jmetal.core.operator.R = ~R
class jmetal.core.operator.Selection

Bases: jmetal.core.operator.Operator

Class representing selection operator.

execute(source: S) → R
get_name() → str

Problem

class jmetal.core.problem.BinaryProblem(rf_path: str = None)

Bases: jmetal.core.problem.Problem

Class representing binary problems.

create_solution() → jmetal.core.solution.BinarySolution
evaluate(solution: jmetal.core.solution.BinarySolution) → jmetal.core.solution.BinarySolution
class jmetal.core.problem.FloatProblem(rf_path: str = None)

Bases: jmetal.core.problem.Problem

Class representing float problems.

create_solution() → jmetal.core.solution.FloatSolution
evaluate(solution: jmetal.core.solution.FloatSolution) → jmetal.core.solution.FloatSolution
class jmetal.core.problem.IntegerProblem(rf_path: str = None)

Bases: jmetal.core.problem.Problem

Class representing integer problems.

create_solution() → jmetal.core.solution.IntegerSolution
evaluate(solution: jmetal.core.solution.IntegerSolution) → jmetal.core.solution.IntegerSolution
class jmetal.core.problem.Problem(reference_front_path: str)

Bases: typing.Generic

Class representing problems.

MAXIMIZE = 1
MINIMIZE = -1
create_solution() → S

Creates a random solution to the problem.

Returns:Solution.
evaluate(solution: S) → S

Evaluate a solution. For any new problem inheriting from Problem, this method should be replaced.

Returns:Evaluated solution.
evaluate_constraints(solution: S)
get_name() → str
static read_front_from_file(file_path: str) → typing.List[typing.List[float]]

Reads a front from a file and returns a list.

Returns:List of solution points.
static read_front_from_file_as_solutions(file_path: str) → typing.List[S]

Reads a front from a file and returns a list of solution objects.

Returns:List of solution objects.

Solution

class jmetal.core.solution.BinarySolution(number_of_variables: int, number_of_objectives: int, number_of_constraints: int = 0)

Bases: jmetal.core.solution.Solution

Class representing float solutions

get_total_number_of_bits() → int
class jmetal.core.solution.FloatSolution(number_of_variables: int, number_of_objectives: int, number_of_constraints: int, lower_bound: typing.List[float], upper_bound: typing.List[float])

Bases: jmetal.core.solution.Solution

Class representing float solutions

class jmetal.core.solution.IntegerSolution(number_of_variables: int, number_of_objectives: int, number_of_constraints: int, lower_bound: typing.List[int], upper_bound: typing.List[int])

Bases: jmetal.core.solution.Solution

Class representing integer solutions

class jmetal.core.solution.Solution(number_of_variables: int, number_of_objectives: int, number_of_constraints: int = 0)

Bases: typing.Generic

Class representing solutions

Observable

class jmetal.core.observable.DefaultObservable

Bases: jmetal.core.observable.Observable

deregister(observer: jmetal.core.observable.Observer)
deregister_all()
notify_all(*args, **kwargs)
register(observer: jmetal.core.observable.Observer)
class jmetal.core.observable.Observable

Bases: object

deregister(observer)
deregister_all()
notify_all(*args, **kwargs)
register(observer)
class jmetal.core.observable.Observer

Bases: object

update(*args, **kwargs)

Update method

Parameters:
  • args
  • kwargs
Returns: