f3dasm_optimize.PSO
- class PSO(domain, population=30, transform='identity', omega=0.7213475204444817, phip=1.1931471805599454, phig=1.1931471805599454, qo=False, sqo=False, so=False, **kwargs)[source]
Bases:
NeverGradOptimizer
List of Public Methods
Update step of the optimizer. Needs to be implemented
Attributes
require_gradients
type
Methods
- _check_number_of_datapoints()
- Check if the number of datapoints is sufficient
for the initial population
- Raises:
ValueError – Raises when the number of datapoints is insufficient
- _construct_model(data_generator)
Method that is called before the optimization starts. This method can be used to construct a model based on the available data or a specific data generator.
- Parameters:
data_generator (DataGenerator) – DataGenerator object
Note
When this method is not implemented, the method will do nothing.
- _get_info()
Give a list of characteristic features of this optimizer
- property _population: int
Property to return the population size of the optimizer
- Returns:
Number of individuals in the population
- Return type:
Note
If the population is not set, the property will return 1 This is done to prevent errors when the population size is not an available attribute in a custom optimizer class.
- _reset(data)
Reset the optimizer to its initial state
- property _seed: int
Property to return the seed of the optimizer
- Returns:
Seed of the optimizer
- Return type:
int | None
Note
If the seed is not set, the property will return None This is done to prevent errors when the seed is not an available attribute in a custom optimizer class.
- _set_algorithm()[source]
Method that can be implemented to set the optimization algorithm. Whenever the reset method is called, this method will be called to reset the algorithm to its initial state.
- _set_data(data)
Set the data attribute to the given data
- update_step(data_generator)
- Update step of the optimizer. Needs to be implemented
by the child class
- Parameters:
data_generator (DataGenerator) – data generator object to calculate the objective value
- Returns:
ExperimentData object containing the new samples
- Return type:
ExperimentData
- Raises:
NotImplementedError – Raises when the method is not implemented by the child class
Note
You can access the data attribute of the optimizer to get the available data points. The data attribute is an f3dasm.ExperimentData object.