linopy.constraints.Constraints#
- class linopy.constraints.Constraints(data=<factory>, model=None)#
A constraint container used for storing multiple constraint arrays.
- __init__(data=<factory>, model=None)#
Methods
__init__
([data, model])add
(constraint)Add a constraint to the constraints constrainer.
get_label_position
(values)Get tuple of name and coordinate for constraint labels.
get_name_by_label
(label)Get the constraint name of the constraint containing the passed label.
items
()iter_ravel
(key[, broadcast_like, ...])Create an generator which iterates over all arrays in key and flattens them.
print_labels
(values[, display_max_terms])Print a selection of labels of the constraints.
ravel
(key[, broadcast_like, ...])Ravel and concate all arrays in key while aligning to broadcast_like.
remove
(name)Remove constraint name from the constraints.
reset_dual
()Reset the stored solution of variables.
Set constraints labels to -1 where all variables in the lhs are missing.
sanitize_zeros
()Filter out terms with zero and close-to-zero coefficient.
set_blocks
(block_map)Get a dataset of same shape as constraints.labels with block values.
to_matrix
([filter_missings])Construct a constraint matrix in sparse format.
Attributes
Coefficient range of the constraint.
coeffs
Get the coefficients of all constraints.
dataset_attrs
dataset_names
dual
Get the dual values of all constraints.
Get the subset of constraints which are purely equalities.
Convert all constraint to a single pandas Dataframe.
Get the subset of constraints which are purely inequalities.
labels
Get the labels of all constraints.
loc
model
ncons
Get the number all constraints effectively used by the model.
rhs
Get the right-hand-side constants of all constraints.
sign
Get the signs of all constraints.
vars
Get the variables of all constraints.
data