package algebra
Helper functions for summation of multiple expressions stored in iterable data structures and encoding/decoding of terms.
- Alphabetic
- By Inheritance
- algebra
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
abstract
class
BinaryOp extends Expression
Binary operator abstraction of the form (a operator b), that should be extended by any binary operator expression type.
-
class
Const extends Expression
Constant expression holding a double value.
-
case class
ConstProduct(c: Const, a: Expression) extends Expression with scala.Product with Serializable
Const product represents an expression multiplied by a constant and has the form of (c * a).
Const product represents an expression multiplied by a constant and has the form of (c * a).
- c
the constant
- a
the expression
-
class
Constraint extends AnyRef
A constraint has the form (expression RELATION expression) with RELATION in {<=, =, >=}
-
abstract
class
Expression extends AnyRef
Expression abstraction, should be extended by anything that is an expression type.
-
case class
Minus(a: Expression, b: Expression) extends BinaryOp with scala.Product with Serializable
Binary operator for subtraction has the form (a - b).
Binary operator for subtraction has the form (a - b).
- a
the left hand side expression
- b
the right had side expression
-
case class
Plus(a: Expression, b: Expression) extends BinaryOp with scala.Product with Serializable
Binary operator for addition has the form (a + b).
Binary operator for addition has the form (a + b).
- a
the left hand side expression
- b
the right had side expression
-
case class
Product(a: Expression, b: Expression) extends BinaryOp with scala.Product with Serializable
Binary operator for multiplication has the form (a * b).
Binary operator for multiplication has the form (a * b).
- a
the left hand side expression
- b
the right had side expression
-
case class
Term(coefficient: Const, variables: Vector[Variable]) extends Expression with scala.Product with Serializable
Term is holding a coefficient and all variables which are involved in the product of the term.
Term is holding a coefficient and all variables which are involved in the product of the term.
coefficient * (variable_1 * ... * variable_n)
-
abstract
class
Variable extends Expression with Ordered[Variable]
Abstract variable, should be extended by any variable type in order to inherit the algebraic properties.
Value Members
- implicit def Double2Const(value: Double): Const
- implicit def Int2Const(value: Int): Const
-
def
decode(z: Long): Vector[Int]
Cantor inverse pairing function.
Cantor inverse pairing function. Uniquely decodes a number into a sequence of natural numbers they produced it.
- z
the number to decode
- returns
a pair of numbers or one number if default value was used during encoding
-
def
encode(x: Int, y: Int = -1): Long
Cantor pairing function.
Cantor pairing function. A process to uniquely encode natural numbers into a single natural number.
- x
the first number
- y
the second number (default is -1 in case we want to encode only one)
- returns
a unique number for x and y
- def sum[A, B, C, D](indexesA: Iterable[A], indexesB: Iterable[B], indexesC: Iterable[C], indexesD: Iterable[D])(f: (A, B, C, D) ⇒ Expression): Expression
- def sum[A, B, C](indexesA: Iterable[A], indexesB: Iterable[B], indexesC: Iterable[C])(f: (A, B, C) ⇒ Expression): Expression
- def sum[A, B](indexesA: Iterable[A], indexesB: Iterable[B])(f: (A, B) ⇒ Expression): Expression
- def sum[A](indexes: Iterable[A])(f: (A) ⇒ Expression): Expression
- def sum(expressions: Iterable[Expression]): Expression
- object Const
-
object
ConstraintRelation extends Enumeration
Constraint relations (>= <= =).
-
object
ExpressionOrder extends Enumeration
Expression order may be constant, linear, quadratic or higher order.
-
object
One extends Const with scala.Product with Serializable
One is representing the special case of One constant.
-
object
Variable
Object holding the anonymous constant for variables not having a specified symbol.
-
object
Zero extends Const with scala.Product with Serializable
Zero is representing the special case of Zero constant.