optimus.algebra

Type members

Classlikes

object AlgebraOps
abstract class BinaryOp(val a: Expression, val b: Expression) extends Expression

Binary operator expression (a operator b), that should be extended by any binary operator expression type.

Binary operator expression (a operator b), that should be extended by any binary operator expression type.

Value parameters:
a

left hand side expression

b

right hand side expression

class Const(val value: Double) extends Expression

Constant expression holding a double value.

Constant expression holding a double value.

Value parameters:
value

the value held by the constraint

Companion:
object
object Const
Companion:
class
case class ConstProduct(scalar: Const, a: Expression) extends Expression

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

Value parameters:
a

the expression

scalar

the constant

case class Constraint(lhs: Expression, operator: ConstraintRelation, rhs: Expression)

A constraint has the form (expression RELATION expression). RELATION can be one of the {<=, =, >=}.

A constraint has the form (expression RELATION expression). RELATION can be one of the {<=, =, >=}.

Value parameters:
lhs

left hand side expression

operator

relation operator

rhs

right hand side expression

sealed abstract class ConstraintRelation(val entryName: String)
Companion:
object
Companion:
class
abstract class Expression extends LazyLogging

Expression abstraction, should be extended by anything that is an expression type.

Expression abstraction, should be extended by anything that is an expression type.

sealed trait ExpressionType
Companion:
object
Companion:
class
case class Minus(a: Expression, b: Expression) extends BinaryOp

Minus operator for subtraction (a - b).

Minus operator for subtraction (a - b).

Value parameters:
a

left hand side expression

b

right hand side expression

case object One extends Const
case class Plus(a: Expression, b: Expression) extends BinaryOp

Plus operator for addition (a + b).

Plus operator for addition (a + b).

Value parameters:
a

left hand side expression

b

right hand side expression

case class Product(a: Expression, b: Expression) extends BinaryOp

Product operator (a * b).

Product operator (a * b).

Value parameters:
a

left hand side expression

b

right hand side expression

case class Term(scalar: Const, vars: Vector[Var]) extends Expression

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.

scalar * (var_1 * ... * var_n)

abstract class Var(val symbol: String) extends Expression

Abstract variable, should be extended by any variable type in order to inherit the algebraic properties.

Abstract variable, should be extended by any variable type in order to inherit the algebraic properties.

Value parameters:
symbol

the symbol of the variable

case object Zero extends Const

Types

type DecodedIds = Vector[Int]
type LongDoubleMap = TLongDoubleHashMap
type UniqueId = Long

Value members

Concrete methods

Szudzik inverse pairing function. Uniquely decodes a natural number encoding into the pair of natural numbers that produced the encoding.

Szudzik inverse pairing function. Uniquely decodes a natural number encoding into the pair of natural numbers that produced the encoding.

Value parameters:
z

the number to decode

Returns:

a vector holding the pair of numbers

Note:

In case the encoding refers to a single variable the vector will contain only

def encode(x: Long): UniqueId

Szudzik pairing function is a process for uniquely encoding a pair of natural numbers into a single natural number. It is used by algebra to encode variable products by ID and produce unique product IDs.

Szudzik pairing function is a process for uniquely encoding a pair of natural numbers into a single natural number. It is used by algebra to encode variable products by ID and produce unique product IDs.

Value parameters:
x

a variable ID

Returns:

a unique ID in the space of encodings for a single variable ID

Note:

This variant encodes a variable ID alone.

def encode(x: Long, y: Long): UniqueId

Szudzik pairing function is a process that uniquely encodes a pair of natural numbers into a single natural number. It is used by algebra to encode variable products by ID and produce unique product IDs.

Szudzik pairing function is a process that uniquely encodes a pair of natural numbers into a single natural number. It is used by algebra to encode variable products by ID and produce unique product IDs.

Value parameters:
x

a variable ID

y

another variable ID

Returns:

a unique ID in the space of encodings for x and y

def encode(vars: Vector[Var]): UniqueId

Szudzik pairing function is a process for uniquely encoding a pair of natural numbers into a single natural number. It is used by algebra to encode variable products by ID and produce unique product IDs.

Szudzik pairing function is a process for uniquely encoding a pair of natural numbers into a single natural number. It is used by algebra to encode variable products by ID and produce unique product IDs.

Value parameters:
vars

a vector of variables

Returns:

a unique ID in the space of encodings for the variables

Note:

This variant encodes a vector of variables. The vector should contain a single variable or a pair of variables.

Concrete fields

final val ANONYMOUS: ""

Implicits

Implicits

implicit def Double2Const(value: Double): Const
implicit def Int2Const(value: Int): Const
implicit def Long2Const(value: Long): Const