LPWrapper

class pyopenms.LPWrapper

Bases: object

Cython implementation of _LPWrapper

Original C++ documentation is available here

__init__(self) None

Methods

__init__(self)

addColumn

Overload:

addRow

Overload:

deleteRow(self, index)

Delete index-th row

getColumnIndex(self, name)

Returns index of the column with name

getColumnLowerBound(self, index)

Returns column's lower bound

getColumnName(self, index)

Returns name of the index-th column

getColumnType(self, index)

Returns column/variable type.

getColumnUpperBound(self, index)

Returns column's upper bound

getColumnValue(self, index)

getElement(self, row_index, column_index)

Returns the element

getMatrixRow(self, idx, indexes)

getNumberOfColumns(self)

Returns number of columns

getNumberOfNonZeroEntriesInRow(self, idx)

getNumberOfRows(self)

Returns number of rows

getObjective(self, index)

Returns objective value for column with index

getObjectiveSense(self)

Returns objective sense

getObjectiveValue(self)

getRowIndex(self, name)

Returns index of the row with name

getRowLowerBound(self, index)

Returns row's lower bound

getRowName(self, index)

Sets name of the index-th row

getRowUpperBound(self, index)

Returns row's upper bound

getSolver(self)

Returns currently active solver

getStatus(self)

Returns solution status

readProblem(self, filename, format_)

Read LP from file

setColumnBounds(self, index, lower_bound, ...)

Sets column bounds

setColumnName(self, index, name)

Sets name of the index-th column

setColumnType(self, index, type_)

Sets column/variable type.

setElement(self, row_index, column_index, value)

Sets the element

setObjective(self, index, obj_value)

Sets objective value for column with index

setObjectiveSense(self, sense)

Sets objective direction

setRowBounds(self, index, lower_bound, ...)

Sets row bounds

setRowName(self, index, name)

Sets name of the index-th row

solve(self, solver_param, verbose_level)

Solve problems, parameters like enabled heuristics can be given via solver_param

writeProblem(self, filename, format_)

Write LP formulation to a file

LPWrapper_Type

alias of pyopenms._pyopenms_2.__LPWrapper_Type

SOLVER

alias of pyopenms._pyopenms_2.__SOLVER

Sense

alias of pyopenms._pyopenms_2.__Sense

SolverStatus

alias of pyopenms._pyopenms_2.__SolverStatus

VariableType

alias of pyopenms._pyopenms_2.__VariableType

WriteFormat

alias of pyopenms._pyopenms_2.__WriteFormat

addColumn()

Overload:

addColumn(self) int

Adds an empty column to the LP matrix, returns index

Overload:

addColumn(self, column_indices: List[int], column_values: List[float], name: Union[bytes, str, String]) int

Adds a column to the LP matrix, returns index

Overload:

addColumn(self, column_indices: List[int], column_values: List[float], name: Union[bytes, str, String], lower_bound: float, upper_bound: float, type_: int) int

Adds a column with boundaries to the LP matrix, returns index

addRow()

Overload:

addRow(self, row_indices: List[int], row_values: List[float], name: Union[bytes, str, String]) int

Adds a row to the LP matrix, returns index

Overload:

addRow(self, row_indices: List[int], row_values: List[float], name: Union[bytes, str, String], lower_bound: float, upper_bound: float, type_: int) int

Adds a row with boundaries to the LP matrix, returns index

deleteRow(self, index: int) None

Delete index-th row

getColumnIndex(self, name: Union[bytes, str, String]) int

Returns index of the column with name

getColumnLowerBound(self, index: int) float

Returns column’s lower bound

getColumnName(self, index: int) Union[bytes, str, String]

Returns name of the index-th column

getColumnType(self, index: int) int

Returns column/variable type.

getColumnUpperBound(self, index: int) float

Returns column’s upper bound

getColumnValue(self, index: int) float
getElement(self, row_index: int, column_index: int) float

Returns the element

getMatrixRow(self, idx: int, indexes: List[int]) None
getNumberOfColumns(self) int

Returns number of columns

getNumberOfNonZeroEntriesInRow(self, idx: int) int
getNumberOfRows(self) int

Returns number of rows

getObjective(self, index: int) float

Returns objective value for column with index

getObjectiveSense(self) int

Returns objective sense

getObjectiveValue(self) float
getRowIndex(self, name: Union[bytes, str, String]) int

Returns index of the row with name

getRowLowerBound(self, index: int) float

Returns row’s lower bound

getRowName(self, index: int) Union[bytes, str, String]

Sets name of the index-th row

getRowUpperBound(self, index: int) float

Returns row’s upper bound

getSolver(self) int

Returns currently active solver

getStatus(self) int

Returns solution status

Returns

status: 1 - undefined, 2 - integer optimal, 3- integer feasible (no optimality proven), 4- no integer feasible solution

readProblem(self, filename: Union[bytes, str, String], format_: Union[bytes, str, String]) None

Read LP from file

Parameters
  • filename – Filename where to store the LP problem

  • format – LP, MPS or GLPK

setColumnBounds(self, index: int, lower_bound: float, upper_bound: float, type_: int) None

Sets column bounds

setColumnName(self, index: int, name: Union[bytes, str, String]) None

Sets name of the index-th column

setColumnType(self, index: int, type_: int) None

Sets column/variable type.

setElement(self, row_index: int, column_index: int, value: float) None

Sets the element

setObjective(self, index: int, obj_value: float) None

Sets objective value for column with index

setObjectiveSense(self, sense: int) None

Sets objective direction

setRowBounds(self, index: int, lower_bound: float, upper_bound: float, type_: int) None

Sets row bounds

setRowName(self, index: int, name: Union[bytes, str, String]) None

Sets name of the index-th row

solve(self, solver_param: SolverParam, verbose_level: int) int

Solve problems, parameters like enabled heuristics can be given via solver_param

The verbose level (0,1,2) determines if the solver prints status messages and internals

Parameters
  • solver_param – Parameters of the solver introduced by SolverParam

  • verbose_level – Sets verbose level

Returns

solver dependent

writeProblem(self, filename: Union[bytes, str, String], format_: int) None

Write LP formulation to a file

Parameters
  • filename – Output filename, if the filename ends with ‘.gz’ it will be compressed

  • format – MPS-format is supported by GLPK and COIN-OR; LP and GLPK-formats only by GLPK