linopy.variables.Variables#
- class linopy.variables.Variables(data, model, _label_position_index=None)#
A variables container used for storing multiple variable arrays.
- __init__(data, model, _label_position_index=None)#
Methods
__init__(data, model[, _label_position_index])add(variable)Add a variable to the variables container.
fix([value, decimals, overwrite])Fix all variables in this container to their solution or a scalar value.
format_labels(values)Get a string representation of a selection of variable labels.
get_blockmap([dtype])Get a one-dimensional array mapping the variables to blocks.
get_label_position(values)Get tuple of name and coordinate for variable labels.
get_label_position_with_index(label)Get name, coordinate, and raw numpy index for a single variable label.
get_label_range(name)Get starting and ending label for a variable.
get_name_by_label(label)Get the variable name of the variable containing the passed label.
get_solver_attribute(attr)Get an attribute from the solver model.
items()print_labels(values)Print a selection of labels of the variables.
relax()Relax integrality of all integer/binary variables in this container.
remove(name)Remove variable name from the variables.
reset_solution()Reset the stored solution of variables.
set_blocks(blocks)Get a dataset of same shape as variables.labels indicating the blocks.
unfix()Unfix all variables in this container.
unrelax()Restore integrality of all previously relaxed variables in this container.
Attributes
attrsGet the attributes of all variables.
Get all binary variables.
Get all continuous variables.
coordsGet the coordinates of all variables.
dataset_attrsdataset_namesfixedGet all currently fixed variables.
Convert all variables to a single pandas Dataframe.
indexesGet the indexes of all variables.
Get all integers variables.
labelsGet the labels of all variables.
lowerGet the lower bounds of all variables.
nvarsGet the number all variables effectively used by the model.
relaxedGet all currently relaxed variables.
semi_continuousGet all semi-continuous variables.
sizesGet the sizes of all variables.
solutionGet the solution of variables.
sosGet all variables involved in an sos constraint.
upperGet the upper bounds of all variables.
datamodel