|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.optimizationservices.oscommon.representationparser.FMLReader
public class FMLReader
The FMLReader
class creates the SAX2XMLReader
parser object. Associated with the FMLReader class are numerous virtual "on" methods
that when called by an FMLHandler
object create the necessary data
structures for the solver. In FMLReader these methods are empty and the solver
specific classes that extends from FMLReader
are responsible for the
actual implementation of these methods. Each "on" method has a corresponding
opposite "set" method in the FMLWriter
class. There is no specific sequence the user should follow to invoke these on methods.
FMLHandler
,
FMLWriter
,
XMLReader
Constructor Summary | |
---|---|
FMLReader()
constructor |
Method Summary | |
---|---|
java.lang.String |
convertToOSiL()
Converts an FML instance to an OSiL linear instance. |
boolean |
getColumnMajor()
|
int |
getConstraintCount()
|
double[] |
getConstraintLhs()
|
java.lang.String[] |
getConstraintNames()
|
double[] |
getConstraintRhs()
|
boolean |
getMinimization()
|
int[] |
getNonzeroIndexes()
|
double[] |
getNonzeroValues()
|
double[] |
getObjectiveCoefficients()
|
double |
getObjectiveConstant()
|
java.lang.String |
getSource()
|
int[] |
getStartIndexes()
|
int |
getVariableCount()
|
char[] |
getVariableDomains()
|
double[] |
getVariableLbs()
|
java.lang.String[] |
getVariableNames()
|
double[] |
getVariableUbs()
|
boolean |
isValidate()
|
static void |
main(java.lang.String[] argv)
main for test purposes. |
boolean |
onAMatrix(boolean isColumnMajor,
double[] nonzeroValues,
int[] nonzeroIndexes,
int[] endIndexes,
int[] numberOfNonzeros)
Receive notification when an AMatrix is encountered. |
boolean |
onConstraints(java.lang.String[] constraintNames,
double[] constraintLhs,
double[] constraintRhs)
Receive notification when constraints are encountered. |
void |
onDescription(java.lang.String source,
int variableCount,
int constraintCount)
Receive notification when a linearProgramDescription is encountered. |
boolean |
onDualSolution(java.lang.String[] dualNames,
double[] dualValues,
int[] dualIndexes)
Receive notification when dual solutions are encountered. |
boolean |
onObjective(boolean isMinimization,
double objectiveConstant,
double[] ObjectiveCoefficients)
Receive notification when an objective function is encountered. |
boolean |
onOption(java.lang.String[] optionNames,
java.lang.String[] optionValues)
Receive notification when options are encountered. |
boolean |
onPrimalSolution(java.lang.String[] primalNames,
double[] primalValues,
int[] primalIndexes)
Receive notification when primal solutions are encountered. |
void |
onSolution(java.lang.String statusId,
java.lang.String status,
java.lang.String solverMessage,
double optimalValue)
Receive notification when an objective solution is encountered. |
boolean |
onVariables(java.lang.String[] variableNames,
double[] variableLbs,
double[] variableUbs,
char[] variableDomains)
Receive notification when variables are encountered. |
boolean |
readFile(java.lang.String fileName)
Read the xml file that contains the FML linear program instance. |
boolean |
readString(java.lang.String fmlString)
Read the xml string that contains the FML linear program instance. |
void |
setValidate(boolean xsdValidate)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FMLReader()
Method Detail |
---|
public boolean isValidate()
public void setValidate(boolean xsdValidate)
xsdValidate
- holds whether the parser should be validating against the schema or not.public boolean readFile(java.lang.String fileName)
fileName
- holds the xml filename that contains the FML linear program instance
public boolean readString(java.lang.String fmlString)
fmlString
- holds the xml string that contains the FML linear program instance
public void onDescription(java.lang.String source, int variableCount, int constraintCount)
source
- holds the source information of the optimization problem.variableCount
- holds the number of columns, i.e. variable number.constraintCount
- holds the number of rows, i.e. constraint number.public boolean onOption(java.lang.String[] optionNames, java.lang.String[] optionValues)
optionNames
- holds the names of all the options.optionValues
- holds the values of all the options corresponding to the names.
public boolean onVariables(java.lang.String[] variableNames, double[] variableLbs, double[] variableUbs, char[] variableDomains)
variableNames
- holds the names of all the columns, i.e. variable names.variableLbs
- holds the values of lower bounds for the variables.variableUbs
- holds the values of upper bounds for the variables.variableDomains
- holds the types of all the variables, (e.g. 'C' for continuous
type, 'I' for integer type, and 'B' for binary type).
public boolean onConstraints(java.lang.String[] constraintNames, double[] constraintLhs, double[] constraintRhs)
The constraint information contains all the information about the linear constraints
except for the AMatrix, which is notified in the onAMatrix
method.
constraintNames
- holds the names of all the rows, i.e. constraint names.constraintLhs
- holds the values of the lower bounds for the constraints.constraintRhs
- holds the values of the upper bounds for the constraints.
onAMatrix(boolean, double[], int[], int[], int[])
public boolean onAMatrix(boolean isColumnMajor, double[] nonzeroValues, int[] nonzeroIndexes, int[] endIndexes, int[] numberOfNonzeros)
The AMatrix stores all the information in the A part of the linear constraints lhs<=AX<=rhs
isColumnMajor
- holds the value of whether the AMatrix holding linear program data is stored
by column. If false, the matrix is stored by row.nonzeroValues
- holds the values of the vector element nonz in AMatrix, which contains nonzero elements.nonzeroIndexes
- holds the values of the vector element rowIdx or colIdx in AMatrix. If the matrix is
stored by column (row), rowIdx (colIdx) is the vector of row (column) indices.endIndexes
- holds the values of the vector element pntANonz in AMatrix, which points to the end of a
column (row) of nonzero elements in AMatrix.numberOfNonzeros
- holds the values of the vector element numNonz in AMatrix. The vector numNonz, if
present, stores the number of nonzero elements in the column (row). If numNonz is not present, then nonz
stores the columns (rows) in matrix order. If the matrix is stored by column (row), rowIdx (colIdx) is
the vector of row (column) indices.
public boolean onObjective(boolean isMinimization, double objectiveConstant, double[] ObjectiveCoefficients)
isMinimization
- holds whether the objective is minimization or not.objectiveConstant
- holds the value of objective function constant.ObjectiveCoefficients
- holds the values of the objective function coefficients.
public void onSolution(java.lang.String statusId, java.lang.String status, java.lang.String solverMessage, double optimalValue)
The information does not include primal and dual solutions which are notified
in the onPrimalSolution
and onDualSolution
methods.
statusId
- holds the information of optimization solution status id.status
- holds the status message of the optimization solution.solverMessage
- holds the value of solver message.optimalValue
- holds the value of the optimal solution.onPrimalSolution(java.lang.String[], double[], int[])
,
onDualSolution(java.lang.String[], double[], int[])
public boolean onPrimalSolution(java.lang.String[] primalNames, double[] primalValues, int[] primalIndexes)
priamlNames
- holds the names of primal variable solutions. It may be empty.primalValues
- holds the values of primal variable solutions corresponding to the primalIndexes.primalIndexes
- holds the indexes of primal variable solutions corresponding to the primalValues.
public boolean onDualSolution(java.lang.String[] dualNames, double[] dualValues, int[] dualIndexes)
dualNames
- holds the names of dual variable solutions. It may be empty.dualValues
- holds the values of dual variable solutions corresponding to the primalIndexes.dualIndexes
- holds the indexes of dual variable solutions corresponding to the primalValues.
public java.lang.String getSource()
public int getVariableCount()
public int getConstraintCount()
public java.lang.String[] getVariableNames()
public double[] getVariableLbs()
public double[] getVariableUbs()
public char[] getVariableDomains()
public java.lang.String[] getConstraintNames()
public double[] getConstraintLhs()
public double[] getConstraintRhs()
public boolean getColumnMajor()
public double[] getNonzeroValues()
public int[] getNonzeroIndexes()
public int[] getStartIndexes()
public boolean getMinimization()
public double getObjectiveConstant()
public double[] getObjectiveCoefficients()
public java.lang.String convertToOSiL()
public static void main(java.lang.String[] argv)
argv
- command line arguments.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |