QpStructure

class flopt.convert.QpStructure(Q, c, C, G=None, h=None, A=None, b=None, lb=None, ub=None, types='Continuous', x=None)[source]

Quadratic Programming Structure

obj  1/2 x.T.dot(Q).dot(x) + c.T.dot(x) + C
s.t. Gx <= h
     Ax == b
     lb <= x <= ub
boundsToIneq()[source]

convert bounds constraints into inequality constraints

obj  1/2 x.T.dot(Q).dot(x) + c.T.dot(x) + C
s.t. [G; -I; I] x <= [h; -lb; ub]
     A x == b
Return type:

QpStructure

classmethod fromFlopt(prob, x=None, option=None, progress=False)[source]
Parameters:
  • prob (Problem) –

  • x (None or list of VarElement family) –

  • progress (bool) –

  • option ({"ineq", "eq"}) –

Return type:

QpStructure

toEq()[source]

convert all eqaual constraint type

obj  1/2 x.T.dot([Q, O; O, O]).dot([x; s]) + [c; O].T.dot([x; s]) + C
s.t. [A, O; G, I] [x; s] == [b; h]
     lb <= x <= ub
     0 <= s
toFlopt(var_name='x')[source]
Parameters:

var_name (str) – variable prefix

Return type:

Problem

toIneq()[source]

convert all non eqaual constraint type

obj  1/2 x.T.dot(Q).dot(x) + c.T.dot(x) + C
s.t. [G; A; -A] x <= [h; b; -b]
     lb <= x <= ub
Return type:

QpStructure

toIsing()[source]
QpStructure --> Problem (flopt) --> IsingStructure
Return type:

IsingStructure

toLp()[source]
Return type:

LpStructure

Raises:

ConversionError – If this cannot be conversion to LpStructure

toQubo()[source]
QpStructure --> Problem (flopt) --> IsingStructure --> QuboStructure
Return type:

QuboStructure

LpStructure

class flopt.convert.LpStructure(c, C, G=None, h=None, A=None, b=None, lb=None, ub=None, types='Continuous', x=None)[source]

Linear Programming Structure

obj  c.T.dot(x) + C
s.t. Gx <= h
     Ax == b
     lb <= x <= ub
classmethod fromFlopt(prob, x=None, option=None, progress=False)[source]
Problem (flopt) --> QpStructure --> LpStructure
Parameters:
  • prob (Problem) –

  • x (None or list of Variable family) –

  • option ({"ineq", "eq"}) –

  • progress (bool) –

Return type:

LpStructure

toEq()[source]
Return type:

LpStructure

toFlopt(var_name='x')[source]
LpStructure --> QpStructure --> Problem (flopt)
Parameters:

var_name (str) – variable prefix

Return type:

Problem

toIneq()[source]
Return type:

LpStructure

toIsing()[source]
LpStructure --> Problem (flopt) --> IsingStructure
Return type:

IsingStructure

toQp()[source]
Return type:

QpStructure

toQubo()[source]
LpStructure --> Problem (flopt) --> IsingStructure --> QuboStructure
Return type:

QuboStructure

IsingStructure

class flopt.convert.IsingStructure(J, h, C, x=None)[source]

Ising Structure

obj - x.T.dot(J).dot(x) - h.T.dot(x) + C s.t. x in {-1, 1}^N

toFlopt(var_name='x')[source]
Parameters:

var_name (str) – variable prefix

Return type:

Problem

toLp()[source]
IsingStructure --> Problem (flopt) --> QpStructure --> LpStructure
Return type:

LpStructure

toQp()[source]
IsingStructure --> Problem (flopt) --> QpStructure
Return type:

QpStructure

toQubo()[source]
Return type:

QuboStructure

QuboStructure

class flopt.convert.QuboStructure(Q, C, x=None)[source]

QUBO Structure

obj  x.T.dot(Q).dot(x) + C
classmethod fromFlopt(prob, x=None)[source]
Problem (flopt) --> IsingStructure --> QuboStructure
toFlopt(var_name='x')[source]
Parameters:

var_name (str) – variable prefix

Return type:

Problem

toIsing()[source]
QuboStructure --> Problem (flopt) --> IsingStructure
Return type:

IsingStructure

toLp()[source]
QuboStructure --> Problem (flopt) --> QuboStructure --> LpStructure
Return type:

LpStructure

toQp()[source]
QuboStructure --> Problem (flopt) --> QpStructure
Return type:

QpStructure