public class Cmpl
extends java.lang.Thread
Modifier and Type | Field and Description |
---|---|
static int |
ASYNCHRONOUSLY |
static int |
CMPL_FAILED |
static int |
CMPL_OK |
static int |
CMPL_UNKNOWN |
static int |
CMPL_WARNINGS |
static int |
CMPLSERVER_CLEANED |
static int |
CMPLSERVER_ERROR |
static int |
CMPLSERVER_OK |
static int |
PROBLEM_CANCELED |
static int |
PROBLEM_FINISHED |
static int |
PROBLEM_NOTRUNNING |
static int |
PROBLEM_RUNNING |
static int |
SOLVER_FAILED |
static int |
SOLVER_OK |
static int |
SYNCHRONOUSLY |
Constructor and Description |
---|
Cmpl(java.lang.String model)
constructor
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
asciiSolFile()
Returns the name of the Ascii solution file - controlled by the command
line arg -solutionAscii
|
void |
cancel()
Cancels the Cmpl solving process on the connected CMPLServer The status
of the model can be obtained by the methods cmplStatus and cmplStatusText
|
java.util.ArrayList<CmplMsg> |
cmplMessages()
Returns the CmplMessages
|
java.lang.String |
cmplSolFile()
Returns the name of the CmplSolution file - controlled by the command
line arg -solution
|
int |
cmplStatus()
Returns the CMPL related status of the Cmpl object CMPL_UNKNOWN = 0
CMPL_OK = 1 CMPL_WARNINGS = 2 CMPL_FAILED = 3 CMPLSERVER_OK = 6
CMPLSERVER_ERROR = 7 CMPLSERVER_CLEANED = 8 PROBLEM_RUNNING = 9
PROBLEM_FINISHED = 10 PROBLEM_CANCELED = 11 PROBLEM_NOTRUNNING = 12
|
java.lang.String |
cmplStatusText()
Returns the CMPL related status text of the Cmpl object CMPL_UNKNOWN
CMPL_OK CMPL_WARNINGS CMPL_FAILED SOLVER_OK SOLVER_FAILED CMPLSERVER_OK
CMPLSERVER_ERROR CMPLSERVER_CLEANED PROBLEM_RUNNING PROBLEM_FINISHED
PROBLEM_CANCELED PROBLEM_NOTRUNNING
|
java.lang.String |
conDisplayOptions()
Returns the a string with the display options for the constraints of the
generated and solved CMPL model
|
void |
connect(java.lang.String cmplUrl)
Connects a CMPLServer under cmplUrl - first step of solving a model on a
CMPLServer remotely
|
java.lang.String |
csvSolFile()
Returns the name of the Csv solution file - controlled by the command
line arg -solutionCsv
|
void |
debug(boolean x)
Very simple debug mode
|
void |
delOption(java.lang.Integer pos)
Deletes an option
|
void |
delOptions()
Deletes all options
|
void |
disconnect()
Disconnects the connected CMPLServer
|
protected void |
finalize()
destructor
|
java.lang.Object |
getConByName(java.lang.String name)
Enables the direct access to a single constraint or constraint array of
the optimal solution
|
java.lang.Object |
getConByName(java.lang.String name,
int solNr)
Enables the direct access to a single constraint or constraint array of
the solution with solNr
|
java.lang.Object |
getVarByName(java.lang.String name)
Enables the direct access to a single variable or variable array of the
optimal solution
|
java.lang.Object |
getVarByName(java.lang.String name,
int solNr)
Enables the direct access to a single variable or variable array of
solution with solNr
|
void |
interrupt()
Used for stopping a Cmpl thread
|
java.lang.String |
jobId()
Returns the jobId of the Cmpl problem at the connected CMPLServer
|
void |
knock()
Knocks on the door of the connected CMPLServer and asks whether the model
is finished - second step of solving a model on a CMPLServer
asynchronously The status of the model can be obtained by the methods
cmplStatus and cmplStatusText
|
java.lang.String |
model()
Returns the name of the model
|
long |
nrOfConstraints()
Returns the number of constraints of the generated and solved CMPL model
|
long |
nrOfSolutions()
Returns the number of solutions of the generated and solved CMPL model
|
long |
nrOfVariables()
Returns the number of variables of the generated and solved CMPL model
|
java.lang.String |
objectiveName()
Returns the name of the objective function of the generated and solved
CMPL model
|
java.lang.String |
objectiveSense()
Returns the objective sense of the generated and solved CMPL model
|
java.lang.String |
output()
Returns the stdOut and stdErr of Cmpl and the invoked solver
|
long |
refreshTime()
Returns the refreshtime of the model
|
void |
retrieve()
Retrieves the Cmpl solution(s) if possible from the connected CMPLServer
last step of solving a model on a CMPLServer asynchronously
|
void |
run()
Used for model.start() if the model is executed in parallel
|
void |
saveSolution()
Saves the solution(s) as CmplSolutions file with filename modelname.csol
|
void |
saveSolution(java.lang.String solFileName)
Saves the solution(s) as CmplSolutions file given filename
|
void |
saveSolutionAscii()
Saves the solution(s) as ASCII file with filename modelname.csol
|
void |
saveSolutionAscii(java.lang.String solFileName)
Saves the solution(s) as ASCII file with given file name
|
void |
saveSolutionCsv()
Saves the solution(s) as CSV file with file name modelname.csv
|
void |
saveSolutionCsv(java.lang.String solFileName)
Saves the solution(s) as CSV file with given file name
|
java.lang.String |
send()
Sends the Cmpl model instance to the connected CMPLServer first step of
solving a model on a CMPLServer asynchronously (after connect()) The
status of the model can be obtained by the methods cmplStatus and
cmplStatusText
|
java.lang.Integer |
setOption(java.lang.String option)
Deletes an option
|
void |
setOutput(java.lang.Boolean ok)
Turns the output of CMPL and the invoked solver on or off
|
void |
setOutput(java.lang.Boolean ok,
java.lang.String lStr)
Turns the output of CMPL and the invoked solver on or off
|
void |
setParameters(CmplParameter... params)
Sets a CMPL, display or solver option
|
void |
setRefreshTime(long rTime)
Refresh time for getting the output of CMPL and the invoked solver from a
CMPLServer if the model is solved synchronously.
|
void |
setSets(CmplSet... sets)
Committing a CmplParameter object to the Cmpl model
|
CmplSolution |
solution()
Returns the first (optimal) CmplSolutions object
|
java.util.ArrayList<CmplSolution> |
solutionPool()
Returns a list of CmplSolutions objects
|
void |
solutionReport()
Writes a standard solution report to stdOut
|
void |
solutionReport(java.lang.String fileName)
Writes a standard solution report to a file Used by saveSolutionAscii
|
void |
solve()
Solves a Cmpl model either with a local installed CMPL or if the model is
connected with a CMPLServer remotely.
|
java.lang.String |
solver()
Returns the name of the invoked solver of the generated and solved CMPL
model
|
java.lang.String |
solverMessage()
Returns the message of the invoked solver of the generated and solved
CMPL model
|
int |
solverStatus()
Returns the solver related status of the Cmpl object SOLVER_OK = 4
SOLVER_FAILED = 5
|
java.lang.String |
solverStatusText()
Returns the solver related status text of the Cmpl object SOLVER_OK
SOLVER_FAILED
|
java.lang.String |
varDisplayOptions()
Returns the a string with the display options for the variables of the
generated and solved CMPL model
|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public static final int CMPL_UNKNOWN
public static final int CMPL_OK
public static final int CMPL_WARNINGS
public static final int CMPL_FAILED
public static final int SOLVER_OK
public static final int SOLVER_FAILED
public static final int CMPLSERVER_OK
public static final int CMPLSERVER_ERROR
public static final int CMPLSERVER_CLEANED
public static final int PROBLEM_RUNNING
public static final int PROBLEM_FINISHED
public static final int PROBLEM_CANCELED
public static final int PROBLEM_NOTRUNNING
public static final int SYNCHRONOUSLY
public static final int ASYNCHRONOUSLY
public Cmpl(java.lang.String model) throws CmplException
model
- CmplException
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public java.lang.String model()
public long refreshTime()
public java.lang.String output()
public java.util.ArrayList<CmplMsg> cmplMessages()
public java.util.ArrayList<CmplSolution> solutionPool() throws CmplException
CmplException
public CmplSolution solution() throws CmplException
CmplException
public long nrOfVariables() throws CmplException
CmplException
public long nrOfConstraints() throws CmplException
CmplException
public java.lang.String objectiveName() throws CmplException
CmplException
public java.lang.String objectiveSense() throws CmplException
CmplException
public long nrOfSolutions() throws CmplException
CmplException
public java.lang.String solver() throws CmplException
CmplException
public java.lang.String solverMessage() throws CmplException
CmplException
public java.lang.String varDisplayOptions() throws CmplException
CmplException
public java.lang.String conDisplayOptions() throws CmplException
CmplException
public int cmplStatus()
public java.lang.String cmplStatusText()
public int solverStatus()
public java.lang.String solverStatusText()
public java.lang.String cmplSolFile()
public java.lang.String csvSolFile()
public java.lang.String asciiSolFile()
public java.lang.String jobId()
public void setOutput(java.lang.Boolean ok, java.lang.String lStr)
ok
- Switch for on or offlStr
- Leading string for the output (default - model name)public void setOutput(java.lang.Boolean ok)
ok
- Switch for on or offpublic void setRefreshTime(long rTime)
rTime
- refresh time in milliseconds (default 400)public void setSets(CmplSet... sets) throws CmplException
param
- CmplParameter objectCmplException
public void setParameters(CmplParameter... params) throws CmplException
option
- option in CmplHeader syntaxCmplException
public java.lang.Integer setOption(java.lang.String option)
pos
- option idCmplException
public void delOption(java.lang.Integer pos) throws CmplException
pos
- option idCmplException
public void delOptions()
public void debug(boolean x)
x
- switchfor on or offpublic java.lang.Object getVarByName(java.lang.String name) throws CmplException
name
- Name of the variable (w/o index)CmplException
public java.lang.Object getVarByName(java.lang.String name, int solNr) throws CmplException
name
- Name of the variable (w/o index)solNr
- Index of the solutionCmplException
public java.lang.Object getConByName(java.lang.String name) throws CmplException
name
- Name of the constraint (w/o index)CmplException
public java.lang.Object getConByName(java.lang.String name, int solNr) throws CmplException
name
- Name of the constraint (w/o index)solNr
- Index of the solutionCmplException
public void solve() throws CmplException
CmplException
public void connect(java.lang.String cmplUrl) throws CmplException
cmplUrl
- URL of the CMPLServerCmplException
public void disconnect() throws CmplException
CmplException
public java.lang.String send() throws CmplException
CmplException
public void knock() throws CmplException
CmplException
public void cancel() throws CmplException
CmplException
public void retrieve() throws CmplException
CmplException
- The status of the model and the solver can be
obtained by the methods cmplStatus, cmplStatusText,solverStatus and
solverStatusTextCmplException
public void saveSolution() throws CmplException
CmplException
public void saveSolution(java.lang.String solFileName) throws CmplException
solFileName
- File nameCmplException
public void saveSolutionAscii() throws CmplException
CmplException
public void saveSolutionAscii(java.lang.String solFileName) throws CmplException
solFileName
- File nameCmplException
public void solutionReport() throws CmplException
CmplException
public void solutionReport(java.lang.String fileName) throws CmplException
fileName
- File nameCmplException
public void saveSolutionCsv() throws CmplException
CmplException
public void saveSolutionCsv(java.lang.String solFileName) throws CmplException
solFileName
- File nameCmplException
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void interrupt()
interrupt
in class java.lang.Thread