Skip to content

flixopt.elements

This module contains the basic elements of the flixopt framework.

Attributes

Classes

Component

Component(label: str, inputs: list[Flow] | None = None, outputs: list[Flow] | None = None, status_parameters: StatusParameters | None = None, prevent_simultaneous_flows: list[Flow] | None = None, meta_data: dict | None = None, color: str | None = None)

Bases: Element

Base class for all system components that transform, convert, or process flows.

Components are the active elements in energy systems that define how input and output Flows interact with each other. They represent equipment, processes, or logical operations that transform energy or materials between different states, carriers, or locations.

Components serve as connection points between Buses through their associated Flows, enabling the modeling of complex energy system topologies and operational constraints.

Parameters:

Name Type Description Default
label str

The label of the Element. Used to identify it in the FlowSystem.

required
inputs list[Flow] | None

list of input Flows feeding into the component. These represent energy/material consumption by the component.

None
outputs list[Flow] | None

list of output Flows leaving the component. These represent energy/material production by the component.

None
status_parameters StatusParameters | None

Defines binary operation constraints and costs when the component has discrete active/inactive states. Creates binary variables for all connected Flows. For better performance, prefer defining StatusParameters on individual Flows when possible.

None
prevent_simultaneous_flows list[Flow] | None

list of Flows that cannot be active simultaneously. Creates binary variables to enforce mutual exclusivity. Use sparingly as it increases computational complexity.

None
meta_data dict | None

Used to store additional information. Not used internally but saved in results. Only use Python native types.

None
Note

Component operational state is determined by its connected Flows: - Component is "active" if ANY of its Flows is active (flow_rate > 0) - Component is "inactive" only when ALL Flows are inactive (flow_rate = 0)

Binary variables and constraints: - status_parameters creates binary variables for ALL connected Flows - prevent_simultaneous_flows creates binary variables for specified Flows - For better computational performance, prefer Flow-level StatusParameters

Component is an abstract base class. In practice, use specialized subclasses: - LinearConverter: Linear input/output relationships - Storage: Temporal energy/material storage - Transmission: Transport between locations - Source/Sink: System boundaries

Attributes

prefix property
prefix: str

The prefix used for naming transformed data (e.g., 'Boiler(Q_th)|status_parameters').

flow_system property
flow_system: FlowSystem

Access the FlowSystem this interface is linked to.

Returns:

Type Description
FlowSystem

The FlowSystem instance this interface belongs to.

Raises:

Type Description
RuntimeError

If interface has not been linked to a FlowSystem yet.

Note

For Elements, this is set during add_elements(). For parameter classes, this is set recursively when the parent Element is registered.

solution property
solution: Dataset

Solution data for this element's variables.

Returns a view into FlowSystem.solution containing only this element's variables.

Raises:

Type Description
ValueError

If no solution is available (optimization not run or not solved).

Functions

link_to_flow_system(flow_system, prefix: str = '') -> None

Propagate flow_system reference to nested Interface objects and flows.

Elements use their label_full as prefix by default, ignoring the passed prefix.

to_dataset
to_dataset() -> xr.Dataset

Convert the object to an xarray Dataset representation. All DataArrays become dataset variables, everything else goes to attrs.

Its recommended to only call this method on Interfaces with all numeric data stored as xr.DataArrays. Interfaces inside a FlowSystem are automatically converted this form after connecting and transforming the FlowSystem.

Returns:

Type Description
Dataset

xr.Dataset: Dataset containing all DataArrays with basic objects only in attributes

Raises:

Type Description
ValueError

If serialization fails due to naming conflicts or invalid data

to_netcdf
to_netcdf(path: str | Path, compression: int = 5, overwrite: bool = False)

Save the object to a NetCDF file.

Parameters:

Name Type Description Default
path str | Path

Path to save the NetCDF file. Parent directories are created if they don't exist.

required
compression int

Compression level (0-9)

5
overwrite bool

If True, overwrite existing file. If False, raise error if file exists.

False

Raises:

Type Description
FileExistsError

If overwrite=False and file already exists.

ValueError

If serialization fails

IOError

If file cannot be written

from_dataset classmethod
from_dataset(ds: Dataset) -> Interface

Create an instance from an xarray Dataset.

Parameters:

Name Type Description Default
ds Dataset

Dataset containing the object data

required

Returns:

Type Description
Interface

Interface instance

Raises:

Type Description
ValueError

If dataset format is invalid or class mismatch

from_netcdf classmethod
from_netcdf(path: str | Path) -> Interface

Load an instance from a NetCDF file.

Parameters:

Name Type Description Default
path str | Path

Path to the NetCDF file

required

Returns:

Type Description
Interface

Interface instance

Raises:

Type Description
IOError

If file cannot be read

ValueError

If file format is invalid

get_structure
get_structure(clean: bool = False, stats: bool = False) -> dict

Get object structure as a dictionary.

Parameters:

Name Type Description Default
clean bool

If True, remove None and empty dicts and lists.

False
stats bool

If True, replace DataArray references with statistics

False

Returns:

Type Description
dict

Dictionary representation of the object structure

to_json
to_json(path: str | Path)

Save the object to a JSON file. This is meant for documentation and comparison, not for reloading.

Parameters:

Name Type Description Default
path str | Path

The path to the JSON file.

required

Raises:

Type Description
IOError

If file cannot be written

copy
copy() -> Interface

Create a copy of the Interface object.

Uses the existing serialization infrastructure to ensure proper copying of all DataArrays and nested objects.

Returns:

Type Description
Interface

A new instance of the same class with copied data.

Bus

Bus(label: str, carrier: str | None = None, imbalance_penalty_per_flow_hour: Numeric_TPS | None = None, meta_data: dict | None = None, **kwargs)

Bases: Element

Buses represent nodal balances between flow rates, serving as connection points.

A Bus enforces energy or material balance constraints where the sum of all incoming flows must equal the sum of all outgoing flows at each time step. Buses represent physical or logical connection points for energy carriers (electricity, heat, gas) or material flows between different Components.

Mathematical Formulation

See https://flixopt.github.io/flixopt/latest/user-guide/mathematical-notation/elements/Bus/

Parameters:

Name Type Description Default
label str

The label of the Element. Used to identify it in the FlowSystem.

required
carrier str | None

Name of the energy/material carrier type (e.g., 'electricity', 'heat', 'gas'). Carriers are registered via flow_system.add_carrier() or available as predefined defaults in CONFIG.Carriers. Used for automatic color assignment in plots.

None
imbalance_penalty_per_flow_hour Numeric_TPS | None

Penalty costs for bus balance violations. When None (default), no imbalance is allowed (hard constraint). When set to a value > 0, allows bus imbalances at penalty cost.

None
meta_data dict | None

Used to store additional information. Not used internally but saved in results. Only use Python native types.

None

Examples:

Using predefined carrier names:

electricity_bus = Bus(label='main_grid', carrier='electricity')
heat_bus = Bus(label='district_heating', carrier='heat')

Registering custom carriers on FlowSystem:

import flixopt as fx

fs = fx.FlowSystem(timesteps)
fs.add_carrier(fx.Carrier('biogas', '#228B22', 'kW'))
biogas_bus = fx.Bus(label='biogas_network', carrier='biogas')

Heat network with penalty for imbalances:

heat_bus = Bus(
    label='district_heating',
    carrier='heat',
    imbalance_penalty_per_flow_hour=1000,
)
Note

The bus balance equation enforced is: Σ(inflows) + virtual_supply = Σ(outflows) + virtual_demand

When imbalance_penalty_per_flow_hour is None, virtual_supply and virtual_demand are forced to zero. When a penalty cost is specified, the optimization can choose to violate the balance if economically beneficial, paying the penalty. The penalty is added to the objective directly.

Empty inputs and outputs lists are initialized and populated automatically by the FlowSystem during system setup.

Attributes

prefix property
prefix: str

The prefix used for naming transformed data (e.g., 'Boiler(Q_th)|status_parameters').

flow_system property
flow_system: FlowSystem

Access the FlowSystem this interface is linked to.

Returns:

Type Description
FlowSystem

The FlowSystem instance this interface belongs to.

Raises:

Type Description
RuntimeError

If interface has not been linked to a FlowSystem yet.

Note

For Elements, this is set during add_elements(). For parameter classes, this is set recursively when the parent Element is registered.

solution property
solution: Dataset

Solution data for this element's variables.

Returns a view into FlowSystem.solution containing only this element's variables.

Raises:

Type Description
ValueError

If no solution is available (optimization not run or not solved).

Functions

link_to_flow_system(flow_system, prefix: str = '') -> None

Propagate flow_system reference to nested flows.

Elements use their label_full as prefix by default, ignoring the passed prefix.

to_dataset
to_dataset() -> xr.Dataset

Convert the object to an xarray Dataset representation. All DataArrays become dataset variables, everything else goes to attrs.

Its recommended to only call this method on Interfaces with all numeric data stored as xr.DataArrays. Interfaces inside a FlowSystem are automatically converted this form after connecting and transforming the FlowSystem.

Returns:

Type Description
Dataset

xr.Dataset: Dataset containing all DataArrays with basic objects only in attributes

Raises:

Type Description
ValueError

If serialization fails due to naming conflicts or invalid data

to_netcdf
to_netcdf(path: str | Path, compression: int = 5, overwrite: bool = False)

Save the object to a NetCDF file.

Parameters:

Name Type Description Default
path str | Path

Path to save the NetCDF file. Parent directories are created if they don't exist.

required
compression int

Compression level (0-9)

5
overwrite bool

If True, overwrite existing file. If False, raise error if file exists.

False

Raises:

Type Description
FileExistsError

If overwrite=False and file already exists.

ValueError

If serialization fails

IOError

If file cannot be written

from_dataset classmethod
from_dataset(ds: Dataset) -> Interface

Create an instance from an xarray Dataset.

Parameters:

Name Type Description Default
ds Dataset

Dataset containing the object data

required

Returns:

Type Description
Interface

Interface instance

Raises:

Type Description
ValueError

If dataset format is invalid or class mismatch

from_netcdf classmethod
from_netcdf(path: str | Path) -> Interface

Load an instance from a NetCDF file.

Parameters:

Name Type Description Default
path str | Path

Path to the NetCDF file

required

Returns:

Type Description
Interface

Interface instance

Raises:

Type Description
IOError

If file cannot be read

ValueError

If file format is invalid

get_structure
get_structure(clean: bool = False, stats: bool = False) -> dict

Get object structure as a dictionary.

Parameters:

Name Type Description Default
clean bool

If True, remove None and empty dicts and lists.

False
stats bool

If True, replace DataArray references with statistics

False

Returns:

Type Description
dict

Dictionary representation of the object structure

to_json
to_json(path: str | Path)

Save the object to a JSON file. This is meant for documentation and comparison, not for reloading.

Parameters:

Name Type Description Default
path str | Path

The path to the JSON file.

required

Raises:

Type Description
IOError

If file cannot be written

copy
copy() -> Interface

Create a copy of the Interface object.

Uses the existing serialization infrastructure to ensure proper copying of all DataArrays and nested objects.

Returns:

Type Description
Interface

A new instance of the same class with copied data.

Connection

Connection()

This class is not yet implemented!

Functions

Flow

Flow(label: str, bus: str, size: Numeric_PS | InvestParameters | None = None, fixed_relative_profile: Numeric_TPS | None = None, relative_minimum: Numeric_TPS = 0, relative_maximum: Numeric_TPS = 1, effects_per_flow_hour: Effect_TPS | Numeric_TPS | None = None, status_parameters: StatusParameters | None = None, flow_hours_max: Numeric_PS | None = None, flow_hours_min: Numeric_PS | None = None, flow_hours_max_over_periods: Numeric_S | None = None, flow_hours_min_over_periods: Numeric_S | None = None, load_factor_min: Numeric_PS | None = None, load_factor_max: Numeric_PS | None = None, previous_flow_rate: Scalar | list[Scalar] | None = None, meta_data: dict | None = None)

Bases: Element

Define a directed flow of energy or material between bus and component.

A Flow represents the transfer of energy (electricity, heat, fuel) or material between a Bus and a Component in a specific direction. The flow rate is the primary optimization variable, with constraints and costs defined through various parameters. Flows can have fixed or variable sizes, operational constraints, and complex on/inactive behavior.

Key Concepts

Flow Rate: The instantaneous rate of energy/material transfer (optimization variable) [kW, m³/h, kg/h] Flow Hours: Amount of energy/material transferred per timestep. [kWh, m³, kg] Flow Size: The maximum capacity or nominal rating of the flow [kW, m³/h, kg/h] Relative Bounds: Flow rate limits expressed as fractions of flow size

Integration with Parameter Classes
  • InvestParameters: Used for size when flow Size is an investment decision
  • StatusParameters: Used for status_parameters when flow has discrete states
Mathematical Formulation

See https://flixopt.github.io/flixopt/latest/user-guide/mathematical-notation/elements/Flow/

Parameters:

Name Type Description Default
label str

Unique flow identifier within its component.

required
bus str

Bus label this flow connects to.

required
size Numeric_PS | InvestParameters | None

Flow capacity. Scalar, InvestParameters, or None (unbounded).

None
relative_minimum Numeric_TPS

Minimum flow rate as fraction of size (0-1). Default: 0.

0
relative_maximum Numeric_TPS

Maximum flow rate as fraction of size. Default: 1.

1
load_factor_min Numeric_PS | None

Minimum average utilization (0-1). Default: 0.

None
load_factor_max Numeric_PS | None

Maximum average utilization (0-1). Default: 1.

None
effects_per_flow_hour Effect_TPS | Numeric_TPS | None

Operational costs/impacts per flow-hour. Dict mapping effect names to values (e.g., {'cost': 45, 'CO2': 0.8}).

None
status_parameters StatusParameters | None

Binary operation constraints (StatusParameters). Default: None.

None
flow_hours_max Numeric_PS | None

Maximum cumulative flow-hours per period. Alternative to load_factor_max.

None
flow_hours_min Numeric_PS | None

Minimum cumulative flow-hours per period. Alternative to load_factor_min.

None
flow_hours_max_over_periods Numeric_S | None

Maximum weighted sum of flow-hours across ALL periods. Weighted by FlowSystem period weights.

None
flow_hours_min_over_periods Numeric_S | None

Minimum weighted sum of flow-hours across ALL periods. Weighted by FlowSystem period weights.

None
fixed_relative_profile Numeric_TPS | None

Predetermined pattern as fraction of size. Flow rate = size × fixed_relative_profile(t).

None
previous_flow_rate Scalar | list[Scalar] | None

Initial flow state for active/inactive status at model start. Default: None (inactive).

None
meta_data dict | None

Additional info stored in results. Python native types only.

None

Examples:

Basic power flow with fixed capacity:

generator_output = Flow(
    label='electricity_out',
    bus='electricity_grid',
    size=100,  # 100 MW capacity
    relative_minimum=0.4,  # Cannot operate below 40 MW
    effects_per_flow_hour={'fuel_cost': 45, 'co2_emissions': 0.8},
)

Investment decision for battery capacity:

battery_flow = Flow(
    label='electricity_storage',
    bus='electricity_grid',
    size=InvestParameters(
        minimum_size=10,  # Minimum 10 MWh
        maximum_size=100,  # Maximum 100 MWh
        specific_effects={'cost': 150_000},  # €150k/MWh annualized
    ),
)

Heat pump with startup costs and minimum run times:

heat_pump = Flow(
    label='heat_output',
    bus='heating_network',
    size=50,  # 50 kW thermal
    relative_minimum=0.3,  # Minimum 15 kW output when active
    effects_per_flow_hour={'electricity_cost': 25, 'maintenance': 2},
    status_parameters=StatusParameters(
        effects_per_startup={'startup_cost': 100, 'wear': 0.1},
        min_uptime=2,  # Must run at least 2 hours
        min_downtime=1,  # Must stay inactive at least 1 hour
        startup_limit=200,  # Maximum 200 starts per period
    ),
)

Fixed renewable generation profile:

solar_generation = Flow(
    label='solar_power',
    bus='electricity_grid',
    size=25,  # 25 MW installed capacity
    fixed_relative_profile=np.array([0, 0.1, 0.4, 0.8, 0.9, 0.7, 0.3, 0.1, 0]),
    effects_per_flow_hour={'maintenance_costs': 5},  # €5/MWh maintenance
)

Industrial process with annual utilization limits:

production_line = Flow(
    label='product_output',
    bus='product_market',
    size=1000,  # 1000 units/hour capacity
    load_factor_min=0.6,  # Must achieve 60% annual utilization
    load_factor_max=0.85,  # Cannot exceed 85% for maintenance
    effects_per_flow_hour={'variable_cost': 12, 'quality_control': 0.5},
)
Design Considerations

Size vs Load Factors: Use flow_hours_min/max for absolute limits per period, load_factor_min/max for utilization-based constraints, or flow_hours_min/max_over_periods for limits across all periods.

Relative Bounds: Set relative_minimum > 0 only when equipment cannot operate below that level. Use status_parameters for discrete active/inactive behavior.

Fixed Profiles: Use fixed_relative_profile for known exact patterns, relative_maximum for upper bounds on optimization variables.

Notes
  • size=None means unbounded (no capacity constraint)
  • size must be set when using status_parameters or fixed_relative_profile
  • list inputs for previous_flow_rate are converted to NumPy arrays
  • Flow direction is determined by component input/output designation
Deprecated

Passing Bus objects to bus parameter. Use bus label strings instead.

Attributes

prefix property
prefix: str

The prefix used for naming transformed data (e.g., 'Boiler(Q_th)|status_parameters').

flow_system property
flow_system: FlowSystem

Access the FlowSystem this interface is linked to.

Returns:

Type Description
FlowSystem

The FlowSystem instance this interface belongs to.

Raises:

Type Description
RuntimeError

If interface has not been linked to a FlowSystem yet.

Note

For Elements, this is set during add_elements(). For parameter classes, this is set recursively when the parent Element is registered.

solution property
solution: Dataset

Solution data for this element's variables.

Returns a view into FlowSystem.solution containing only this element's variables.

Raises:

Type Description
ValueError

If no solution is available (optimization not run or not solved).

Functions

link_to_flow_system(flow_system, prefix: str = '') -> None

Propagate flow_system reference to nested Interface objects.

Elements use their label_full as prefix by default, ignoring the passed prefix.

to_dataset
to_dataset() -> xr.Dataset

Convert the object to an xarray Dataset representation. All DataArrays become dataset variables, everything else goes to attrs.

Its recommended to only call this method on Interfaces with all numeric data stored as xr.DataArrays. Interfaces inside a FlowSystem are automatically converted this form after connecting and transforming the FlowSystem.

Returns:

Type Description
Dataset

xr.Dataset: Dataset containing all DataArrays with basic objects only in attributes

Raises:

Type Description
ValueError

If serialization fails due to naming conflicts or invalid data

to_netcdf
to_netcdf(path: str | Path, compression: int = 5, overwrite: bool = False)

Save the object to a NetCDF file.

Parameters:

Name Type Description Default
path str | Path

Path to save the NetCDF file. Parent directories are created if they don't exist.

required
compression int

Compression level (0-9)

5
overwrite bool

If True, overwrite existing file. If False, raise error if file exists.

False

Raises:

Type Description
FileExistsError

If overwrite=False and file already exists.

ValueError

If serialization fails

IOError

If file cannot be written

from_dataset classmethod
from_dataset(ds: Dataset) -> Interface

Create an instance from an xarray Dataset.

Parameters:

Name Type Description Default
ds Dataset

Dataset containing the object data

required

Returns:

Type Description
Interface

Interface instance

Raises:

Type Description
ValueError

If dataset format is invalid or class mismatch

from_netcdf classmethod
from_netcdf(path: str | Path) -> Interface

Load an instance from a NetCDF file.

Parameters:

Name Type Description Default
path str | Path

Path to the NetCDF file

required

Returns:

Type Description
Interface

Interface instance

Raises:

Type Description
IOError

If file cannot be read

ValueError

If file format is invalid

get_structure
get_structure(clean: bool = False, stats: bool = False) -> dict

Get object structure as a dictionary.

Parameters:

Name Type Description Default
clean bool

If True, remove None and empty dicts and lists.

False
stats bool

If True, replace DataArray references with statistics

False

Returns:

Type Description
dict

Dictionary representation of the object structure

to_json
to_json(path: str | Path)

Save the object to a JSON file. This is meant for documentation and comparison, not for reloading.

Parameters:

Name Type Description Default
path str | Path

The path to the JSON file.

required

Raises:

Type Description
IOError

If file cannot be written

copy
copy() -> Interface

Create a copy of the Interface object.

Uses the existing serialization infrastructure to ensure proper copying of all DataArrays and nested objects.

Returns:

Type Description
Interface

A new instance of the same class with copied data.

FlowModel

FlowModel(model: FlowSystemModel, element: Flow)

Bases: ElementModel

Mathematical model implementation for Flow elements.

Creates optimization variables and constraints for flow rate bounds, flow-hours tracking, and load factors.

Mathematical Formulation

See https://flixopt.github.io/flixopt/latest/user-guide/mathematical-notation/elements/Flow/

Attributes

flow_rate property
flow_rate: Variable

Main flow rate variable

total_flow_hours property
total_flow_hours: Variable

Total flow hours variable

absolute_flow_rate_bounds property
absolute_flow_rate_bounds: tuple[DataArray, DataArray]

Returns the absolute bounds the flow_rate can reach. Further constraining might be needed

status property
status: StatusModel | None

Status feature

investment property
investment: InvestmentModel | None

Investment feature

previous_status property
previous_status: DataArray | None

Previous status of the flow rate

all_submodels property
all_submodels: list[Submodel]

Get all submodels including nested ones recursively.

variables_direct property
variables_direct: Variables

Variables of the model, excluding those of sub-models

constraints_direct property
constraints_direct: Constraints

Constraints of the model, excluding those of sub-models

constraints property
constraints: Constraints

All constraints of the model, including those of all sub-models

variables property
variables: Variables

All variables of the model, including those of all sub-models

Functions

add_submodels
add_submodels(submodel: Submodel, short_name: str = None) -> Submodel

Register a sub-model with the model

add_variables
add_variables(short_name: str = None, **kwargs) -> linopy.Variable

Create and register a variable in one step

add_constraints
add_constraints(expression, short_name: str = None, **kwargs) -> linopy.Constraint

Create and register a constraint in one step

register_variable
register_variable(variable: Variable, short_name: str = None) -> linopy.Variable

Register a variable with the model

register_constraint
register_constraint(constraint: Constraint, short_name: str = None) -> linopy.Constraint

Register a constraint with the model

get
get(name: str, default=None)

Get variable by short name, returning default if not found

BusModel

BusModel(model: FlowSystemModel, element: Bus)

Bases: ElementModel

Mathematical model implementation for Bus elements.

Creates optimization variables and constraints for nodal balance equations, and optional excess/deficit variables with penalty costs.

Mathematical Formulation

See https://flixopt.github.io/flixopt/latest/user-guide/mathematical-notation/elements/Bus/

Attributes

all_submodels property
all_submodels: list[Submodel]

Get all submodels including nested ones recursively.

variables_direct property
variables_direct: Variables

Variables of the model, excluding those of sub-models

constraints_direct property
constraints_direct: Constraints

Constraints of the model, excluding those of sub-models

constraints property
constraints: Constraints

All constraints of the model, including those of all sub-models

variables property
variables: Variables

All variables of the model, including those of all sub-models

Functions

add_submodels
add_submodels(submodel: Submodel, short_name: str = None) -> Submodel

Register a sub-model with the model

add_variables
add_variables(short_name: str = None, **kwargs) -> linopy.Variable

Create and register a variable in one step

add_constraints
add_constraints(expression, short_name: str = None, **kwargs) -> linopy.Constraint

Create and register a constraint in one step

register_variable
register_variable(variable: Variable, short_name: str = None) -> linopy.Variable

Register a variable with the model

register_constraint
register_constraint(constraint: Constraint, short_name: str = None) -> linopy.Constraint

Register a constraint with the model

get
get(name: str, default=None)

Get variable by short name, returning default if not found

ComponentModel

ComponentModel(model: FlowSystemModel, element: Component)

Bases: ElementModel

Attributes

previous_status property
previous_status: DataArray | None

Previous status of the component, derived from its flows

all_submodels property
all_submodels: list[Submodel]

Get all submodels including nested ones recursively.

variables_direct property
variables_direct: Variables

Variables of the model, excluding those of sub-models

constraints_direct property
constraints_direct: Constraints

Constraints of the model, excluding those of sub-models

constraints property
constraints: Constraints

All constraints of the model, including those of all sub-models

variables property
variables: Variables

All variables of the model, including those of all sub-models

Functions

add_submodels
add_submodels(submodel: Submodel, short_name: str = None) -> Submodel

Register a sub-model with the model

add_variables
add_variables(short_name: str = None, **kwargs) -> linopy.Variable

Create and register a variable in one step

add_constraints
add_constraints(expression, short_name: str = None, **kwargs) -> linopy.Constraint

Create and register a constraint in one step

register_variable
register_variable(variable: Variable, short_name: str = None) -> linopy.Variable

Register a variable with the model

register_constraint
register_constraint(constraint: Constraint, short_name: str = None) -> linopy.Constraint

Register a constraint with the model

get
get(name: str, default=None)

Get variable by short name, returning default if not found

Functions