fragile.callbacks.time_steps#

Module Contents#

Classes#

TimeStepAPI

The Walkers is a data structure that takes care of all the data involved in making a Swarm evolve.

ConstantDt

The Walkers is a data structure that takes care of all the data involved in making a Swarm evolve.

UniformDt

The Walkers is a data structure that takes care of all the data involved in making a Swarm evolve.

GaussianDt

The Walkers is a data structure that takes care of all the data involved in making a Swarm evolve.

class fragile.callbacks.time_steps.TimeStepAPI(swarm=None, param_dict=None, inputs=None, outputs=None)[source]#

Bases: fragile.core.api_classes.Callback

The Walkers is a data structure that takes care of all the data involved in making a Swarm evolve.

Parameters
  • swarm (Optional[SwarmAPI]) –

  • param_dict (Optional[fragile.core.typing.StateDict]) –

  • inputs (Optional[fragile.core.typing.InputDict]) –

  • outputs (Optional[Tuple[str]]) –

name = time_step#
default_param_dict#
default_outputs#
select(inplace=True, **kwargs)[source]#

Calculate SwarmState containing the data needed to interact with the environment.

Parameters

inplace (bool) –

Return type

Union[None, fragile.core.typing.StateData]

abstract calculate(**kwargs)[source]#
Return type

fragile.core.typing.Tensor

reset(inplace=True, **kwargs)[source]#

Reset the internal state of the SwarmComponent.

Parameters
  • inplace (bool, optional) – Unused. Defaults to True.

  • root_walker (Optional[StateData], optional) – Set the internal state of the SwarmComponent to this value. Defaults to None.

  • states (Optional[StateData], optional) – Set the internal state of the SwarmComponent to this value. Defaults to None.

  • kwargs – Other parameters required to reset the component.

Return type

Union[None, fragile.core.typing.StateData]

before_policy()[source]#
class fragile.callbacks.time_steps.ConstantDt(value, **kwargs)[source]#

Bases: TimeStepAPI

The Walkers is a data structure that takes care of all the data involved in making a Swarm evolve.

Parameters

value (int) –

calculate()[source]#
Return type

fragile.core.typing.Tensor

class fragile.callbacks.time_steps.UniformDt(high, low=1, **kwargs)[source]#

Bases: TimeStepAPI

The Walkers is a data structure that takes care of all the data involved in making a Swarm evolve.

Parameters
  • high (int) –

  • low (int) –

calculate()[source]#
Return type

fragile.core.typing.Tensor

reset(inplace=True, **kwargs)[source]#

Reset the internal state of the SwarmComponent.

Parameters
  • inplace (bool, optional) – Unused. Defaults to True.

  • root_walker (Optional[StateData], optional) – Set the internal state of the SwarmComponent to this value. Defaults to None.

  • states (Optional[StateData], optional) – Set the internal state of the SwarmComponent to this value. Defaults to None.

  • kwargs – Other parameters required to reset the component.

Return type

Union[None, fragile.core.typing.StateData]

class fragile.callbacks.time_steps.GaussianDt(loc, scale, low=1, high=numpy.inf, **kwargs)[source]#

Bases: UniformDt

The Walkers is a data structure that takes care of all the data involved in making a Swarm evolve.

Parameters
calculate()[source]#
Return type

fragile.core.typing.Tensor