|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.optimizationservices.oscommon.localinterface.OSInstance
public class OSInstance
The OSInstance
class is a local interface for storing Optimization Services problem instance.
Its design follows the Optimization Services instance Language (OSiL). Naming, structuring and layering
all are exactly the same as those in the OSiL schema. In general there are three simple rules in translating the OSiL schema.
1. An element that is not of simple type (contains non-char nodes) or has attributes, become a class.
The class type corresponds to the element type defined in the schema.
2. A simple type element (just contains character data in the element) becomes a correponding programming language (Java/C++/C#) data type.
3. A "sequence" of one or more same-type elements becomes an array, members with the selected choice being non-null.
There are some exceptions.
1. Each "OSnLNode" "nonlinearExpressions" or "userFunctions" becomes an OSExpressionTree.
2. There are no definitions of "userFunctions", "simulations" and "realTimeData" because these
definitions are substituted.
3. All compression-related elements and attributes in xml disappear in the local interface because they are all expanded.
4. "semidefiniteBlocks", "cones", "stages", "stochasticInformation" and "xmlData" are not implemented yet.
OSResult
,
OSAnalysis
,
OSOption
Field Summary | |
---|---|
InstanceData |
instanceData
instanceData holds the second child of the OSInstance specified by the OSiL Schema. |
InstanceHeader |
instanceHeader
instanceHeader holds the first child of the OSInstance specified by the OSiL Schema. |
Constructor Summary | |
---|---|
OSInstance()
default constructor. |
Method Summary | |
---|---|
boolean |
addConstraint(int index,
java.lang.String name,
double lowerBound,
double upperBound,
double constant)
add a constraint. |
boolean |
addNonlinearExpressionTree(int index,
OSExpressionTree osExpressionTree)
add a nonlinear expression tree. |
boolean |
addNonlinearExpressionTree(int index,
java.lang.String[] tokens,
int start,
int end,
java.lang.String fixType)
add a nonlinear expression tree. |
boolean |
addObjective(int index,
java.lang.String name,
java.lang.String maxOrMin,
double constant,
double weight,
SparseVector objectiveCoefficients)
add an objective. |
boolean |
addVariable(int index,
java.lang.String name,
double lowerBound,
double upperBound,
char type,
double init,
java.lang.String initString)
add a variable. |
double[] |
calculateConstraintFunctionValues(double[] x)
Calculate all the constraint function (nonlinear+quadratic+linear) values given the current variable values. |
SparseVector[] |
calculateFunctionGradients(double[] x,
boolean functionEValuated)
|
SparseVector |
calculateFunctionGradients(int index,
double[] x,
boolean functionEValuated)
|
MatrixMarket |
calculateFunctionHessian(int index,
double[] x,
boolean gradientEvaluated)
|
double |
calculateFunctionValue(int index,
double[] x)
Calculate the function (nonlinear+quadratic+linear) value in a specified row given the current variable values. |
MatrixMarket |
calculateLagragianFunctionHessian(int objectiveIndex,
double[] x,
double[] weights,
boolean gradientEvaluated)
|
double[] |
calculateLagragianFunctionHessianTimesVector(int objectiveIndex,
double[] x,
double[] weights,
double[] vector,
boolean gradientEvaluated)
|
double[] |
calculateLinearConstraintFunctionValues(double[] x)
Calculate all the values of the linear parts of the constraint functions given the current variable values. |
double |
calculateLinearFunctionValue(int index,
double[] x)
Calculate the value of the linear part of a function in a specified row given the current variable values. |
SparseVector |
calculateNonlinearExpressionGradients(int index,
double[] x,
boolean functionEvaluated)
Calculate the nonlinear gradients in a specified row given the current variable. |
MatrixMarket |
calculateNonlinearExpressionHessian(int index,
double[] x,
boolean gradientEvaluated)
Calculate the nonlinear hessian in a specified row given the current variable. |
double |
calculateNonlinearExpressionValue(int index,
double[] x)
Calculate the nonlinear function value in a specified row given the current variable values. |
double[] |
calculateQuadraticConstraintFunctionValues(double[] x)
Calculate the value of the quadratic part of a function in a specified row given the current variable values. |
double |
calculateQuadraticFunctionValue(int index,
double[] x)
Calculate the value of the quadratic part of a function in a specified row given the current variable values. |
double[] |
getConstraintConstants()
Get constraint constants. |
double[] |
getConstraintLowerBounds()
Get constraint lower bounds. |
java.lang.String[] |
getConstraintNames()
Get constraint names. |
int |
getConstraintNumber()
Get constraint number. |
char[] |
getConstraintTypes()
Get constraint types. |
double[] |
getConstraintUpperBounds()
Get constraint upper bounds. |
double[][] |
getDenseObjectiveCoefficients()
Get dense objective coefficients. |
java.lang.String |
getInstanceDescription()
Get instance description. |
java.lang.String |
getInstanceName()
Get instance name. |
java.lang.String |
getInstanceSource()
Get instance source. |
boolean |
getLinearConstraintCoefficientMajor()
Get whether the constraint coefficients is in column major (true) or row major (false). |
int |
getLinearConstraintCoefficientNumber()
Get number of specified (usually nonzero) linear constraint coefficient values. |
SparseMatrix |
getLinearConstraintCoefficientsInColumnMajor()
Get linear constraint coefficients in column major. |
MatrixMarket |
getLinearConstraintCoefficientsInMatrixMarket()
Get linear constraint coefficients in matrix market form. |
SparseMatrix |
getLinearConstraintCoefficientsInRowMajor()
Get linear constraint coefficients in row major. |
OSExpressionTree |
getNonlinearExpressionTree(int index)
Get the nonlinear expression tree of a specific row in . |
int[] |
getNonlinearExpressionTreeIndexes()
Get all the nonlinear expression tree indexes, i.e. |
java.lang.String[] |
getNonlinearExpressionTreeInInfix(int index)
Get the nonlinear expression tree of a specific row in a string array of infix tokens. |
java.lang.String[] |
getNonlinearExpressionTreeInPostfix(int index)
Get the nonlinear expression tree of a specific row in a string array of postfix tokens. |
java.lang.String[] |
getNonlinearExpressionTreeInPrefix(int index)
Get the nonlinear expression tree of a specific row in a string array of prefix tokens. |
int |
getNonlinearExpressionTreeNumber()
Get the number of nonlinear expression trees, i.e. |
OSExpressionTree[] |
getNonlinearExpressionTrees()
Get all the nonlinear expression trees. |
int[] |
getObjectiveCoefficientNumbers()
Get objective coefficient number. |
SparseVector[] |
getObjectiveCoefficients()
Get objective coefficients. |
double[] |
getObjectiveConstants()
Get objective constants. |
java.lang.String[] |
getObjectiveMaxOrMins()
Get objective maxOrMins. |
java.lang.String[] |
getObjectiveNames()
Get objective names. |
int |
getObjectiveNumber()
Get objective number. |
double[] |
getObjectiveWeights()
Get objective weights. |
int[] |
getQuadraticRowIndexes()
Get all the quadratic row indexes, i.e. |
int |
getQuadraticTermNumber()
Get the number of specified (usually nonzero) qTerms in the quadratic coefficients. |
QuadraticTerms |
getQuadraticTerms()
Get all the quadratic terms in the instance. |
java.lang.String[] |
getVariableInitialStringValues()
Get variable initial string values. |
double[] |
getVariableInitialValues()
Get variable initial values. |
double[] |
getVariableLowerBounds()
Get variable lower bounds. |
java.lang.String[] |
getVariableNames()
Get variable names. |
int |
getVariableNumber()
Get variable number. |
char[] |
getVariableTypes()
Get variable types. |
double[] |
getVariableUpperBounds()
Get variable upper bounds. |
static void |
main(java.lang.String[] args)
main for test purposes. |
OSInstance |
readOSiL(java.lang.String osil,
boolean isFile,
boolean validate)
read an OSiL instance and return an OSInstance object. |
boolean |
setConstraintNumber(int number)
set the constraint number. |
boolean |
setConstraints(int number,
java.lang.String[] names,
double[] lowerBounds,
double[] upperBounds,
double[] constants)
set all the constraint related elements. |
boolean |
setInstanceDescription(java.lang.String description)
set the instance description. |
boolean |
setInstanceName(java.lang.String name)
set the instance name. |
boolean |
setInstanceSource(java.lang.String source)
set the instance source. |
boolean |
setLinearConstraintCoefficients(int number,
boolean isColumnMajor,
double[] values,
int valuesBegin,
int valuesEnd,
int[] indexes,
int indexesBegin,
int indexesEnd,
int[] starts,
int startsBegin,
int startsEnd)
set linear constraint coefficients |
boolean |
setNonlinearExpressionTreeNumber(int number)
set the number of nonlinear expression trees to add. |
boolean |
setObjectiveNumber(int number)
set the objective number. |
boolean |
setObjectives(int number,
java.lang.String[] names,
java.lang.String[] maxOrMins,
double[] constants,
double[] weights,
SparseVector[] objectitiveCoefficients)
set all the objectives related elements. |
boolean |
setQuadraticTerms(int number,
int[] rowIndexes,
int[] varOneIndexes,
int[] varTwoIndexes,
double[] coefficients,
int begin,
int end)
set quadratic terms |
boolean |
setVariableNumber(int number)
set the variable number. |
boolean |
setVariables(int number,
java.lang.String[] names,
double[] lowerBounds,
double[] upperBounds,
char[] types,
double[] inits,
java.lang.String[] initsString)
set all the variable related elements. |
java.lang.String |
writeOSiL()
write the OSInstance to an osil xml string. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public InstanceHeader instanceHeader
public InstanceData instanceData
Constructor Detail |
---|
public OSInstance()
Method Detail |
---|
public OSInstance readOSiL(java.lang.String osil, boolean isFile, boolean validate) throws java.lang.Exception
osil
- holds the optimization instance in a string which format follows the
Optimization Services instance Language (OSiL) schema.isFile
- holds whether the osil string is a file name or a string that literally holds the osil instance.validate
- holds whether the reader should be validating against the schema or not.
java.lang.Exception
- if there are errors in reading the string or setting the OSInstnace.public java.lang.String writeOSiL() throws java.lang.Exception
java.lang.Exception
- if there are errors in writing the osil string.public java.lang.String getInstanceName()
public java.lang.String getInstanceSource()
public java.lang.String getInstanceDescription()
public int getVariableNumber()
public java.lang.String[] getVariableNames() throws java.lang.Exception
java.lang.Exception
- if the elements in variables are logically inconsistent.public double[] getVariableInitialValues() throws java.lang.Exception
java.lang.Exception
- if the elements in variables are logically inconsistent.public java.lang.String[] getVariableInitialStringValues() throws java.lang.Exception
java.lang.Exception
- if the elements in variables are logically inconsistent.public char[] getVariableTypes() throws java.lang.Exception
java.lang.Exception
- if the elements in variables are logically inconsistent.public double[] getVariableLowerBounds() throws java.lang.Exception
java.lang.Exception
- if the elements in variables are logically inconsistent.public double[] getVariableUpperBounds() throws java.lang.Exception
java.lang.Exception
- if the elements in variables are logically inconsistent.public int getObjectiveNumber()
public java.lang.String[] getObjectiveNames() throws java.lang.Exception
java.lang.Exception
- if the elements in objectives are logically inconsistent.public java.lang.String[] getObjectiveMaxOrMins() throws java.lang.Exception
java.lang.Exception
- if the elements in objectives are logically inconsistent.public int[] getObjectiveCoefficientNumbers() throws java.lang.Exception
java.lang.Exception
- if the elements in objectives are logically inconsistent.public double[] getObjectiveConstants() throws java.lang.Exception
java.lang.Exception
- if the elements in objectives are logically inconsistent.public double[] getObjectiveWeights() throws java.lang.Exception
java.lang.Exception
- if the elements in objectives are logically inconsistent.public SparseVector[] getObjectiveCoefficients() throws java.lang.Exception
java.lang.Exception
- if the elements in objectives are logically inconsistent.SparseVector
public double[][] getDenseObjectiveCoefficients() throws java.lang.Exception
java.lang.Exception
- if the elements in objectives are logically inconsistent.public int getConstraintNumber()
public java.lang.String[] getConstraintNames() throws java.lang.Exception
java.lang.Exception
- if the elements in constraints are logically inconsistent.public double[] getConstraintLowerBounds() throws java.lang.Exception
java.lang.Exception
- if the elements in constraints are logically inconsistent.public double[] getConstraintUpperBounds() throws java.lang.Exception
java.lang.Exception
- if the elements in constraints are logically inconsistent.public double[] getConstraintConstants() throws java.lang.Exception
java.lang.Exception
- if the elements in constraints are logically inconsistent.public char[] getConstraintTypes() throws java.lang.Exception
java.lang.Exception
- if the elements in constraints are logically inconsistent.public int getLinearConstraintCoefficientNumber()
public boolean getLinearConstraintCoefficientMajor() throws java.lang.Exception
java.lang.Exception
- if the elements in linear constraint coefficients are logically inconsistent.public SparseMatrix getLinearConstraintCoefficientsInColumnMajor() throws java.lang.Exception
java.lang.Exception
- if the elements in linear constraint coefficients are logically inconsistent.SparseMatrix
public SparseMatrix getLinearConstraintCoefficientsInRowMajor() throws java.lang.Exception
java.lang.Exception
- if the elements in linear constraint coefficients are logically inconsistent.SparseMatrix
public MatrixMarket getLinearConstraintCoefficientsInMatrixMarket() throws java.lang.Exception
java.lang.Exception
- if the elements in linear constraint coefficients are logically inconsistent.MatrixMarket
public int getQuadraticTermNumber()
public QuadraticTerms getQuadraticTerms() throws java.lang.Exception
java.lang.Exception
- if the elements in quadratic coefficients are logically inconsistent.QuadraticTerms
public int[] getQuadraticRowIndexes() throws java.lang.Exception
java.lang.Exception
- if the elements in quadratic expressions are logically inconsistent.public int getNonlinearExpressionTreeNumber() throws java.lang.Exception
java.lang.Exception
- if the elements in nonlinear expressions are logically inconsistent.public int[] getNonlinearExpressionTreeIndexes() throws java.lang.Exception
java.lang.Exception
- if the elements in nonlinear expressions are logically inconsistent.public OSExpressionTree[] getNonlinearExpressionTrees() throws java.lang.Exception
java.lang.Exception
- if the elements in nonlinear expressions are logically inconsistent.OSExpressionTree
public OSExpressionTree getNonlinearExpressionTree(int index) throws java.lang.Exception
index
- holds the row index (objective or constraint) to which the nonlinear expression tree belongs.
Constraint indexes start from 0, 1, 2, ... up.
Objective indexes start from -1, -2, -3, ... down.
java.lang.Exception
- if the elements in nonlinear expressions are logically inconsistent.OSExpressionTree
public java.lang.String[] getNonlinearExpressionTreeInPrefix(int index) throws java.lang.Exception
index
- holds the row index (objective or constraint) to which the nonlinear expression tree belongs.
Constraint indexes start from 0, 1, 2, ... up.
Objective indexes start from -1, -2, -3, ... down.
java.lang.Exception
- if the elements in nonlinear expressions are logically inconsistent.OSExpressionTree
public java.lang.String[] getNonlinearExpressionTreeInPostfix(int index) throws java.lang.Exception
index
- holds the row index (objective or constraint) to which the nonlinear expression tree belongs.
Constraint indexes start from 0, 1, 2, ... up.
Objective indexes start from -1, -2, -3, ... down.
java.lang.Exception
- if the elements in nonlinear expressions are logically inconsistent.OSExpressionTree
public java.lang.String[] getNonlinearExpressionTreeInInfix(int index) throws java.lang.Exception
index
- holds the row index (objective or constraint) to which the nonlinear expression tree belongs.
Constraint indexes start from 0, 1, 2, ... up.
Objective indexes start from -1, -2, -3, ... down.
java.lang.Exception
- if the elements in nonlinear expressions are logically inconsistent.OSExpressionTree
public double calculateLinearFunctionValue(int index, double[] x)
index
- holds the row number to which the linear function belongs. Negative row indicates an objective function.x
- holds the values of the variables in a double array.
public double[] calculateLinearConstraintFunctionValues(double[] x)
x
- holds the values of the variables in a double array.
public double calculateQuadraticFunctionValue(int index, double[] x)
index
- holds the row number to which the quadratic function belongs. Negative row indicates an objective function.x
- holds the values of the variables in a double array.
public double[] calculateQuadraticConstraintFunctionValues(double[] x)
x
- holds the values of the variables in a double array.
public double calculateNonlinearExpressionValue(int index, double[] x)
index
- holds the row number to which the nonlinear function belongs. if negative, it is an objective function.x
- holds the values of the variables in a double array.functionEvaluated
- holds whether the function has been evaluated.
public double calculateFunctionValue(int index, double[] x)
index
- holds the row number to which the function belongs. if negative, it is an objective function.x
- holds the values of the variables in a double array.
public double[] calculateConstraintFunctionValues(double[] x)
x
- holds the values of the variables in a double array.
public SparseVector calculateNonlinearExpressionGradients(int index, double[] x, boolean functionEvaluated)
index
- holds the row number to which the nonlinear expression belongs. If negative, it's an objective function.x
- holds the values of the variables in a double array.functionEvaluated
- holds whether the function has been evaluated.
The SparseVector
class holds a two array data structure (indexes, values). The indexes are not ordered.
SparseVector
public SparseVector calculateFunctionGradients(int index, double[] x, boolean functionEValuated)
public SparseVector[] calculateFunctionGradients(double[] x, boolean functionEValuated)
public MatrixMarket calculateNonlinearExpressionHessian(int index, double[] x, boolean gradientEvaluated)
index
- holds the row number to which the nonlinear expression belongs. If negative, it's an objective function.x
- holds the values of the variables in a double array.functionEvaluated
- holds whether the function has been evaluated.
The MatrixMarket
class holds the matrix market
data structure (rowIndex, columnIndex, Value[rowIndex,columnIndex]) hessian values.
MatrixMarket
public MatrixMarket calculateFunctionHessian(int index, double[] x, boolean gradientEvaluated)
public MatrixMarket calculateLagragianFunctionHessian(int objectiveIndex, double[] x, double[] weights, boolean gradientEvaluated)
public double[] calculateLagragianFunctionHessianTimesVector(int objectiveIndex, double[] x, double[] weights, double[] vector, boolean gradientEvaluated)
public boolean setInstanceSource(java.lang.String source)
source
- holds the instance source.
public boolean setInstanceDescription(java.lang.String description)
description
- holds the instance description.
public boolean setInstanceName(java.lang.String name)
name
- holds the instance name.
public boolean setVariableNumber(int number)
number
- holds the variable number.
public boolean addVariable(int index, java.lang.String name, double lowerBound, double upperBound, char type, double init, java.lang.String initString)
index
- holds the variable index. It is required.name
- holds the variable name; use null or empty string ("") if no variable name.lowerBound
- holds the variable lower bound; use Double.NEGATIVE_INFINITY if no lower bound.upperBound
- holds the variable upper bound; use Double.POSITIVE_INFINITY if no upper bound.type
- holds the variable type character, B for Binary, I for Integer, S for String, C or any other char for Continuous)init
- holds the double variable initial value; use Double.NaN if no initial value.initString
- holds the string variable initial value; use null or empty string ("") if no initial string value.
public boolean setVariables(int number, java.lang.String[] names, double[] lowerBounds, double[] upperBounds, char[] types, double[] inits, java.lang.String[] initsString)
number
- holds the number of variables. It is required.names
- holds a string array of variable names; use null if no variable names.lowerBounds
- holds a double array of variable lower bounds; use null all lower bounds are 0; use Double.NEGATIVE_INFINITY if no lower bound for a specific variable in the array.upperBounds
- holds a double array of variable upper bounds; use null if no upper bounds; use Double.POSITIVE_INFINITY if no upper bound for a specific variable in the array.types
- holds a char array of variable types; use null if all variables are continuous;
for a specfic variable in the array use B for Binary, I for Integer, S for String, C or any other char for Continuous,)inits
- holds a double array of varible initial values; use null if no initial values.initsString
- holds a string array of varible initial values; use null if no initial string values.
public boolean setObjectiveNumber(int number)
number
- holds the objective number.
public boolean addObjective(int index, java.lang.String name, java.lang.String maxOrMin, double constant, double weight, SparseVector objectiveCoefficients)
index
- holds the objective index. Remember the first objective index is -1, second -2, ...name
- holds the objective name; use null or empty string ("") if no objective name.maxOrMin
- holds the objective sense or direction; it can only take two values: "max" or "min".constant
- holds the objective constant; use 0.0 if no objective constant.weight
- holds the objective weight; use 1.0 if no objective weight.objectiveCoefficients
- holds the objective coefficients (null if no objective coefficients) in a sparse
representation that holds two arrays: index array and a value array.
public boolean setObjectives(int number, java.lang.String[] names, java.lang.String[] maxOrMins, double[] constants, double[] weights, SparseVector[] objectitiveCoefficients)
number
- holds the number of objectives. It is required.names
- holds a string array of objective names; use null if no objective names.maxOrMins
- holds a string array of objective objective senses or directions: "max" or "min"; use null if all objectives are "min".constants
- holds a double array of objective constants; use null if all objective constants are 0.0.weights
- holds a double array of objective weights; use null if all objective weights are 1.0.objectitiveCoefficients
- holds an array of objective coefficients, (null if no objective have any coefficeints)
For each objective, the coefficients are stored in a sparse representation that holds two arrays: index array and a value array.
If for a specific objective, there are no objecitve coefficients, use null for the corresponding array member.
public boolean setConstraintNumber(int number)
number
- holds the constraint number.
public boolean addConstraint(int index, java.lang.String name, double lowerBound, double upperBound, double constant)
index
- holds the constraint index. It is required.name
- holds the constraint name; use null or empty string ("") if no constraint name.lowerBound
- holds the constraint lower bound; use Double.NEGATIVE_INFINITY if no lower bound.upperBound
- holds the constraint upper bound; use Double.POSITIVE_INFINITY if no upper bound.constant
- holds the constraint constant.
public boolean setConstraints(int number, java.lang.String[] names, double[] lowerBounds, double[] upperBounds, double[] constants)
number
- holds the number of constraints. It is required.names
- holds a string array of constraint names; use null if no constraint names.lowerBounds
- holds a double array of constraint lower bounds; use null if no lower bounds; use Double.NEGATIVE_INFINITY if no lower bound for a specific constraint in the array.upperBounds
- holds a double array of constraint upper bounds; use null if no upper bounds; use Double.POSITIVE_INFINITY if no upper bound for a specific constraint in the array.constants
- holds a double array of constraint constants, use null if all are zeros.
public boolean setLinearConstraintCoefficients(int number, boolean isColumnMajor, double[] values, int valuesBegin, int valuesEnd, int[] indexes, int indexesBegin, int indexesEnd, int[] starts, int startsBegin, int startsEnd)
number
- holds the number of specified coefficient values (usually nonzero) in the coefficient matrix.isColumnMajor
- holds whether the coefficient matrix is stored in column major (true) or row major (false).values
- holds a double array coefficient values in the matrix.valuesBegin
- holds the begin index of the values array to copy from (usually 0).valuesEnd
- holds the end index of the values array to copy till (usually values.lenght - 1).indexes
- holds an integer array column/row indexes for each value in the values array.indexesBegin
- holds the begin index of the indexes array to copy from (usually 0).indexesEnd
- holds the end index of the indexes array to copy till (usually indexes.lenght - 1).starts
- holds an integer array start indexes in the matrix; the first value of starts should always be 0.startsBegin
- holds the begin index of the starts array to copy from (usually 0).startsEnd
- holds the end index of the starts array to copy till (usually starts.lenght - 1).
public boolean setQuadraticTerms(int number, int[] rowIndexes, int[] varOneIndexes, int[] varTwoIndexes, double[] coefficients, int begin, int end)
number
- holds the number of quadratic terms.rowIndexes
- holds an integer array of row indexes of all the quadratic terms.
A negative integer corresponds to an objective row, e.g. -1 for 1st objective and -2 for 2nd.varOneIndexes
- holds an integer array of the first varialbe indexes of all the quadratic terms.varTwoIndexes
- holds an integer array of the second varialbe indexes of all the quadratic terms.coefficients
- holds a double array all the quadratic term coefficients.begin
- holds the begin index of all the arrays to copy from (usually = 0).end
- holds the end index of all the arrays to copy till (usually = array length -1).
public boolean setNonlinearExpressionTreeNumber(int number)
number
- holds the nonlinear expression tree number.
public boolean addNonlinearExpressionTree(int index, OSExpressionTree osExpressionTree)
index
- holds the row the nonlienar expression tree belongs to. If negative, it is an objective function.osExpressionTree
- holds the os expression.
org.optimizationservices.oscommon.nonlinear.OSExpressionTree;
public boolean addNonlinearExpressionTree(int index, java.lang.String[] tokens, int start, int end, java.lang.String fixType)
index
- holds the row the nonlienar expression tree belongs to. If negative, it is an objective function.tokens
- holds a string array of the tokenized expression, in either postfix, prefix, or infix.
The operator name in each token has to be exactly the same as the name specified in the OSnL Schema.
The operator name in the token may be followed (without space) by a sequence of ":atrributeValue" and end with
[i] to indicate the number of arguments the operator can take if the operator's type is indefinite.
The attributes specified have to follow the sequence in the OSnL schema.
If one attribute is specified, all attributes have to be specified together. If an attribute
are missing, an empty string has to be in place. Two alternative exception can be allowed for variable
and number. A number can just a a numeric value and the variable can take the form Xi where i is the
integer index of capital letter X.fixType
- holds whether the expression is in postfix, prefix or infixstart
- holds the index of the tokenizedExpression to start processing (ususually 0).end
- holds the index of the tokenizedExpression to finish processing (usually tokens.length-1).
public static void main(java.lang.String[] args)
argv
- command line arguments.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |