Additive#

class eclypse.graph.assets.additive.Additive[source]#

Bases: Asset

AdditiveAsset represents a numeric asset where the aggregation is additive.

Methods

__init__(lower_bound, upper_bound[, ...])

Create a new Additive asset.

aggregate(*assets)

Aggregate the assets into a single asset via summation.

is_consistent(asset)

Check if the asset belongs to the interval [lower_bound, upper_bound].

satisfies(asset, constraint)

Check asset contains constraint.

__init__(lower_bound, upper_bound, init_fn_or_value=None, functional=True)[source]#

Create a new Additive asset.

Parameters:
  • lower_bound (float) – The lower bound of the asset.

  • upper_bound (float) – The upper bound of the asset.

  • init_fn_or_value (PrimitiveType | AssetSpace | Callable[[], Any] | None) – The function to initialize the asset. It can be a primitive type, a callable with no arguments or an AssetSpace object. If it is not provided, the asset will be initialized with the lower bound. Defaults to None.

  • functional (bool, optional) – If True, the asset is functional. Defaults to True.

Raises:

ValueError – If $lower_bound > upper_bound$.

aggregate(*assets)[source]#

Aggregate the assets into a single asset via summation.

Parameters:

assets (Iterable[float]) – The assets to aggregate.

Returns:

The aggregated asset.

Return type:

float

satisfies(asset, constraint)[source]#

Check asset contains constraint.

In an additive asset, the higher value contains the lower value.

Parameters:
  • asset (float) – The “container” asset.

  • constraint (float) – The “contained” asset.

Returns:

True if asset >= constraint, False otherwise.

Return type:

bool

is_consistent(asset)[source]#

Check if the asset belongs to the interval [lower_bound, upper_bound].

Parameters:

asset (float) – The asset to be checked.

Returns:

True if lower_bound <= asset <= upper_bound, False otherwise.

Return type:

bool