linopy.constraints.Constraints#
- class linopy.constraints.Constraints(data, model, _label_position_index=None)#
A constraint container used for storing multiple constraint arrays.
- __init__(data, model, _label_position_index=None)#
Methods
__init__(data, model[, _label_position_index])add(constraint)Add a constraint to the constraints constrainer.
format_labels(values[, display_max_terms])Get a string representation of a selection of constraint labels.
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()print_labels(values[, display_max_terms])Print a selection of labels of the constraints.
remove(name)Remove constraint name from the constraints.
reset_dual()Reset the stored solution of variables.
sanitize_infinities()Replace infinite values in the constraints with a large value.
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.
coeffsGet the coefficients of all constraints.
dataset_attrsdataset_namesdualGet 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.
labelsGet the labels of all constraints.
nconsGet the number all constraints effectively used by the model.
rhsGet the right-hand-side constants of all constraints.
signGet the signs of all constraints.
varsGet the variables of all constraints.
datamodel