Convex#
- class eclypse.graph.assets.convex.Convex[source]#
Bases:
AssetConvexAsset represents a numeric asset where the aggregation is convex.
Methods
__init__(lower_bound, upper_bound[, ...])Create a new Convex asset.
aggregate(*assets)Aggregate the assets into a single asset by taking the minimum value.
flip()Flip the convex asset into a concave asset.
is_consistent(asset)Check if the asset belongs to the interval [lower_bound, upper_bound].
satisfies(asset, constraint)Check if asset contains constraint.
- __init__(lower_bound, upper_bound, init_fn_or_value=None, functional=True)[source]#
Create a new Convex 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 by taking the minimum value.
If no assets are provided, the upper bound is returned.
- Parameters:
assets (Iterable[NumericAsset]) – The assets to aggregate.
- Returns:
The aggregated asset.
- Return type:
NumericAsset
- satisfies(asset, constraint)[source]#
Check if asset contains constraint.
In the ordering of a convex asset, the higher value contains the other.
- Parameters:
asset (NumericAsset) – The “container” asset.
constraint (NumericAsset) – The “contained” asset.
- Returns:
True if asset >= constraint, False otherwise.
- Return type:
bool