net.sourceforge.combean.interfaces.mathprog.lp
Interface LPSolver

Package class diagram package LPSolver
All Known Subinterfaces:
MIPSolver
All Known Implementing Classes:
OsiSolverInterfaceAsLPSolver, QSOptProblemAsLPSolver, SizableProblemIAsLPSolver

public interface LPSolver

An LP solver which allows a linear programming problem to be constructed and solved.


Field Summary
static byte LPOBJ_COUNT
           
static byte LPOBJ_MAX
           
static byte LPOBJ_MIN
           
static byte LPOBJ_UNDEFINED
           
static byte LPSTAT_COUNT
           
static byte LPSTAT_FAILURE
           
static byte LPSTAT_INFEASIBLE
           
static byte LPSTAT_SOLVED
           
static byte LPSTAT_UNBOUNDED
           
static byte LPSTAT_UNDEFINED
           
 
Method Summary
 int addColumn(LPVariable variable, SparseVector colVec)
          Add a column to the LP problem.
 int addConstraint(LPConstraint constraint)
          Add a constraint to the LP problem.
 int addRow(LPConstraint constraint, SparseVector rowVec)
          Add a row to the LP problem.
 int addVariable(LPVariable variable)
          Add a variable to the LP problem.
 void freeze()
          This method must be called after the LP has been constructed and before the solver is called.
 int getNumColumns()
          The number of columns of the LP.
 int getNumRows()
          The number of rows of the LP.
 SparseVector getSolution()
          Get the primal solution vector of LP.
 byte getSolutionStatus()
          Return the status of the solver has attempted to solve the problem.
 double getSolutionValue()
          Get value of objective function.
 void setInitialDimensions(int numRows, int numColumns)
          A hint to the memory management.
 void setObjective(byte objective)
          Set the objective of the LP (min or max).
 void solve()
          Solve the LP (usually from scratch).
 

Field Detail

LPOBJ_UNDEFINED

static final byte LPOBJ_UNDEFINED
See Also:
Constant Field Values

LPOBJ_MAX

static final byte LPOBJ_MAX
See Also:
Constant Field Values

LPOBJ_MIN

static final byte LPOBJ_MIN
See Also:
Constant Field Values

LPOBJ_COUNT

static final byte LPOBJ_COUNT
See Also:
Constant Field Values

LPSTAT_UNDEFINED

static final byte LPSTAT_UNDEFINED
See Also:
Constant Field Values

LPSTAT_SOLVED

static final byte LPSTAT_SOLVED
See Also:
Constant Field Values

LPSTAT_INFEASIBLE

static final byte LPSTAT_INFEASIBLE
See Also:
Constant Field Values

LPSTAT_UNBOUNDED

static final byte LPSTAT_UNBOUNDED
See Also:
Constant Field Values

LPSTAT_FAILURE

static final byte LPSTAT_FAILURE
See Also:
Constant Field Values

LPSTAT_COUNT

static final byte LPSTAT_COUNT
See Also:
Constant Field Values
Method Detail

setInitialDimensions

void setInitialDimensions(int numRows,
                          int numColumns)
A hint to the memory management. Should be called before constructing the LP. If the allocation stays within the given bounds, no further memory allocation shall take place.

Parameters:
numRows - number of rows to be reserved.
numColumns - number of columns to be reserved.

addVariable

int addVariable(LPVariable variable)
Add a variable to the LP problem. The corresponding column in the constraint matrix is filled with zero values.

Parameters:
variable - the variable to be added.
Returns:
the number of the corresponding column of the LP (counting from zero)

addConstraint

int addConstraint(LPConstraint constraint)
Add a constraint to the LP problem. The corresponding row in the constraint matrix is filled with zero values.

Parameters:
constraint - the constraint to be added.
Returns:
the number of the corresponding row of the LP (counting from zero)

addRow

int addRow(LPConstraint constraint,
           SparseVector rowVec)
Add a row to the LP problem.

Parameters:
constraint - the constraint of the row to be added
rowVec - the row vector of the constraint matrix to be added.
Returns:
the number of the row in the LP (counting from zero).

addColumn

int addColumn(LPVariable variable,
              SparseVector colVec)
Add a column to the LP problem.

Parameters:
variable - the variable of the column to be added
colVec - the column vector of the constraint matrix to be added.
Returns:
the number of the column in the LP (counting from zero).

setObjective

void setObjective(byte objective)
Set the objective of the LP (min or max).

Parameters:
objective - the objective

freeze

void freeze()
This method must be called after the LP has been constructed and before the solver is called. This allows implementations to do some cleanup of data structures which are only required during the construction of the LP.


getNumRows

int getNumRows()
The number of rows of the LP.

Returns:
number of rows.

getNumColumns

int getNumColumns()
The number of columns of the LP.

Returns:
number of columns.

solve

void solve()
Solve the LP (usually from scratch).


getSolutionStatus

byte getSolutionStatus()
Return the status of the solver has attempted to solve the problem.

Returns:
status of the solution.

getSolutionValue

double getSolutionValue()
Get value of objective function. May only be called if status is LPSTAT_SOLVED.

Returns:
value of objective function.

getSolution

SparseVector getSolution()
Get the primal solution vector of LP. May only be called if status is LPSTAT_SOLVED.

Returns:
primal solution vector of LP.