org.optimizationservices.oscommon.localinterface
Class OSResult

java.lang.Object
  extended by org.optimizationservices.oscommon.localinterface.OSResult

public class OSResult
extends java.lang.Object

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.

Since:
OS 1.0
Version:
1.0, 03/14/2005
Author:
Robert Fourer, Jun Ma, Kipp Martin
See Also:
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

resultHeader

public ResultHeader resultHeader
resultHeader holds the first child of the OSResult specified by the OSiL Schema.


resultData

public ResultData resultData
resultData holds the second child of the OSResult specified by the OSiL Schema.

Constructor Detail

OSResult

public OSResult()
Default constructor.

Method Detail

readOSrL

public OSResult readOSrL(java.lang.String osrl,
                         boolean isFile,
                         boolean validate)
                  throws java.lang.Exception
read an OSrL instance and return and OSResult object.

Parameters:
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.
Returns:
the OSResult object constructed from the OSrL String.
Throws:
java.lang.Exception - if there are errors in reading the string or setting the OSResult.

writeOSrL

public java.lang.String writeOSrL()
                           throws java.lang.Exception
write the OSResult to an osrl xml string.

Returns:
the osrl xml string.
Throws:
java.lang.Exception - if there are errors in writing the osrl string.

getGeneralStatus

public GeneralStatus getGeneralStatus()
Get the general status.

Returns:
the general status.

getGeneralStatusType

public java.lang.String getGeneralStatusType()
Get the general status type, which can be: success, error, warning.

Returns:
the general status type, null if none.

getGeneralStatusDescription

public java.lang.String getGeneralStatusDescription()
Get the general status description.

Returns:
the general status description, null or empty string if none.

getServiceName

public java.lang.String getServiceName()
Get service name.

Returns:
the service name.

getServiceURI

public java.lang.String getServiceURI()
Get service uri.

Returns:
the service uri.

getInstanceName

public java.lang.String getInstanceName()
Get instance name.

Returns:
the instance name.

getJobID

public java.lang.String getJobID()
Get the job id.

Returns:
the job id.

getResultTime

public java.util.GregorianCalendar getResultTime()
Get time of the result.

Returns:
the time of the result.

getGeneralMessage

public java.lang.String getGeneralMessage()
Get the general message.

Returns:
the general message.

getProcessStatistics

public ProcessStatistics getProcessStatistics()
Get the process statistics.

Returns:
the process statistics.

getJobStatistics

public JobStatistics[] getJobStatistics()
Get the statistics of all the jobs.

Returns:
the statistics of all the jobs, which is an array of jobStatistics with each member corresponding to one job; null if none.

getCurrentState

public java.lang.String getCurrentState()
Get the current state, , which can be: "busy", "busyButAccepting", "idle", "idleButNotAccepting" and "noResponse".

Returns:
the current status, "noResponse" if none.

getAvailableDiskSpace

public double getAvailableDiskSpace()
Get the available disk space (in bytes).

Returns:
the available disk space, Double.NaN if none.

getAvailableMemory

public double getAvailableMemory()
Get the available memory (in bytes).

Returns:
the available memory, Double.NaN if none.

getCurrentJobCount

public int getCurrentJobCount()
Get the current job count.

Returns:
the current job count, -1 if none.

getTotalJobsSoFar

public int getTotalJobsSoFar()
Get the total jobs received so far.

Returns:
the total jobs received so far, -1 if none.

getTimeLastJobEnded

public java.util.GregorianCalendar getTimeLastJobEnded()
Get the time last job ended.

Returns:
the time last job ended. If none, it returns unix creation time: GregorianCalendar(1970, 0, 1, 0, 0, 0).

getTimeLastJobTook

public double getTimeLastJobTook()
Get the time last job took (in seconds).

Returns:
the the time last job took, Double.NaN if none.

getTimeServiceStarted

public java.util.GregorianCalendar getTimeServiceStarted()
Get the time the service started.

Returns:
the time last job ended. If none, it returns unix creation time: GregorianCalendar(1970, 0, 1, 0, 0, 0).

getServiceUtilization

public double getServiceUtilization()
Get the service utilization ([0, 1]).

Returns:
the the time last job took, Double.NaN if none.

getOtherResultNames

public java.lang.String[] getOtherResultNames()
get a string array of names of other results.

Returns:
a string array of names of other results, null if no other results.

getOtherResultDescriptions

public java.util.Hashtable<java.lang.String,java.lang.String> getOtherResultDescriptions()
get a hashmap of other result descriptions. The keys of the hashmap are the result names, and the values of the hashmap are the result descriptions.

Returns:
a hashmap of other result descriptions, null if no other results.

getOtherResultValues

public java.util.Hashtable<java.lang.String,java.lang.String> getOtherResultValues()
get a hashmap of other result values. The keys of the hashmap are the result names, and the values of the hashmap are the result values.

Returns:
a hashmap of other result values, null if no other results.

getVariableNumber

public int getVariableNumber()
Get variable number.

Returns:
variable number, -1 if no information.

getObjectiveNumber

public int getObjectiveNumber()
Get objective number.

Returns:
objective number, -1 if no information.

getConstraintNumber

public int getConstraintNumber()
Get constraint number.

Returns:
constraint number, -1 if no information.

getOptimalPrimalVariableValues

public double[] getOptimalPrimalVariableValues(int objIdx)
Get one solution of optimal primal variable values.

Parameters:
objIdx - holds the objective index the optimal value corresponds to.
Returns:
a double dense array of the optimal values, null if no optimal value.

getOptimalPrimalVariableStringValues

public java.lang.String[] getOptimalPrimalVariableStringValues(int objIdx)
Get one solution of optimal primal variable string values.

Parameters:
objIdx - holds the objective index the optimal value corresponds to.
Returns:
a string dense array of the optimal string values, null if no optimal value.

getOptimalDualVariableValues

public double[] getOptimalDualVariableValues(int objIdx)
Get one solution of optimal dual variable values.

Parameters:
objIdx - holds the objective index the optimal value corresponds to.
Returns:
a double dense array of the optimal dual values, null if no optimal value.

getSolutionNumber

public int getSolutionNumber()
get the number of solutions.

Returns:
the number of solutions, 0 if none.

getSolution

public OptimizationSolution getSolution(int solIdx)
Get the [i]th optimization solution, where i equals the given solution index.

Parameters:
solIdx - holds the solution index to get the solution.
Returns:
the optimization solution that corresponds to solIdx, null if none.

getSolutionStatus

public OptimizationSolutionStatus getSolutionStatus(int solIdx)
Get the [i]th optimization solution status, where i equals the given solution index. The solution status includes the status type, optional descriptions and possibly substatuses.

Parameters:
solIdx - holds the solution index to get the solution status.
Returns:
the optimization solution status that corresponds to solIdx, null if none.
See Also:
OptimizationSolutionStatus

getSolutionStatusType

public java.lang.String getSolutionStatusType(int solIdx)
Get the [i]th optimization solution status type, where i equals the given solution index. The solution status type can be: unbounded, globallyOptimal, locallyOptimal, optimal, bestSoFar, feasible, infeasible, stoppedByLimit, unsure, error, other

Parameters:
solIdx - holds the solution index to get the solution status type.
Returns:
the optimization solution status type that corresponds to solIdx, null or empty string if none.

getSolutionStatusDescription

public java.lang.String getSolutionStatusDescription(int solIdx)
Get the [i]th optimization solution status description, where i equals the given solution index.

Parameters:
solIdx - holds the solution index to get the solution status description.
Returns:
the optimization solution status description that corresponds to solIdx, null or empty string if none.

getSolutionSubStatuses

public OptimizationSolutionSubstatus[] getSolutionSubStatuses(int solIdx)
Get the [i]th optimization solution subStatuses, where i equals the given solution index.

Parameters:
solIdx - holds the solution index to get the solution substatuses.
Returns:
an array optimization solution subStatuses that corresponds to solIdx, null or empty string if none.
See Also:
org.optimizationservices.oscommon.datastructure.osresult.OptimizationSolutionSubstatus;

getSolutionMessage

public java.lang.String getSolutionMessage(int solIdx)
Get the [i]th optimization solution message, where i equals the given solution index.

Parameters:
solIdx - holds the solution index to get the solution message.
Returns:
the optimization solution message that corresponds to solIdx, null or empty if none.

getSolutionObjectiveIndex

public int getSolutionObjectiveIndex(int solIdx)
Get the [i]th optimization solution's objective index, where i equals the given solution index. The first objective's index should be -1, the second -2, and so on.

Parameters:
solIdx - holds the solution index to get the variable string values.
Returns:
the optimization objective index that corresponds to solIdx, 0 if none. All the objective indexes are negative starting from -1 downward.

getVariableValues

public double[] getVariableValues(int solIdx)
Get the [i]th optimization solution's variable values, where i equals the given solution index.

Parameters:
solIdx - holds the solution index to get the variable values.
Returns:
a double dense array of variable values, null if no variable values.

getSparseVariableValues

public 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. The sparse data stucture is of the VariableValues data structure. VariableValues holds var[], an array of VarValues. Each var member contains an idx and a value. If var[] is null, all the variable values are 0.

Parameters:
solIdx - holds the solution index to get the sparse variable values.
Returns:
a sparse variable value data structure in VaribleValues, null if no variable values.
See Also:
VariableValues, VarValue

getVariableStringValues

public double[] getVariableStringValues(int solIdx)
Get the [i]th optimization solution's variable string values, where i equals the given solution index.

Parameters:
solIdx - holds the solution index to get the variable string values.
Returns:
a string dense array of variable values, null if no variable values.

getOtherVariableResults

public 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.

Parameters:
solIdx - holds the solution index to get the other variable results.
Returns:
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.
See Also:
OtherVariableResult, OtherVarResult

getObjectiveValues

public double[] getObjectiveValues(int solIdx)
Get the [i]th optimization solution's objective values, where i equals the given solution index. Usually one of the objective is what the solution was solved for (or based on). Its index should be indicated in the solution's objectiveIdx attribute. Based on this objective's solution, the rest of the objective values are (optionally) calculated.

Parameters:
solIdx - holds the solution index to get the objective values.
Returns:
a double dense array of objective values, null if null if no objective values. 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.

getOtherObjectiveResults

public 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.

Parameters:
solIdx - holds the solution index to get the other objective results.
Returns:
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) and an optional string value.
See Also:
OtherObjectiveResult, OtherObjResult

getDualVariableValues

public double[] getDualVariableValues(int solIdx)
Get the [i]th optimization solution's dual variable values, where i equals the given solution index.

Parameters:
solIdx - holds the solution index to get the dual variable values.
Returns:
a double dense array of the dual variable values, null if none.

getSparseDualVariableValues

public 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. The sparse data stucture is of the DualVariableValues data structure. DualVariableValues holds con[], an array of DualVarValues. Each con member contains a constraint idx and a dual value. If con[] is null, all the dual variable values are 0.

Parameters:
solIdx - holds the solution index to get the sparse dual variable values.
Returns:
a sparse variable value data structure in DualVaribleValues, null if no dual variable values.
See Also:
DualVariableValues, DualVarValue

getOtherConstraintResults

public 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.

Parameters:
solIdx - holds the solution index to get the other constraint results.
Returns:
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 OtherConResult for each constraint. The OtherConResult contains a constraint idx (required) and an optional string value.
See Also:
OtherConstraintResult, OtherConResult

getOtherOptimizationResults

public 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. These other results are usually on the general optimization, not specifically on the variables, objective, or constraints.

Parameters:
solIdx - holds the solution index to get the other optimization results.
Returns:
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).
See Also:
OtherOptimizationResult

getOSAnalysis

public OSAnalysis getOSAnalysis()
Get the optimization analysis in the standard OSAnalysis data structure.

Returns:
the optimization analysis in the standard OSAnalysis data structure, null if none.
See Also:
OSAnalysis

setServiceName

public boolean setServiceName(java.lang.String serviceName)
Set service name.

Parameters:
serviceName - holds the name of the service.
Returns:
whether the service name is set successfully.

setServiceURI

public boolean setServiceURI(java.lang.String serviceURI)
Set service uri.

Parameters:
serviceURI - holds the uri of the service.
Returns:
whether the service uri is set successfully.

setInstanceName

public boolean setInstanceName(java.lang.String instanceName)
Set instance name.

Parameters:
instanceName - holds the name of the instance.
Returns:
whether the instance name is set successfully.

setJobID

public boolean setJobID(java.lang.String jobID)
Set job id.

Parameters:
jobID - holds the job id.
Returns:
whether the job id is set successfully.

setResultTime

public boolean setResultTime(java.util.GregorianCalendar time)
Set time of the result.

Parameters:
time - holds the time of the result.
Returns:
whether result time is set successfully.

setGeneralMessage

public boolean setGeneralMessage(java.lang.String message)
Set the general message.

Parameters:
message - holds the general message.
Returns:
whether process message is set successfully.

setGeneralStatus

public boolean setGeneralStatus(GeneralStatus status)
Set the general status

Parameters:
status - holds the general status.
Returns:
whether the general status is set successfully.

setGeneralStatusType

public boolean setGeneralStatusType(java.lang.String type)
Set the general status type, which can be: success, error, warning.

Parameters:
type - holds the general status type
Returns:
whether the general status type is set successfully or not.

setGeneralStatusDescription

public boolean setGeneralStatusDescription(java.lang.String description)
Set the general status description.

Parameters:
description - holds the general status description.
Returns:
whether the general status description is set successfully or not.

setProcessStatistics

public boolean setProcessStatistics(ProcessStatistics processStatistics)
Set the process statistics.

Parameters:
processStatistics - holds the process statistics.
Returns:
whether the process statistics is set successfully.

setJobStatistics

public boolean setJobStatistics(JobStatistics[] jobStatistics)
Set the statistics of all jobs.

Parameters:
jobStatistics - holds an array of jobStatistics with each member corresponding to one job.
Returns:
whether the job statistics are set successfully.

setCurrentState

public boolean setCurrentState(java.lang.String currentState)
Set the current state.

Parameters:
currentState - holds the current state, which can be: "busy", "busyButAccepting", "idle", "idleButNotAccepting" or "noResponse".
Returns:
whether the current state is set successfully.

setAvailableDiskSpace

public boolean setAvailableDiskSpace(double availableDiskSpace)
Set the available disk space.

Parameters:
availableDiskSpace - holds the available disk space (in bytes).
Returns:
whether the available disk space is set successfully.

setAvailableMemory

public boolean setAvailableMemory(double availableMemory)
Set the available memory (in bytes).

Parameters:
availableMemory - holds the available memory.
Returns:
whether the available memory is set successfully.

setCurrentJobCount

public boolean setCurrentJobCount(int currentJobCount)
Set the current job count.

Parameters:
currentJobCount - holds the current job count.
Returns:
whether the current job count is set successfully.

setTotalJobsSoFar

public boolean setTotalJobsSoFar(int totalJobsSoFar)
Set the total jobs received so far.

Parameters:
totalJobsSoFar - holds the total jobs received so far.
Returns:
whether the total jobs so far is set successfully.

setTimeLastJobEnded

public boolean setTimeLastJobEnded(java.util.GregorianCalendar timeLastJobEnded)
Set the time last job ended.

Parameters:
timeLastJobEnded - holds the time last job ended.
Returns:
whether the time last job ended is set successfully.

setTimeLastJobTook

public boolean setTimeLastJobTook(double timeLastJobTook)
Set the time last job took.

Parameters:
timeLastJobTook - holds the time last job took (in seconds).
Returns:
whether the time last job took is set successfully.

setTimeServiceStarted

public boolean setTimeServiceStarted(java.util.GregorianCalendar timeServiceStarted)
Set the time the service started.

Parameters:
timeServiceStarted - holds the time the service started.
Returns:
whether the time the service started is set successfully.

setServiceUtilization

public boolean setServiceUtilization(double serviceUtilization)
Set the service utilization.

Parameters:
serviceUtilization - holds the service utilization ([0, 1]).
Returns:
whether the time last job took is set successfully.

setOtherResults

public 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).

Parameters:
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.
Returns:
whether the other anlysis information is set successfully.

setVariableNumber

public boolean setVariableNumber(int variableNumber)
Set the variable number.

Parameters:
variableNumber - holds the number of variables
Returns:
whether the variable number is set successfully or not.

setObjectiveNumber

public boolean setObjectiveNumber(int objectiveNumber)
Set the objective number.

Parameters:
objectiveNumber - holds the number of objectives
Returns:
whether the objective number is set successfully or not.

setConstraintNumber

public boolean setConstraintNumber(int constraintNumber)
Set the constraint number.

Parameters:
constraintNumber - holds the number of constraints
Returns:
whether the constraint number is set successfully or not.

setSolutionNumber

public boolean setSolutionNumber(int solutionNumber)
set the number of solutions. This method must be called before setting other optimization solution related results. Before this method is called, the setVariableNumber(int), setObjectiveNumber(int), setConstraintNumber(int) methods have to be called first.

Parameters:
solutionNumber - holds the number of solutions to set.
Returns:
whether the solution number is set successfully.
See Also:
setVariableNumber(int), setObjectiveNumber(int), setConstraintNumber(int)

setSolution

public boolean setSolution(int solIdx,
                           OptimizationSolution solution)
Set the [i]th optimization solution, where i equals the given solution index. Before this method is called, the setSolutionNumber(int) method has to be called first.

Parameters:
solIdx - holds the solution index to set the solution.
solution - holds the optimization solution to set.
Returns:
whether the optimization solution is set successfully or not.
See Also:
OptimizationSolution, setSolutionNumber(int)

setSolutionStatus

public boolean setSolutionStatus(int solIdx,
                                 OptimizationSolutionStatus status)
Set the [i]th optimization solution status, where i equals the given solution index. The solution status includes the status type, optional descriptions and possibly substatuses. Before this method is called, the setSolutionNumber(int) method has to be called first.

Parameters:
solIdx - holds the solution index to set the solution status.
status - holds the optimization solution status to set.
Returns:
whether the optimization solution status is set successfully or not.
See Also:
OptimizationSolutionStatus, setSolutionNumber(int)

setSolutionStatus

public 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. The solution status includes the status type, optional descriptions and possibly substatuses. Before this method is called, the setSolutionNumber(int) method has to be called first.

Parameters:
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, other
description - 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.
Returns:
whether the optimization solution status is set successfully or not.
See Also:
OptimizationSolutionStatus, org.optimizationservices.oscommon.datastructure.osresult.OptimizationSolutionSubStatus, setSolutionNumber(int)

setSolutionMessage

public boolean setSolutionMessage(int solIdx,
                                  java.lang.String solutionMessage)
Set the [i]th optimization solution message, where i equals the given solution index. Before this method is called, the setSolutionNumber(int) method has to be called first.

Parameters:
solIdx - holds the solution index to set the solution message.
solutionMessage - holds the solution message to set.
Returns:
whether the optimization solution message is set successfully or not.
See Also:
setSolutionNumber(int)

setSolutionObjectiveIndex

public boolean setSolutionObjectiveIndex(int solIdx,
                                         int objectiveIdx)
Set the [i]th optimization solution's objective index, where i equals the given solution index. The first objective's index should be -1, the second -2, and so on. Before this method is called, the setSolutionNumber(int) method has to be called first.

Parameters:
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.
Returns:
whether the optimization objective index is set successfully or not.
See Also:
setSolutionNumber(int)

setPrimalVariableValues

public boolean setPrimalVariableValues(int solIdx,
                                       double[] x)
Set the [i]th optimization solution's primal variable values, where i equals the given solution index. Before this method is called, the setSolutionNumber(int) method has to be called first.

Parameters:
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.
Returns:
whether primal variable values are set successfully or not.
See Also:
setSolutionNumber(int)

setPrimalVariableStringValues

public 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. Before this method is called, the setSolutionNumber(int) method has to be called first.

Parameters:
solIdx - holds the solution index to set the primal variable string values.
x - holds a dense string array of variable string values to set.
Returns:
whether primal variable string values are set successfully or not.
See Also:
setSolutionNumber(int)

setOtherVariableResults

public 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. Before this method is called, the setSolutionNumber(int) method has to be called first.

Parameters:
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.
Returns:
whether the other variable results are set successfully or not.
See Also:
OtherVariableResult, OtherVarResult, setSolutionNumber(int)

setObjectiveValues

public boolean setObjectiveValues(int solIdx,
                                  double[] objectiveValues)
Set the [i]th optimization solution's objective values, where i equals the given solution index. Usually one of the objective is what the solution was solved for (or based on). Its index should be indicated in the solution's objectiveIdx attribute. Based on this objective's solution, the rest of the objective values are (optionally) calculated. Before this method is called, the setSolutionNumber(int) method has to be called first.

Parameters:
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.
Returns:
whether objective values are set successfully or not.
See Also:
setSolutionNumber(int)

setOtherObjectiveResults

public 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. Before this method is called, the setSolutionNumber(int) method has to be called first.

Parameters:
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.
Returns:
whether the other objective results are set successfully or not.
See Also:
OtherObjectiveResult, OtherObjResult, setSolutionNumber(int)

setDualVariableValues

public boolean setDualVariableValues(int solIdx,
                                     double[] values)
Set the [i]th optimization solution's dual variable values, where i equals the given solution index. Before this method is called, the setSolutionNumber(int) method has to be called first.

Parameters:
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.
Returns:
whether dual variable values are set successfully or not.
See Also:
setSolutionNumber(int)

setOtherConstraintResults

public 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. Before this method is called, the setSolutionNumber(int) method has to be called first.

Parameters:
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.
Returns:
whether the other constraint results are set successfully or not.
See Also:
OtherConstraintResult, OtherConResult, setSolutionNumber(int)

setOtherOptimizationResults

public 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. These other results are usually on the general optimization, not specifically on the variables, objective, or constraints. Before this method is called, the setSolutionNumber(int) method has to be called first.

Parameters:
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).
Returns:
whether the other optimization results are set successfully or not.
See Also:
OtherOptimizationResult, setSolutionNumber(int)

setOSAnalysis

public boolean setOSAnalysis(OSAnalysis osAnalysis)
Set the optimization analysis.

Parameters:
osAnalysis - holds the optimization analysis in the standard OSAnalysis data structure.
Returns:
the optimization analysis in the standard OSAnalysis data structure, null if none.
See Also:
OSAnalysis

main

public static void main(java.lang.String[] args)
main for test purposes.

Parameters:
argv - command line arguments.