QuadraticSimplex

scalation.optimization.linearopt.QuadraticSimplex
class QuadraticSimplex(a: MatrixD, b: VectorD, q: MatrixD, c: VectorD, var x_B: Array[Int])

The QuadraticSimplex class solves Quadratic Programming (QP) problems using the Quadratic Simplex Algorithm. Given a constraint matrix a, constant vector b, cost matrix q and cost vector c, find values for the solution/decision vector x that minimize the objective function f(x), while satisfying all of the constraints, i.e.,

minimize f(x) = 1/2 x q x + c x subject to a x <= b, x >= 0

Creates an MM-by-NN simplex tableau. This implementation is restricted to linear constraints a x <= b and q being a positive semi-definite matrix. Pivoting must now also handle non-linear complementary slackness.

Value parameters

a

the M-by-N constraint matrix

b

the M-length constant/limit vector

c

the N-length cost/revenue vector (first order component)

q

the N-by-N cost/revenue matrix (second order component)

x_B

the initial basis (set of indices where x_i is in the basis)

Attributes

See also
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def comple(l: Int): Int

Return l's complementary variable.

Return l's complementary variable.

Value parameters

l

whose complement

Attributes

def dual: VectorD

Return the dual solution vector (y).

Return the dual solution vector (y).

Attributes

def entering(): Int

Find a variable x_l to enter the basis. Determine the index of entering variable corresponding to column l. Neither the variable nor its complement may be in the current basis. Return -1 to indicate no such column.

Find a variable x_l to enter the basis. Determine the index of entering variable corresponding to column l. Neither the variable nor its complement may be in the current basis. Return -1 to indicate no such column.

Attributes

def leaving(l: Int): Int

Find the best variable x_k to leave the basis given that x_l is entering. Determine the index of the leaving variable corresponding to row k using the Min-Ratio Rule. Return -1 to indicate no such row.

Find the best variable x_k to leave the basis given that x_l is entering. Determine the index of the leaving variable corresponding to row k using the Min-Ratio Rule. Return -1 to indicate no such row.

Value parameters

l

the entering variable (column)

Attributes

def objValue(x: VectorD): Double

Return the optimal objective function value (f(x) = 1/2 x q x + c x).

Return the optimal objective function value (f(x) = 1/2 x q x + c x).

Value parameters

x

the primal solution vector

Attributes

def pivot(k: Int, l: Int): Unit

Pivot on entry (k, l) using Gauss-Jordan elimination to replace variable x_k with x_l in the basis.

Pivot on entry (k, l) using Gauss-Jordan elimination to replace variable x_k with x_l in the basis.

Value parameters

k

the leaving variable (row)

l

the entering variable (column)

Attributes

Return the primal solution vector x.

Return the primal solution vector x.

Attributes

def set(mat: MatrixD, i: Int, u: VectorD, j: Int): Unit

Set matrix mat's i-th row starting at column j to the vector u.

Set matrix mat's i-th row starting at column j to the vector u.

Value parameters

i

the row index

j

the starting column index

u

the vector value to assign

Attributes

def setBasis(j: Int, l: Int): Array[Int]

There are M+N variables, N decision and M slack variables, of which, for each iteration, M are chosen for a Basic Feasible Solution (BFS). The variables not in the basis are set to zero. Setting j to N will start with the slack variables in the basis (only works if b >= 0).

There are M+N variables, N decision and M slack variables, of which, for each iteration, M are chosen for a Basic Feasible Solution (BFS). The variables not in the basis are set to zero. Setting j to N will start with the slack variables in the basis (only works if b >= 0).

Value parameters

j

the offset to start the basis

l

the size of the basis

Attributes

def showTableau(): Unit

Show the current basis and tableau.

Show the current basis and tableau.

Attributes

def solve(): (VectorD, Double)

Run the simplex algorithm starting from the initial BFS and iteratively find a non-basic variable to replace a variable in the current basis so long as the objective improves.

Run the simplex algorithm starting from the initial BFS and iteratively find a non-basic variable to replace a variable in the current basis so long as the objective improves.

Attributes

Return the tableau t.

Return the tableau t.

Attributes

Concrete fields

val k: Int
val l: Int
var x_B: Array[Int]