Types
Additional types used in the LNS framework.
ActiveConfig
¶
Bases: TypedDict
TypedDict for active configuration.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Name of the active configuration. |
project_operators |
list[ProjectOperator]
|
List of project operators with their signatures. |
destroy_operators |
list[DestroyOperator]
|
List of destroy operators with their percentages or numbers. |
prioritize_operators |
list[PrioritizeOperator]
|
List of prioritize operators with their values and modifiers. |
config_repr |
str
|
String representation of the active configuration. |
ConfigCatalog
¶
Bases: TypedDict
TypedDict for configuration catalog.
Attributes:
| Name | Type | Description |
|---|---|---|
project_operators |
dict[str, ProjectOperator]
|
Project operator names mapped to projected predicate signatures. |
destroy_operators |
dict[str, DestroyOperator]
|
Destroy operator names mapped to destruction parameters. |
prioritize_operators |
dict[str, PrioritizeOperator]
|
Prioritize operator names mapped to heuristic value/modifier pairs. |
configs |
dict[str, dict[str, list[str]]]
|
Config names mapped to selected project/destroy/prioritize operators. |
strategy |
str
|
Name of the adaptive strategy selected for configuration updates. |
DestroyOperator
dataclass
¶
Container for destroy operator specifications. Behaves like a list for iteration, membership, length and assignments. Additional attribute for operator name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the destroy operator. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
_destruction_specs |
list[DestructionSpec]
|
List of destruction specifications. |
append(item: dict[str, Any]) -> None
¶
from_specs(name: str, specs: Iterable[dict[str, Any]]) -> DestroyOperator
classmethod
¶
Create a DestroyOperator instance from a set of destruction specifications.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the destroy operator. |
required |
specs
|
Iterable[dict[str, Any]]
|
Iterable of destruction specifications. |
required |
Returns:
| Type | Description |
|---|---|
DestroyOperator
|
DestroyOperator instance. |
get_all_specs() -> list[DestructionSpec]
¶
Get all destruction specifications.
Returns:
| Type | Description |
|---|---|
list[DestructionSpec]
|
List of all destruction specifications. |
get_first_spec() -> DestructionSpec
¶
Get the first destruction specification.
Returns:
| Type | Description |
|---|---|
DestructionSpec
|
First destruction specification. |
PrioritizeOperator
dataclass
¶
Bases: MutableMapping[PrioritizeKey, Any]
Container for prioritize operator specifications. Behaves like a dict for iteration, membership, length and assignments. Additional attribute for operator name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the prioritize operator. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
_prioritization_spec |
PrioritizeSpec
|
Dictionary with heuristic value and modifier. |
from_spec(name: str, spec: dict[PrioritizeKey, Any]) -> PrioritizeOperator
classmethod
¶
Create a PrioritizeOperator from a prioritization specification.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the prioritize operator. |
required |
spec
|
dict[PrioritizeKey, Any]
|
Prioritization specification. |
required |
Returns:
| Type | Description |
|---|---|
PrioritizeOperator
|
PrioritizeOperator instance. |
get_spec() -> PrioritizeSpec
¶
Get prioritization specification.
Returns:
| Type | Description |
|---|---|
PrioritizeSpec
|
Prioritize specification. |
ProjectOperator
dataclass
¶
Validated container of predicate signatures: (predicate_name, arity). Behaves like a set for iteration, membership, and length. Additional attribute for operator name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the project operator. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
_signatures |
set[PredicateSignature]
|
Set of predicate signatures. |
add(item: tuple[str, int]) -> None
¶
from_signatures(name: str, signatures: Iterable[PredicateSignature]) -> ProjectOperator
classmethod
¶
Create a ProjectOperator instance from a set of predicate signatures.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the project operator. |
required |
signatures
|
Iterable[PredicateSignature]
|
Iterable of predicate signatures. |
required |
Returns:
| Type | Description |
|---|---|
ProjectOperator
|
ProjectOperator instance. |