optimize¶
Subpackages¶
Package Contents¶
-
class
InterfaceCharacterization
[source]¶ Interface for the evaluation of a device
-
class
Characterization
[source]¶ Bases:
optimeed.optimize.characterization.interfaceCharacterization.InterfaceCharacterization
-
class
MathsToPhysics
[source]¶ Bases:
optimeed.optimize.mathsToPhysics.interfaceMathsToPhysics.InterfaceMathsToPhysics
Dummy yet powerful example of maths to physics. The optimization variables are directly injected to the device
-
class
InterfaceMathsToPhysics
[source]¶ Interface to transform output from the optimizer to meaningful variables of the device
-
abstract
fromMathsToPhys
(self, xVector, theDevice, opti_variables)[source]¶ Transforms an input vector coming from the optimization (e.g. [0.23, 4, False]) to “meaningful” variable (ex: length, number of poles, flag).
- Parameters
xVector – List of optimization variables from the optimizer
theDevice –
InterfaceDevice
opti_variables – list of
OptimizationVariable
-
abstract
-
class
FastObjCons
(constraintEquation, name=None)[source]¶ Bases:
optimeed.optimize.objAndCons.interfaceObjCons.InterfaceObjCons
Convenience class to create an objective or a constraint very fast.
-
class
InterfaceObjCons
[source]¶ Interface class for objectives and constraints. The objective is to MINIMIZE and the constraint has to respect VALUE <= 0
-
class
MultiObjective_GA
[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 aGenerator
Define the algorithm. As options, define how to evaluate the elements with aEvaluator
, i.e., for multiprocessing. Define what is the termination condition of the algorithm withTerminationCondition
. Here, termination condition is a maximum time.-
DIVISION_OUTER
= 0¶
-
OPTI_ALGORITHM
= 1¶
-
NUMBER_OF_CORES
= 2¶
-
-
class
Real_OptimizationVariable
(attributeName, val_min, val_max)[source]¶ Bases:
optimeed.optimize.optiVariable.OptimizationVariable
Real (continuous) optimization variable. Most used type
-
class
Binary_OptimizationVariable
[source]¶ Bases:
optimeed.optimize.optiVariable.OptimizationVariable
Boolean (True/False) optimization variable.
-
class
Integer_OptimizationVariable
(attributeName, val_min, val_max)[source]¶ Bases:
optimeed.optimize.optiVariable.OptimizationVariable
Integer variable, in [min_value, max_value]
-
class
Optimizer
[source]¶ Bases:
optimeed.core.options.Option_class
Main optimizing class
-
DISPLAY_INFO
= 1¶
-
KWARGS_OPTIHISTO
= 2¶
-
set_optimizer
(self, theDevice, theObjectiveList, theConstraintList, theOptimizationVariables, theOptimizationAlgorithm=default['Algo'], theCharacterization=default['Charac'], theMathsToPhysics=default['M2P'])[source]¶ Prepare the optimizer for the optimization.
- Parameters
theDevice – object of type
InterfaceDevice
theCharacterization – object of type
InterfaceCharacterization
theMathsToPhysics – object of type
InterfaceMathsToPhysics
theObjectiveList – list of objects of type
InterfaceObjCons
theConstraintList – list of objects of type
InterfaceObjCons
theOptimizationAlgorithm – list of objects of type
AlgorithmInterface
theOptimizationVariables – list of objects of type
OptimizationVariable
- Returns
PipeOptimization
-
run_optimization
(self)[source]¶ Perform the optimization.
- Returns
Collection
of the best optimized devices
-
evaluateObjectiveAndConstraints
(self, x)[source]¶ Evaluates the performances of device associated to entrance vector x. Outputs the objective function and the constraints, and other data used in optiHistoric.
This function is NOT process safe: “self.” is actually a FORK in multiprocessing algorithms. It means that the motor originally contained in self. is modified only in the fork, and only gathered by reaching the end of the fork. It is not (yet?) possible to access this motor on the main process before the end of the fork. This behaviour could be changed by using pipes or Managers.
- Parameters
x – Input mathematical vector from optimization algorithm
- Returns
dictionary, containing objective values (list of scalar), constraint values (list of scalar), and other info (motor, time)
-