Expression

Constructor

Expression([exp, name])

Creates a mathematical expression to represent model components

Auxiliary(base[, prefix, suffix, operator, …])

Represents an auxiliary expression, often as a symbolic attribute

Symbol(name)

Represents a symbolic string, to be evaluated on server-side

General methods

Expression.set_name(self[, name])

Specifies the name of the expression

Expression.set_permanent(self)

Converts a temporary expression into a permanent one

Expression.set_temporary(self)

Converts expression into a temporary expression to enable in-place operations

Expression.get_name(self)

Returns the name of the object

Expression.get_value(self)

Calculates and returns the value of the linear expression

Expression.get_dual(self)

Returns the dual value

Operations

Expression.add(self, other[, sign])

Combines two expressions and produces a new one

Expression.copy(self[, name])

Returns a copy of the Expression object

Expression.mult(self, other)

Multiplies the Expression by a scalar value

Expression.get_member(self, key)

Returns the requested member of the expression

Expression.get_member_dict(self)

Returns an ordered dictionary of elements

Expression.get_member_value(self, key)

Returns coefficient of requested member

Expression.get_constant(self)

Returns the constant term in the expression

Expression.set_member(self, key, ref, val[, op])

Adds a new member or changes an existing member

Expression.set_member_value(self, key, value)

Changes the coefficient of the requested member

Expression.add_to_member_value(self, key, value)

Adds value to the coefficient of the requested member

Expression.mult_member_value(self, key, value)

Multiplies the coefficient of the requested member by the specified value

Expression.copy_member(self, key, exp)

Copies the member of another expression

Expression.delete_member(self, key)

Deletes the requested member from the core dictionary

Class methods

Expression.to_expression(obj)

Private Methods

Expression._expr(self)

Generates the OPTMODEL-compatible string representation of the object

Expression._is_linear(self)

Checks whether the expression is composed of linear components

Expression._relational(self, other, direction_)

Creates a logical relation between Expression objects

Expression.__repr__(self)

Returns a string representation of the object

Expression.__str__(self)

Generates a representation string that is Python-compatible