net.sourceforge.combean.adapters.qsopt
Class QSOptProblemAsLPSolver

Package class diagram package QSOptProblemAsLPSolver
java.lang.Object
  extended by net.sourceforge.combean.adapters.qsopt.QSOptProblemAsLPSolver
All Implemented Interfaces:
LPSolver

public class QSOptProblemAsLPSolver
extends Object
implements LPSolver


Field Summary
static byte QSOPT_DUAL_SIMPLEX
           
static byte QSOPT_PRIMAL_SIMPLEX
           
 
Fields inherited from interface net.sourceforge.combean.interfaces.mathprog.lp.LPSolver
LPOBJ_COUNT, LPOBJ_MAX, LPOBJ_MIN, LPOBJ_UNDEFINED, LPSTAT_COUNT, LPSTAT_FAILURE, LPSTAT_INFEASIBLE, LPSTAT_SOLVED, LPSTAT_UNBOUNDED, LPSTAT_UNDEFINED
 
Constructor Summary
QSOptProblemAsLPSolver()
           
QSOptProblemAsLPSolver(qs.Problem qsProblem)
           
 
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.
 byte getSimplexKind()
           
 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).
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

QSOPT_DUAL_SIMPLEX

public static final byte QSOPT_DUAL_SIMPLEX
See Also:
Constant Field Values

QSOPT_PRIMAL_SIMPLEX

public static final byte QSOPT_PRIMAL_SIMPLEX
See Also:
Constant Field Values
Constructor Detail

QSOptProblemAsLPSolver

public QSOptProblemAsLPSolver()

QSOptProblemAsLPSolver

public QSOptProblemAsLPSolver(qs.Problem qsProblem)
Method Detail

setInitialDimensions

public void setInitialDimensions(int numRows,
                                 int numColumns)
Description copied from interface: LPSolver
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.

Specified by:
setInitialDimensions in interface LPSolver
Parameters:
numRows - number of rows to be reserved.
numColumns - number of columns to be reserved.

addVariable

public int addVariable(LPVariable variable)
Description copied from interface: LPSolver
Add a variable to the LP problem. The corresponding column in the constraint matrix is filled with zero values.

Specified by:
addVariable in interface LPSolver
Parameters:
variable - the variable to be added.
Returns:
the number of the corresponding column of the LP (counting from zero)

addConstraint

public int addConstraint(LPConstraint constraint)
Description copied from interface: LPSolver
Add a constraint to the LP problem. The corresponding row in the constraint matrix is filled with zero values.

Specified by:
addConstraint in interface LPSolver
Parameters:
constraint - the constraint to be added.
Returns:
the number of the corresponding row of the LP (counting from zero)

addRow

public int addRow(LPConstraint constraint,
                  SparseVector rowVec)
Description copied from interface: LPSolver
Add a row to the LP problem.

Specified by:
addRow in interface LPSolver
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

public int addColumn(LPVariable variable,
                     SparseVector colVec)
Description copied from interface: LPSolver
Add a column to the LP problem.

Specified by:
addColumn in interface LPSolver
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

public void setObjective(byte objective)
Description copied from interface: LPSolver
Set the objective of the LP (min or max).

Specified by:
setObjective in interface LPSolver
Parameters:
objective - the objective

freeze

public void freeze()
Description copied from interface: LPSolver
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.

Specified by:
freeze in interface LPSolver

getNumRows

public int getNumRows()
Description copied from interface: LPSolver
The number of rows of the LP.

Specified by:
getNumRows in interface LPSolver
Returns:
number of rows.

getNumColumns

public int getNumColumns()
Description copied from interface: LPSolver
The number of columns of the LP.

Specified by:
getNumColumns in interface LPSolver
Returns:
number of columns.

solve

public void solve()
Description copied from interface: LPSolver
Solve the LP (usually from scratch).

Specified by:
solve in interface LPSolver

getSolutionStatus

public byte getSolutionStatus()
Description copied from interface: LPSolver
Return the status of the solver has attempted to solve the problem.

Specified by:
getSolutionStatus in interface LPSolver
Returns:
status of the solution.

getSolutionValue

public double getSolutionValue()
Description copied from interface: LPSolver
Get value of objective function. May only be called if status is LPSTAT_SOLVED.

Specified by:
getSolutionValue in interface LPSolver
Returns:
value of objective function.

getSolution

public SparseVector getSolution()
Description copied from interface: LPSolver
Get the primal solution vector of LP. May only be called if status is LPSTAT_SOLVED.

Specified by:
getSolution in interface LPSolver
Returns:
primal solution vector of LP.

toString

public String toString()
Overrides:
toString in class Object

getSimplexKind

public byte getSimplexKind()
Returns:
Returns the simplexKind.