linopy.variables.Variable.sum

Contents

linopy.variables.Variable.sum#

Variable.sum(dims=None)#

Sum the variables over all or a subset of dimensions.

This stack all terms of the dimensions, that are summed over, together. The function works exactly in the same way as LinearExpression.sum().

Parameters:

dims (str/list, optional) – Dimension(s) to sum over. The default is None which results in all dimensions.

Returns:

linopy.LinearExpression – Summed expression.