optimize¶
Subpackages¶
Package Contents¶
-
class
InterfaceCharacterization
¶ Bases:
optimeed.core.options.Option_class
Interface for the evaluation of a device
-
__str__
(self)¶
-
-
class
Characterization
¶ Bases:
optimeed.optimize.characterization.interfaceCharacterization.InterfaceCharacterization
-
compute
(self, theDevice)¶
-
-
class
MathsToPhysics
¶ Bases:
optimeed.optimize.mathsToPhysics.interfaceMathsToPhysics.InterfaceMathsToPhysics
Dummy yet powerful example of maths to physics. The optimization variables are directly injected to the device
-
fromMathsToPhys
(self, xVector, theDevice, theOptimizationVariables)¶
-
fromPhysToMaths
(self, theDevice, theOptimizationVariables)¶
-
__str__
(self)¶
-
-
class
InterfaceMathsToPhysics
¶ Bases:
optimeed.core.options.Option_class
Interface to transform output from the optimizer to meaningful variables of the device
-
class
FastObjCons
(constraintEquation, name=None)¶ Bases:
optimeed.optimize.objAndCons.interfaceObjCons.InterfaceObjCons
Convenience class to create an objective or a constraint very fast.
-
compute
(self, theDevice)¶
-
get_name
(self)¶
-
-
class
InterfaceObjCons
¶ Bases:
optimeed.core.options.Option_class
Interface class for objectives and constraints. The objective is to MINIMIZE and the constraint has to respect VALUE <= 0
-
get_name
(self)¶
-
__str__
(self)¶
-
-
class
MultiObjective_GA
¶ Bases:
optimeed.optimize.optiAlgorithms.algorithmInterface.AlgorithmInterface
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¶
-
compute
(self, initialVectorGuess, listOfOptimizationVariables)¶
-
set_evaluationFunction
(self, evaluationFunction, callback_on_evaluation, numberOfObjectives, numberOfConstraints)¶
-
set_maxtime
(self, maxTime)¶
-
__str__
(self)¶
-
get_convergence
(self)¶
-
-
class
Real_OptimizationVariable
(attributeName, val_min, val_max)¶ Bases:
optimeed.optimize.optiVariable.OptimizationVariable
Real (continuous) optimization variable. Most used type
-
get_min_value
(self)¶
-
get_max_value
(self)¶
-
get_PhysToMaths
(self, deviceIn)¶
-
do_MathsToPhys
(self, value, deviceIn)¶
-
__str__
(self)¶
-
-
class
Binary_OptimizationVariable
¶ Bases:
optimeed.optimize.optiVariable.OptimizationVariable
Boolean (True/False) optimization variable.
-
get_PhysToMaths
(self, deviceIn)¶
-
do_MathsToPhys
(self, value, deviceIn)¶
-
__str__
(self)¶
-
-
class
Integer_OptimizationVariable
(attributeName, val_min, val_max)¶ Bases:
optimeed.optimize.optiVariable.OptimizationVariable
Integer variable, in [min_value, max_value]
-
get_min_value
(self)¶
-
get_max_value
(self)¶
-
get_PhysToMaths
(self, deviceIn)¶
-
do_MathsToPhys
(self, value, deviceIn)¶
-
__str__
(self)¶
-
-
class
Optimizer
¶ 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'])¶ 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
- theDevice – object of type
-
run_optimization
(self)¶ Perform the optimization.
Returns: Collection
of the best optimized machines
-
set_max_opti_time
(self, max_time_sec)¶
-
evaluateObjectiveAndConstraints
(self, x)¶ Evaluates the performances of machine 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)
-
callback_on_evaluation
(self, returnedValues)¶ Save the output of evaluateObjectiveAndConstraints to optiHistoric. This function should be called by the optimizer IN a process safe context.
-
formatInfo
(self)¶
-