multiObjective_GA

Module Contents

Classes

class MyProblem(theOptimizationVariables, nbr_objectives, nbr_constraints, evaluationFunction)[source]

Bases: optimeed.optimize.optiAlgorithms.platypus.core.Problem

Automatically sets the optimization problem

evaluate(solution)[source]

Evaluates the problem.

By default, this method calls the function passed to the constructor. Alternatively, a problem can subclass and override this method. When overriding, this method is responsible for updating the objectives and constraints stored in the solution.

solution: Solution
The solution to evaluate.
class MyGenerator(initialVectorGuess)[source]

Bases: optimeed.optimize.optiAlgorithms.platypus.Generator

Population generator to insert initial individual

generate(problem)[source]
class MaxTimeTerminationCondition(maxTime)[source]

Bases: optimeed.optimize.optiAlgorithms.platypus.core.TerminationCondition

Abstract class for defining termination conditions.

initialize(algorithm)[source]

Initializes this termination condition.

This method is used to collect any initial state, such as the current NFE or current time, needed for calculating the termination criteria.

algorithm : Algorithm
The algorithm being run.
shouldTerminate(algorithm)[source]

Checks if the algorithm should terminate.

Check the termination condition, returning True if the termination condition is satisfied; False otherwise. This method is called after each iteration of the algorithm.

algorithm : Algorithm
The algorithm being run.
class ManualStopFromFileTermination(filename)[source]

Bases: optimeed.optimize.optiAlgorithms.platypus.core.TerminationCondition

Abstract class for defining termination conditions.

shouldTerminate(algorithm)[source]

Checks if the algorithm should terminate.

Check the termination condition, returning True if the termination condition is satisfied; False otherwise. This method is called after each iteration of the algorithm.

algorithm : Algorithm
The algorithm being run.
class ConvergenceTerminationCondition(minrelchange_percent=0.1, nb_generation=15)[source]

Bases: optimeed.optimize.optiAlgorithms.platypus.core.TerminationCondition

Abstract class for defining termination conditions.

initialize(algorithm)[source]

Initializes this termination condition.

This method is used to collect any initial state, such as the current NFE or current time, needed for calculating the termination criteria.

algorithm : Algorithm
The algorithm being run.
shouldTerminate(algorithm)[source]

Checks if the algorithm should terminate.

Check the termination condition, returning True if the termination condition is satisfied; False otherwise. This method is called after each iteration of the algorithm.

algorithm : Algorithm
The algorithm being run.
class SeveralTerminationCondition[source]

Bases: optimeed.optimize.optiAlgorithms.platypus.core.TerminationCondition

Abstract class for defining termination conditions.

initialize(algorithm)[source]

Initializes this termination condition.

This method is used to collect any initial state, such as the current NFE or current time, needed for calculating the termination criteria.

algorithm : Algorithm
The algorithm being run.
add(theTerminationCondition)[source]
shouldTerminate(algorithm)[source]

Checks if the algorithm should terminate.

Check the termination condition, returning True if the termination condition is satisfied; False otherwise. This method is called after each iteration of the algorithm.

algorithm : Algorithm
The algorithm being run.
class MyMapEvaluator(callback_on_evaluation)[source]

Bases: optimeed.optimize.optiAlgorithms.platypus.evaluator.Evaluator

evaluate_all(jobs, **kwargs)[source]
class MyMultiprocessEvaluator(callback_on_evaluation, numberOfCores)[source]

Bases: optimeed.optimize.optiAlgorithms.platypus.evaluator.Evaluator

my_callback(output)[source]
evaluate_all(jobs, **kwargs)[source]
close()[source]
class MultiObjective_GA(theGenerator=MyGenerator)[source]

Bases: optimeed.optimize.optiAlgorithms.algorithmInterface.AlgorithmInterface, optimeed.core.Option_class

Based on Platypus Library. Workflow: Define what to optimize and which function to call with a Problem Define the initial population with a Generator Define the algorithm. As options, define how to evaluate the elements with a Evaluator, i.e., for multiprocessing. Define what is the termination condition of the algorithm with TerminationCondition. Here, termination condition is a maximum time.

initialize(initialVectorGuess, listOfOptimizationVariables)[source]

This function is called just before running optimization algorithm.

compute()[source]

Launch the optimization

Returns:vector of optimal variables
set_evaluationFunction(evaluationFunction, callback_on_evaluation, numberOfObjectives, numberOfConstraints, array_evaluator)[source]

Set the evaluation function and all the necessary callbacks

Parameters:
  • evaluationFunction – check evaluateObjectiveAndConstraints()
  • callback_on_evaluation – check callback_on_evaluation(). Call this function after performing the evaluation of the individuals
  • numberOfObjectives – int, number of objectives
  • numberOfConstraints – int, number of constraints
  • array_evaluator – If True, evaluate each generation at once using numpy array. Use it only with care, as it dismisses some features (expert mode)
set_maxtime(maxTime)[source]

Set maximum optimization time (in seconds)

__str__()[source]

Return str(self).

get_convergence()[source]

This function is called just before compute. Because the convergence is contained in opti algorithm, it must be created now.

add_terminationCondition(theTerminationCondition)[source]
reset()[source]