|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.optimizationservices.oscommon.localinterface.OSResult
public class OSResult
The OSResult
class is a local interface for storing Optimization Services
problem result. Its design follows the Optimization Services result Language (OSrL).
All the data structures in this class are standards specified in OSrL.
Developers can add service-specific results by extending this class.
OSInstance
,
OSAnalysis
,
OSOption
Field Summary | |
---|---|
ResultData |
resultData
resultData holds the second child of the OSResult specified by the OSiL Schema. |
ResultHeader |
resultHeader
resultHeader holds the first child of the OSResult specified by the OSiL Schema. |
Constructor Summary | |
---|---|
OSResult()
Default constructor. |
Method Summary | |
---|---|
double |
getAvailableDiskSpace()
Get the available disk space (in bytes). |
double |
getAvailableMemory()
Get the available memory (in bytes). |
int |
getConstraintNumber()
Get constraint number. |
int |
getCurrentJobCount()
Get the current job count. |
java.lang.String |
getCurrentState()
Get the current state, , which can be: "busy", "busyButAccepting", "idle", "idleButNotAccepting" and "noResponse". |
double[] |
getDualVariableValues(int solIdx)
Get the [i]th optimization solution's dual variable values, where i equals the given solution index. |
java.lang.String |
getGeneralMessage()
Get the general message. |
GeneralStatus |
getGeneralStatus()
Get the general status. |
java.lang.String |
getGeneralStatusDescription()
Get the general status description. |
java.lang.String |
getGeneralStatusType()
Get the general status type, which can be: success, error, warning. |
java.lang.String |
getInstanceName()
Get instance name. |
java.lang.String |
getJobID()
Get the job id. |
JobStatistics[] |
getJobStatistics()
Get the statistics of all the jobs. |
int |
getObjectiveNumber()
Get objective number. |
double[] |
getObjectiveValues(int solIdx)
Get the [i]th optimization solution's objective values, where i equals the given solution index. |
double[] |
getOptimalDualVariableValues(int objIdx)
Get one solution of optimal dual variable values. |
java.lang.String[] |
getOptimalPrimalVariableStringValues(int objIdx)
Get one solution of optimal primal variable string values. |
double[] |
getOptimalPrimalVariableValues(int objIdx)
Get one solution of optimal primal variable values. |
OSAnalysis |
getOSAnalysis()
Get the optimization analysis in the standard OSAnalysis data structure. |
OtherConstraintResult[] |
getOtherConstraintResults(int solIdx)
Get the [i]th optimization solution's other (non-standard/solver specific)constraint-related results, where i equals the given solution index. |
OtherObjectiveResult[] |
getOtherObjectiveResults(int solIdx)
Get the [i]th optimization solution's other (non-standard/solver specific)objective-related results, where i equals the given solution index. |
OtherOptimizationResult[] |
getOtherOptimizationResults(int solIdx)
Get the [i]th optimization solution's other (non-standard/solver specific)optimization-related results, where i equals the given solution index. |
java.util.Hashtable<java.lang.String,java.lang.String> |
getOtherResultDescriptions()
get a hashmap of other result descriptions. |
java.lang.String[] |
getOtherResultNames()
get a string array of names of other results. |
java.util.Hashtable<java.lang.String,java.lang.String> |
getOtherResultValues()
get a hashmap of other result values. |
OtherVariableResult[] |
getOtherVariableResults(int solIdx)
Get the [i]th optimization solution's other (non-standard/solver specific)variable-related results, where i equals the given solution index. |
ProcessStatistics |
getProcessStatistics()
Get the process statistics. |
java.util.GregorianCalendar |
getResultTime()
Get time of the result. |
java.lang.String |
getServiceName()
Get service name. |
java.lang.String |
getServiceURI()
Get service uri. |
double |
getServiceUtilization()
Get the service utilization ([0, 1]). |
OptimizationSolution |
getSolution(int solIdx)
Get the [i]th optimization solution, where i equals the given solution index. |
java.lang.String |
getSolutionMessage(int solIdx)
Get the [i]th optimization solution message, where i equals the given solution index. |
int |
getSolutionNumber()
get the number of solutions. |
int |
getSolutionObjectiveIndex(int solIdx)
Get the [i]th optimization solution's objective index, where i equals the given solution index. |
OptimizationSolutionStatus |
getSolutionStatus(int solIdx)
Get the [i]th optimization solution status, where i equals the given solution index. |
java.lang.String |
getSolutionStatusDescription(int solIdx)
Get the [i]th optimization solution status description, where i equals the given solution index. |
java.lang.String |
getSolutionStatusType(int solIdx)
Get the [i]th optimization solution status type, where i equals the given solution index. |
OptimizationSolutionSubstatus[] |
getSolutionSubStatuses(int solIdx)
Get the [i]th optimization solution subStatuses, where i equals the given solution index. |
DualVariableValues |
getSparseDualVariableValues(int solIdx)
Get the [i]th optimization solution's dual variable values in a sparse data structure, where i equals the given solution index. |
VariableValues |
getSparseVariableValues(int solIdx)
Get the [i]th optimization solution's variable values in a sparse data structure, where i equals the given solution index. |
java.util.GregorianCalendar |
getTimeLastJobEnded()
Get the time last job ended. |
double |
getTimeLastJobTook()
Get the time last job took (in seconds). |
java.util.GregorianCalendar |
getTimeServiceStarted()
Get the time the service started. |
int |
getTotalJobsSoFar()
Get the total jobs received so far. |
int |
getVariableNumber()
Get variable number. |
double[] |
getVariableStringValues(int solIdx)
Get the [i]th optimization solution's variable string values, where i equals the given solution index. |
double[] |
getVariableValues(int solIdx)
Get the [i]th optimization solution's variable values, where i equals the given solution index. |
static void |
main(java.lang.String[] args)
main for test purposes. |
OSResult |
readOSrL(java.lang.String osrl,
boolean isFile,
boolean validate)
read an OSrL instance and return and OSResult object. |
boolean |
setAvailableDiskSpace(double availableDiskSpace)
Set the available disk space. |
boolean |
setAvailableMemory(double availableMemory)
Set the available memory (in bytes). |
boolean |
setConstraintNumber(int constraintNumber)
Set the constraint number. |
boolean |
setCurrentJobCount(int currentJobCount)
Set the current job count. |
boolean |
setCurrentState(java.lang.String currentState)
Set the current state. |
boolean |
setDualVariableValues(int solIdx,
double[] values)
Set the [i]th optimization solution's dual variable values, where i equals the given solution index. |
boolean |
setGeneralMessage(java.lang.String message)
Set the general message. |
boolean |
setGeneralStatus(GeneralStatus status)
Set the general status |
boolean |
setGeneralStatusDescription(java.lang.String description)
Set the general status description. |
boolean |
setGeneralStatusType(java.lang.String type)
Set the general status type, which can be: success, error, warning. |
boolean |
setInstanceName(java.lang.String instanceName)
Set instance name. |
boolean |
setJobID(java.lang.String jobID)
Set job id. |
boolean |
setJobStatistics(JobStatistics[] jobStatistics)
Set the statistics of all jobs. |
boolean |
setObjectiveNumber(int objectiveNumber)
Set the objective number. |
boolean |
setObjectiveValues(int solIdx,
double[] objectiveValues)
Set the [i]th optimization solution's objective values, where i equals the given solution index. |
boolean |
setOSAnalysis(OSAnalysis osAnalysis)
Set the optimization analysis. |
boolean |
setOtherConstraintResults(int solIdx,
OtherConstraintResult[] otherConstraintResults)
Set the [i]th optimization solution's other (non-standard/solver specific)constraint-related results, where i equals the given solution index. |
boolean |
setOtherObjectiveResults(int solIdx,
OtherObjectiveResult[] otherObjectiveResults)
Set the [i]th optimization solution's other (non-standard/solver specific)objective-related results, where i equals the given solution index. |
boolean |
setOtherOptimizationResults(int solIdx,
OtherOptimizationResult[] otherOptimizationResults)
Set the [i]th optimization solution's other (non-standard/solver specific)optimization-related results, where i equals the given solution index. |
boolean |
setOtherResults(java.lang.String[] names,
java.lang.String[] descriptions,
java.lang.String[] values)
set other results, with their names (required), descriptions (optional) and values (optional). |
boolean |
setOtherVariableResults(int solIdx,
OtherVariableResult[] otherVariableResults)
Set the [i]th optimization solution's other (non-standard/solver specific)variable-related results, where i equals the given solution index. |
boolean |
setPrimalVariableStringValues(int solIdx,
java.lang.String[] x)
Set the [i]th optimization solution's primal variable string values, where i equals the given solution index. |
boolean |
setPrimalVariableValues(int solIdx,
double[] x)
Set the [i]th optimization solution's primal variable values, where i equals the given solution index. |
boolean |
setProcessStatistics(ProcessStatistics processStatistics)
Set the process statistics. |
boolean |
setResultTime(java.util.GregorianCalendar time)
Set time of the result. |
boolean |
setServiceName(java.lang.String serviceName)
Set service name. |
boolean |
setServiceURI(java.lang.String serviceURI)
Set service uri. |
boolean |
setServiceUtilization(double serviceUtilization)
Set the service utilization. |
boolean |
setSolution(int solIdx,
OptimizationSolution solution)
Set the [i]th optimization solution, where i equals the given solution index. |
boolean |
setSolutionMessage(int solIdx,
java.lang.String solutionMessage)
Set the [i]th optimization solution message, where i equals the given solution index. |
boolean |
setSolutionNumber(int solutionNumber)
set the number of solutions. |
boolean |
setSolutionObjectiveIndex(int solIdx,
int objectiveIdx)
Set the [i]th optimization solution's objective index, where i equals the given solution index. |
boolean |
setSolutionStatus(int solIdx,
OptimizationSolutionStatus status)
Set the [i]th optimization solution status, where i equals the given solution index. |
boolean |
setSolutionStatus(int solIdx,
java.lang.String type,
java.lang.String description,
OptimizationSolutionSubstatus[] subStatuses)
Set the [i]th optimization solution status, where i equals the given solution index. |
boolean |
setTimeLastJobEnded(java.util.GregorianCalendar timeLastJobEnded)
Set the time last job ended. |
boolean |
setTimeLastJobTook(double timeLastJobTook)
Set the time last job took. |
boolean |
setTimeServiceStarted(java.util.GregorianCalendar timeServiceStarted)
Set the time the service started. |
boolean |
setTotalJobsSoFar(int totalJobsSoFar)
Set the total jobs received so far. |
boolean |
setVariableNumber(int variableNumber)
Set the variable number. |
java.lang.String |
writeOSrL()
write the OSResult to an osrl xml string. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public ResultHeader resultHeader
public ResultData resultData
Constructor Detail |
---|
public OSResult()
Method Detail |
---|
public OSResult readOSrL(java.lang.String osrl, boolean isFile, boolean validate) throws java.lang.Exception
osrl
- holds the optimization result in a string which format follows the
Optimization Services result Language (OSrL) schema.isFile
- holds whether the osrl string is a file name or a string that literally holds the osrl contents.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 OSResult.public java.lang.String writeOSrL() throws java.lang.Exception
java.lang.Exception
- if there are errors in writing the osrl string.public GeneralStatus getGeneralStatus()
public java.lang.String getGeneralStatusType()
public java.lang.String getGeneralStatusDescription()
public java.lang.String getServiceName()
public java.lang.String getServiceURI()
public java.lang.String getInstanceName()
public java.lang.String getJobID()
public java.util.GregorianCalendar getResultTime()
public java.lang.String getGeneralMessage()
public ProcessStatistics getProcessStatistics()
public JobStatistics[] getJobStatistics()
public java.lang.String getCurrentState()
public double getAvailableDiskSpace()
public double getAvailableMemory()
public int getCurrentJobCount()
public int getTotalJobsSoFar()
public java.util.GregorianCalendar getTimeLastJobEnded()
public double getTimeLastJobTook()
public java.util.GregorianCalendar getTimeServiceStarted()
public double getServiceUtilization()
public java.lang.String[] getOtherResultNames()
public java.util.Hashtable<java.lang.String,java.lang.String> getOtherResultDescriptions()
public java.util.Hashtable<java.lang.String,java.lang.String> getOtherResultValues()
public int getVariableNumber()
public int getObjectiveNumber()
public int getConstraintNumber()
public double[] getOptimalPrimalVariableValues(int objIdx)
objIdx
- holds the objective index the optimal value corresponds to.
public java.lang.String[] getOptimalPrimalVariableStringValues(int objIdx)
objIdx
- holds the objective index the optimal value corresponds to.
public double[] getOptimalDualVariableValues(int objIdx)
objIdx
- holds the objective index the optimal value corresponds to.
public int getSolutionNumber()
public OptimizationSolution getSolution(int solIdx)
solIdx
- holds the solution index to get the solution.
public OptimizationSolutionStatus getSolutionStatus(int solIdx)
solIdx
- holds the solution index to get the solution status.
OptimizationSolutionStatus
public java.lang.String getSolutionStatusType(int solIdx)
solIdx
- holds the solution index to get the solution status type.
public java.lang.String getSolutionStatusDescription(int solIdx)
solIdx
- holds the solution index to get the solution status description.
public OptimizationSolutionSubstatus[] getSolutionSubStatuses(int solIdx)
solIdx
- holds the solution index to get the solution substatuses.
org.optimizationservices.oscommon.datastructure.osresult.OptimizationSolutionSubstatus;
public java.lang.String getSolutionMessage(int solIdx)
solIdx
- holds the solution index to get the solution message.
public int getSolutionObjectiveIndex(int solIdx)
solIdx
- holds the solution index to get the variable string values.
public double[] getVariableValues(int solIdx)
solIdx
- holds the solution index to get the variable values.
public VariableValues getSparseVariableValues(int solIdx)
solIdx
- holds the solution index to get the sparse variable values.
VariableValues
,
VarValue
public double[] getVariableStringValues(int solIdx)
solIdx
- holds the solution index to get the variable string values.
public OtherVariableResult[] getOtherVariableResults(int solIdx)
solIdx
- holds the solution index to get the other variable results.
OtherVariableResult
,
OtherVarResult
public double[] getObjectiveValues(int solIdx)
solIdx
- holds the solution index to get the objective values.
public OtherObjectiveResult[] getOtherObjectiveResults(int solIdx)
solIdx
- holds the solution index to get the other objective results.
OtherObjectiveResult
,
OtherObjResult
public double[] getDualVariableValues(int solIdx)
solIdx
- holds the solution index to get the dual variable values.
public DualVariableValues getSparseDualVariableValues(int solIdx)
solIdx
- holds the solution index to get the sparse dual variable values.
DualVariableValues
,
DualVarValue
public OtherConstraintResult[] getOtherConstraintResults(int solIdx)
solIdx
- holds the solution index to get the other constraint results.
OtherConstraintResult
,
OtherConResult
public OtherOptimizationResult[] getOtherOptimizationResults(int solIdx)
solIdx
- holds the solution index to get the other optimization results.
OtherOptimizationResult
public OSAnalysis getOSAnalysis()
OSAnalysis
public boolean setServiceName(java.lang.String serviceName)
serviceName
- holds the name of the service.
public boolean setServiceURI(java.lang.String serviceURI)
serviceURI
- holds the uri of the service.
public boolean setInstanceName(java.lang.String instanceName)
instanceName
- holds the name of the instance.
public boolean setJobID(java.lang.String jobID)
jobID
- holds the job id.
public boolean setResultTime(java.util.GregorianCalendar time)
time
- holds the time of the result.
public boolean setGeneralMessage(java.lang.String message)
message
- holds the general message.
public boolean setGeneralStatus(GeneralStatus status)
status
- holds the general status.
public boolean setGeneralStatusType(java.lang.String type)
type
- holds the general status type
public boolean setGeneralStatusDescription(java.lang.String description)
description
- holds the general status description.
public boolean setProcessStatistics(ProcessStatistics processStatistics)
processStatistics
- holds the process statistics.
public boolean setJobStatistics(JobStatistics[] jobStatistics)
jobStatistics
- holds an array of jobStatistics with
each member corresponding to one job.
public boolean setCurrentState(java.lang.String currentState)
currentState
- holds the current state, which can be:
"busy", "busyButAccepting", "idle", "idleButNotAccepting" or "noResponse".
public boolean setAvailableDiskSpace(double availableDiskSpace)
availableDiskSpace
- holds the available disk space (in bytes).
public boolean setAvailableMemory(double availableMemory)
availableMemory
- holds the available memory.
public boolean setCurrentJobCount(int currentJobCount)
currentJobCount
- holds the current job count.
public boolean setTotalJobsSoFar(int totalJobsSoFar)
totalJobsSoFar
- holds the total jobs received so far.
public boolean setTimeLastJobEnded(java.util.GregorianCalendar timeLastJobEnded)
timeLastJobEnded
- holds the time last job ended.
public boolean setTimeLastJobTook(double timeLastJobTook)
timeLastJobTook
- holds the time last job took (in seconds).
public boolean setTimeServiceStarted(java.util.GregorianCalendar timeServiceStarted)
timeServiceStarted
- holds the time the service started.
public boolean setServiceUtilization(double serviceUtilization)
serviceUtilization
- holds the service utilization ([0, 1]).
public boolean setOtherResults(java.lang.String[] names, java.lang.String[] descriptions, java.lang.String[] values)
names
- holds the names of the other results; it is required.descriptions
- holds the descriptions of the other results; null if none.values
- holds the values of the other results; null if none.
public boolean setVariableNumber(int variableNumber)
variableNumber
- holds the number of variables
public boolean setObjectiveNumber(int objectiveNumber)
objectiveNumber
- holds the number of objectives
public boolean setConstraintNumber(int constraintNumber)
constraintNumber
- holds the number of constraints
public boolean setSolutionNumber(int solutionNumber)
solutionNumber
- holds the number of solutions to set.
setVariableNumber(int)
,
setObjectiveNumber(int)
,
setConstraintNumber(int)
public boolean setSolution(int solIdx, OptimizationSolution solution)
solIdx
- holds the solution index to set the solution.solution
- holds the optimization solution to set.
OptimizationSolution
,
setSolutionNumber(int)
public boolean setSolutionStatus(int solIdx, OptimizationSolutionStatus status)
solIdx
- holds the solution index to set the solution status.status
- holds the optimization solution status to set.
OptimizationSolutionStatus
,
setSolutionNumber(int)
public boolean setSolutionStatus(int solIdx, java.lang.String type, java.lang.String description, OptimizationSolutionSubstatus[] subStatuses)
solIdx
- holds the solution index to set the solution status.type
- holds the optimization solution status type to set; it is required.
The solution status type can be:
unbounded, globallyOptimal, locallyOptimal, optimal, bestSoFar, feasible, infeasible,
stoppedByLimit, unsure, error, otherdescription
- holds the optimization solution status description to set, null or empty string if none.subStatus
- holds an array of optimization solution subStatuses to set, null if none.
OptimizationSolutionStatus
,
org.optimizationservices.oscommon.datastructure.osresult.OptimizationSolutionSubStatus
,
setSolutionNumber(int)
public boolean setSolutionMessage(int solIdx, java.lang.String solutionMessage)
solIdx
- holds the solution index to set the solution message.solutionMessage
- holds the solution message to set.
setSolutionNumber(int)
public boolean setSolutionObjectiveIndex(int solIdx, int objectiveIdx)
solIdx
- holds the solution index to set the objective index.objectiveIdx
- holds the objective index to set.
All the objective indexes are negative starting from -1 downward.
setSolutionNumber(int)
public boolean setPrimalVariableValues(int solIdx, double[] x)
solIdx
- holds the solution index to set the primal variable values.x
- holds a double dense array of variable values to set; it could be null if all variables are 0.
setSolutionNumber(int)
public boolean setPrimalVariableStringValues(int solIdx, java.lang.String[] x)
solIdx
- holds the solution index to set the primal variable string values.x
- holds a dense string array of variable string values to set.
setSolutionNumber(int)
public boolean setOtherVariableResults(int solIdx, OtherVariableResult[] otherVariableResults)
otherVariableResults
- holds an array of other variable results in OtherVariableResult[] array data structure, null if none.
Each other variable result contains the name (required), an optional description (string) and an optional
value (string). Each other variable result can also optionally contain an array OtherVarResult for each variable.
The OtherVarResult contains a variable idx (required) and an optional string value.
OtherVariableResult
,
OtherVarResult
,
setSolutionNumber(int)
public boolean setObjectiveValues(int solIdx, double[] objectiveValues)
solIdx
- holds the solution index to set the objective values.objectiveValues
- holds a double dense array of objective values to set.
Possibly only the objective that the solution is based on has the value, and the rest of the objective
values all get a Double.NaN value, meaning that they are not calculated.
setSolutionNumber(int)
public boolean setOtherObjectiveResults(int solIdx, OtherObjectiveResult[] otherObjectiveResults)
solIdx
- holds the solution index to set the other objective results.otherObjectiveResults
- holds an array of other objective results in OtherObjectiveResult[] array data structure, null if none.
Each other objective result contains the name (required), an optional description (string) and an optional
value (string). Each other objective result can also optionally contain an array OtherObjResult for each objective.
The OtherObjResult contains an objective idx (required), an optional string value.
OtherObjectiveResult
,
OtherObjResult
,
setSolutionNumber(int)
public boolean setDualVariableValues(int solIdx, double[] values)
solIdx
- holds the solution index to set the dual variable values.values
- holds a double dense array of variable dual values to set; it could be null if all values are 0.
setSolutionNumber(int)
public boolean setOtherConstraintResults(int solIdx, OtherConstraintResult[] otherConstraintResults)
otherConstraintResults
- holds an array of other constraint results in OtherConstraintResult[] array data structure, null if none.
Each other constraint result contains the name (required), an optional description (string) and an optional
value (string). Each other constraint result can also optionally contain an array OtherConstraint for each constraint.
The OtherConResult contains a constraint idx (required) and an optional string value.
OtherConstraintResult
,
OtherConResult
,
setSolutionNumber(int)
public boolean setOtherOptimizationResults(int solIdx, OtherOptimizationResult[] otherOptimizationResults)
otherOptimizationResults
- holds an array of other optimization results in OtherOptimizationResult[] array data structure, null if none.
Each other optimization result contains the name (required), an optional description (string) and an optional
value (string).
OtherOptimizationResult
,
setSolutionNumber(int)
public boolean setOSAnalysis(OSAnalysis osAnalysis)
osAnalysis
- holds the optimization analysis in the standard OSAnalysis data structure.
OSAnalysis
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 |