scenarios.Alternative
Represents an alternative in the MIKE+ model.
Usage
scenarios.Alternative(
scenario_manager,
net_alternative,
)An alternative represents a specific configuration of a model component. Alternatives form a hierarchical tree structure with parent-child relationships.
Attributes
id: int-
Unique identifier for the alternative
name: str-
Name of the alternative
group: AlternativeGroup-
The group this alternative belongs to
parent: Alternative or None-
Parent alternative (None if base alternative)
children: list[Alternative]-
Child alternatives derived from this one
is_active: bool-
Whether this alternative is part of the active scenario
is_base: bool-
Whether this is the base alternative for its group
comment: str-
User comment attached to this alternative
scenarios: list[Scenario]- Scenarios that use this alternative
Examples
>>> alt = db.alternative_groups["CS Network data"].active
>>> print(f"Active network: {alt.name}")
>>> print(f"Parent: {alt.parent.name if alt.parent else 'None'}")
>>> print(f"Child count: {len(alt.children)}")Attributes
| Name | Description |
|---|---|
| children | Child alternatives derived from this alternative. |
| comment | Alternative’s comment. |
| group | Alternative group this alternative belongs to. |
| id | Alternative’s unique identifier. |
| is_active | Whether this alternative is part of the active scenario. |
| is_base | Whether this alternative is the base alternative for its group. |
| name | Alternative’s name. |
| parent | Parent alternative (None if this is the base alternative). |
| scenarios | Scenarios that use this alternative. |
children
Child alternatives derived from this alternative.
children: list[Alternative]
comment
Alternative’s comment.
comment: str
group
Alternative group this alternative belongs to.
group: AlternativeGroup
id
Alternative’s unique identifier.
id: int
is_active
Whether this alternative is part of the active scenario.
is_active: bool
is_base
Whether this alternative is the base alternative for its group.
is_base: bool
name
Alternative’s name.
name: str
Raises
ValueError- If the alternative name could not be changed
parent
Parent alternative (None if this is the base alternative).
parent: Alternative | None
scenarios
Scenarios that use this alternative.
scenarios: list[Scenario]
Methods
| Name | Description |
|---|---|
| __eq__() | Check if two alternatives are equal. |
| __init__() | Alternative constructor. |
| __repr__() | Return a string representation of the alternative. |
__eq__()
Check if two alternatives are equal.
Usage
__eq__(other)__init__()
Alternative constructor.
Usage
__init__(scenario_manager, net_alternative)Parameters
scenario_manager: IScenarioManager-
The underlying .NET scenario manager object
net_alternative: IAlternative- The .NET IAlternative object
__repr__()
Return a string representation of the alternative.
Usage
__repr__()