1.1. Base¶
Base classes for all estimators. Class definition for Individual, the base class for all surrogate models.
1.1.2. MultiFiSurrogateModel¶
1.1.3. Individual¶
-
class
surrogate.base.
Individual
(estimator[, variable, constraint, weights])[source]¶ A Individual
Parameters: estimator – physical based model -
__init__
(estimator, variable=None, constraint=None, weights=())[source]¶ Parameters: - estimator –
- variable –
- constraint –
- weights –
Returns:
-
__weakref__
¶ list of weak references to the object (if defined)
-
getVar
(i)[source]¶ The fitness is a measure of quality of a solution. If values are provided as a tuple, the fitness is initalized using those values, otherwise it is empty (or invalid).
Parameters: i – index of variable if not (isinstance(i, int) and i >= 0): raise ValueError("Variable index must be an integer >= 0 .")
Note
Note
-
1.1.4. Fitness¶
-
class
surrogate.base.
Fitness
([values])[source]¶ The fitness is a measure of quality of a solution. If values are provided as a tuple, the fitness is initalized using those values, otherwise it is empty (or invalid).
Parameters: values – The initial values of the fitness as a tuple, optional. Fitnesses may be compared using the
>
,<
,>=
,<=
,==
,!=
. The comparison of those operators is made lexicographically. Maximization and minimization are taken care off by a multiplication between theweights
and the fitnessvalues
. The comparison can be made between fitnesses of different size, if the fitnesses are equal until the extra elements, the longer fitness will be superior to the shorter.Different types of fitnesses.
Note
When comparing fitness values that are minimized,
a > b
will returnTrue
if a is smaller than b.-
__init__
(values=(), weights=())[source]¶ x.__init__(…) initializes x; see help(type(x)) for signature
-
__weakref__
¶ list of weak references to the object (if defined)
-
dominates
(other, obj=slice(None, None, None))[source]¶ Return true if each objective of self is not strictly worse than the corresponding objective of other and at least one objective is strictly better.
Parameters: obj – Slice indicating on which objectives the domination is tested. The default value is slice(None), representing every objectives.
-
valid
¶ Assess if a fitness is valid or not.
-
values
¶ Fitness values. Use directly
individual.fitness.values = values
in order to set the fitness anddel individual.fitness.values
in order to clear (invalidate) the fitness. The (unweighted) fitness can be directly accessed viaindividual.fitness.values
.
-
weights
= None¶ The weights are used in the fitness comparison. They are shared among all fitnesses of the same type. When subclassing
Fitness
, the weights must be defined as a tuple where each element is associated to an objective. A negative weight element corresponds to: (-1.0, -1.0)the minimization of the associated objective.
A positive weight element corresponds to: (1.0, 1.0)the maximization of the associated objective.
Note
If weights is not defined during subclassing, the following error will occur at instantiation of a subclass fitness object:
TypeError: Can't instantiate abstract <class Fitness[...]> with abstract attribute weights.
-
wvalues
= ()¶ Contains the weighted values of the fitness, the multiplication with the weights is made when the values are set via the property
values
. Multiplication is made on setting of the values for efficiency.Generally it is unnecessary to manipulate wvalues as it is an internal attribute of the fitness used in the comparison operators.
-