linopy.constraints.Constraint#
- class linopy.constraints.Constraint(data, model, name='')#
Projection to a single constraint in a model.
The Constraint class is a subclass of xr.DataArray hence most xarray functions can be applied to it.
- __init__(data, model, name='')#
Initialize the Constraint.
- Parameters:
labels (
xarray.DataArray
) – labels of the constraint.model (
linopy.Model
) – Underlying model.name (
str
) – Name of the constraint.
Methods
__init__
(data, model[, name])Initialize the Constraint.
from_rule
(model, rule, coords)Create a constraint from a rule and a set of coordinates.
isel
([indexers, drop, missing_dims])Wrapper for the xarray <function Dataset.isel at 0x7fbd830bc5e0> function for linopy.Constraint
print
([display_max_rows, display_max_terms])Print the linear expression.
sel
([indexers, method, tolerance, drop])Wrapper for the xarray <function Dataset.sel at 0x7fbd830bc700> function for linopy.Constraint
Attributes
attrs
Get the left-hand-side coefficients of the constraint.
coord_dims
coords
data
Get the underlying DataArray.
dims
dual
Get the dual values of the constraint.
Convert the constraint to a pandas DataFrame.
indexes
is_assigned
labels
Get the labels of the constraint.
Get the left-hand-side linear expression of the constraint.
mask
Get the mask of the constraint.
model
Get the model of the constraint.
name
Return the name of the constraint.
ndim
nterm
range
Return the range of the constraint.
Get the right hand side constants of the constraint.
shape
Get the signs of the constraint.
size
sizes
term_dim
Return the term dimension of the constraint.
type
Get the type of the constraint.
values
Get the left-hand-side variables of the constraint.