API reference


Variable([name, lb, ub, domain]) A variable to build expressions with.
VariableCollection([name]) A lazy collection of Variable instances.
Domain Domain of a variable.
namespace(name) Prefix variable names.


Operation An operation on some arguments.
Add Addition operator.
Sub Subtraction operator.
Mul Subtraction operator.
Sum A sum of items.
dot(a, b) Make expression for the scalar product of two vectors.
Relation Base class for binary relations.
Less The relation “less than”.
LessEqual The relation “less than or equal to”.
Eq The relation “equals”.

Constraints and optimization

get_solver([engine, options]) Get a solver object.
Problem() An optimization problem.
Maximize(expr) A maximization objective.
Minimize(expr) A minimization objective.
Constraint(expr[, desc, origin]) An equality or inequality constraint.
SOS1(variables, **kwargs) Special ordered set, type 1
SOS2(variables, **kwargs) Special ordered set, type 2
piecewise_affine(points[, name]) Create a piecewise affine expression and constraints.
piecewise_affine_constraints(variables[, ...]) Constrains for a piecewise affine expression.


Part([name]) A part of a model.
Node([name]) A node with balance constraints.
FlowNetwork(resource[, name]) Manages flows between nodes.
Cluster(*parts[, resource, name]) A node containing other nodes, fully connected.
Storage(resource[, capacity, maxchange, name]) Simple storage model.
ConstraintCollection(owner) Generates constraints from functions.
MyopicDispatchModel([t0, horizon, step, ...]) docstring for MyopicDispatchModel


get_list(func, indices) Get a list of function values at indices.
get_series(func, indices, **kwargs) Get a pandas Series of function values at indices.


ConstraintError(*args[, constraint]) Raised when there is something wrong with a Constraint.
NoValueError Raised when a variable or expression has no value.
SolverError A generic exception raised by a solver instance.
InsanityError Raised when a sanity check fails.