linopy.variables.Variables

linopy.variables.Variables#

class linopy.variables.Variables(data=<factory>, model=None)#

A variables container used for storing multiple variable arrays.

__init__(data=<factory>, model=None)#

Methods

__init__([data, model])

add(variable)

Add a variable to the variables container.

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_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.

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.

Attributes

attrs

binaries

Get all binary variables.

continuous

Get all continuous variables.

coords

dataset_attrs

dataset_names

dims

flat

Convert all variables to a single pandas Dataframe.

indexes

integers

Get all integers variables.

labels

Get the labels of all variables.

lower

Get the lower bounds of all variables.

model

nvars

Get the number all variables effectively used by the model.

solution

Get the solution of variables.

upper

Get the upper bounds of all variables.

data