|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--drasys.or.matrix.RealContainer | +--drasys.or.mp.Problem
Container that holds a mathematical programming problem and metadata.
The this container can efficiently store both sparse and dense problems because it
can use any matrix type to hold the constraint coefficients.
The default matrix type is a
CompressedColumnMatrix
, which is efficient for storing sparse
problems and compatible with most sparse algorithms.
A coefficient can be accessed by its row/column name and by its row/column index.
All indices in the problem are zero based.
MPSReader
,
References:
Linear Programming
Vasek Chvatal / Paperback / Published 1983
Integer and Combinatorial Optimization
George L. Nemhauser, Laurence A. Wolsey / Paperback / Published 1988
Integer Programming
Laurence A. Wolsey / Hardcover / Published 1998
, Serialized FormFields inherited from class drasys.or.matrix.RealContainer |
_epsilon,
_globalEpsilon |
Constructor Summary | |
Problem(int capacityOfConstraints,
int capacityOfVariables)
Construct an empty sparse problem with initial capacities. |
|
Problem(int capacityOfConstraints,
int capacityOfVariables,
SizableMatrixI matrix)
Construct an empty problem with initial capacities using the supplied matrix for the coefficients. |
Method Summary | |
java.util.Enumeration |
coefficients()
Returns a mutable 'Enumeration' of the sparse in the problem. |
java.util.Enumeration |
constraints()
Returns an 'Enumeration' of the constraints. |
boolean |
equals(java.lang.Object o)
|
double |
getCoefficientAt(int constraintIndex,
int variableIndex)
Gets a matrix coefficient by index. |
double |
getCoefficientAt(java.lang.String constraintName,
java.lang.String variableName)
Gets a matrix coefficient by name. |
MatrixI |
getCoefficientMatrix()
Returns the matrx holding the coefficients. |
ConstraintI |
getConstraint(int rowIndex)
Returns a constraint by row index. |
ConstraintI |
getConstraint(java.lang.String name)
Returns a constraint by name. |
Metadata |
getMetadata()
Returns the metadata container for the problem. |
VariableI |
getVariable(int columnIndex)
Returns a variable by column index. |
VariableI |
getVariable(java.lang.String name)
Returns a variable by name. |
void |
maskNames(java.util.Enumeration names)
Renames all the variables and constraints to strings taken from 'names'. |
ConstraintI |
newConstraint(java.lang.String name)
Creates a new constraint with default values. |
VariableI |
newVariable(java.lang.String name)
Creates a new variable with default values. |
int |
relaxInteger()
Changes all INTEGER or BOOLEAN variables to REAL variables. |
void |
setCapacity(int capacityOfConstraints,
int capacityOfVariables)
Increases the constraint capacity. |
void |
setCoefficientAt(int constraintIndex,
int variableIndex,
double value)
Sets a matrix coefficient by index. |
void |
setCoefficientAt(java.lang.String constraintName,
java.lang.String variableName,
double value)
Sets a matrix coefficient by name. |
int |
sizeOfCoefficients()
Returns the number of non-null coefficients in the problem. |
int |
sizeOfConstraints()
Returns the number of constraints in the problem. |
int |
sizeOfVariables()
Returns the number of variable in the problem. |
java.lang.String |
toString()
Returns a String representation of this Problem. |
java.lang.String |
toString(int beginConstraint,
int endConstraint,
int beginVariable,
int endVariable)
Returns a String representation of this Problem. |
java.util.Enumeration |
variables()
Returns an 'Enumeration' of the variables. |
Methods inherited from class drasys.or.matrix.RealContainer |
equals,
getEpsilon,
getGlobalEpsilon,
setEpsilon,
setGlobalEpsilon |
Methods inherited from class java.lang.Object |
clone,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public Problem(int capacityOfConstraints, int capacityOfVariables)
SparseMatrix
.
The Problem will dynamically increase its capacity as required when coefficients are added.
However; the initial capacities should be set as close as possible to the actual size of the problem
to minimize memory reallocation and fragmentation.capacityOfRows
- The initial row capacity.capacityOfColumns
- The initial row capacity.public Problem(int capacityOfConstraints, int capacityOfVariables, SizableMatrixI matrix)
capacityOfRows
- The initial row capacity.capacityOfColumns
- The initial row capacity.Method Detail |
public Metadata getMetadata()
public int sizeOfConstraints()
public int sizeOfVariables()
public int sizeOfCoefficients()
public void setCapacity(int capacityOfConstraints, int capacityOfVariables)
public VariableI newVariable(java.lang.String name) throws DuplicateException
public ConstraintI newConstraint(java.lang.String name) throws DuplicateException
public VariableI getVariable(java.lang.String name)
public VariableI getVariable(int columnIndex)
public ConstraintI getConstraint(java.lang.String name)
public ConstraintI getConstraint(int rowIndex)
public void setCoefficientAt(int constraintIndex, int variableIndex, double value)
public void setCoefficientAt(java.lang.String constraintName, java.lang.String variableName, double value) throws NotFoundException
public double getCoefficientAt(int constraintIndex, int variableIndex)
public double getCoefficientAt(java.lang.String constraintName, java.lang.String variableName) throws NotFoundException
public java.lang.String toString()
public java.lang.String toString(int beginConstraint, int endConstraint, int beginVariable, int endVariable)
public void maskNames(java.util.Enumeration names)
public int relaxInteger()
public MatrixI getCoefficientMatrix()
public java.util.Enumeration coefficients()
MatrixElementI
.
The contents of a returned element must be used before getting the next element
because the same object is modified and reused for each 'nextElement' call.public java.util.Enumeration variables()
VariableI
.public java.util.Enumeration constraints()
ConstraintI
.public boolean equals(java.lang.Object o)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |