public abstract class ProblemMediator extends org.licas.service.spec.ServiceSpec implements ProblemMediatorDef
Modifier and Type | Field and Description |
---|---|
protected Result |
bestResult
The current best result
|
protected boolean |
fullTrace
True if store full test trace, but still need to add it.
|
protected Problem |
problem
This models the problem to be solved
|
protected Result |
result
The current result
|
protected java.util.ArrayList<java.lang.String> |
solutionOrder
A solution ordering if required.
|
protected java.util.LinkedHashMap<java.lang.String,Solution> |
solutionSet
The list of solution instances related to this problem.
|
protected int |
solutionsNumber
Number of solutions to create
|
protected java.lang.String |
solverType
The solver framework is the controlling framework in which the heuristics are run.
|
protected boolean |
testEnded
True if the tests have ended or should be stopped
|
constructorParams, createServices, dataConditions, datasetType, dirPath, externalScript, heuristicOptions, heuristicType, inputVariables, linkSpec, metricType, serverSpec, serviceClasses, serviceJarFiles, servicesNum, serviceType, tokenizer
Constructor and Description |
---|
ProblemMediator(org.licas.PasswordHandler thePasswordHandler)
Create a new instance of ProblemMediator.
|
Modifier and Type | Method and Description |
---|---|
void |
addHeuristicOption(java.lang.String name,
java.lang.Object value)
Add a new heuristic-related variable value.
|
void |
clearHeuristicOptions()
Clear the list of heuristic-related variable values.
|
void |
copyToConfig(TestSpec testSpec)
Copy any values specific to the problem solver classes to the related specific
structures, from the more general list of variables from the Problem Spec itself.
|
boolean |
getFullTrace()
Get the value indicating if a full test trace should be stored for output.
|
java.util.HashMap<java.lang.String,java.lang.Object> |
getHeuristicOptions()
Get the list of heuristic-related variable values.
|
java.lang.String |
getHeuristicType()
Get the type of heuristic to use.
|
Problem |
getProblem()
Get the problem model.
|
java.util.ArrayList<java.lang.String> |
getProblemNames()
Get the ordered list of solution names.
|
java.util.LinkedHashMap<java.lang.String,Solution> |
getSolutionSet()
Get the list of compound solution instances.
|
int |
getSolutionsNumber()
Get the number of solutions to create.
|
boolean |
getTestEnded()
Return true if the tests have ended or should be stopped.
|
ProcessResult |
processResult(java.lang.String solverType)
Calculate any stats on the clustered solutions.
|
abstract boolean |
resetForNextRun(java.util.HashMap<java.lang.String,?> varList)
Reset the problem-solving structures for the next run.
|
void |
resetValues()
Reset to starting values
|
void |
setDatasetType(java.lang.String thisDatasetType)
Set the dataset type.
|
void |
setFullTrace(boolean thisFullTrace)
Set the value indicating if a full test trace should be stored for output.
|
void |
setHeuristicOptions(java.util.HashMap<java.lang.String,java.lang.Object> thisHeuristicOptions)
Set the list of heuristic options, as key-value pairs.
|
void |
setHeuristicType(java.lang.String thisHeuristicType)
Set the type of heuristic to use.
|
void |
setProblem(Problem thisProblem)
Set the problem model.
|
void |
setSolutionSet(java.util.LinkedHashMap thisSolutionsList)
Set the list of compound solution instances related to the problem.
|
void |
setSolutionsNumber(int thisSolutionsNumber)
Set the number of solutions to create.
|
getDatasetType, getDirFolder, getTokenizer, parseProblemDataset, setDirFolder, setTokenizer, validateScript, validateVariable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getResultXml, solve
protected java.lang.String solverType
HeuristicConst
.GRIDMATCH
or SEARCHHILL
, for example.protected int solutionsNumber
protected boolean testEnded
protected boolean fullTrace
protected java.util.ArrayList<java.lang.String> solutionOrder
protected java.util.LinkedHashMap<java.lang.String,Solution> solutionSet
protected Problem problem
protected Result bestResult
protected Result result
public ProblemMediator(org.licas.PasswordHandler thePasswordHandler)
thePasswordHandler
- for storing passwords.public void resetValues()
public abstract boolean resetForNextRun(java.util.HashMap<java.lang.String,?> varList) throws java.lang.Exception
varList
- a list of variables as key-value pairs.java.lang.Exception
- any error.public ProcessResult processResult(java.lang.String solverType) throws java.lang.Exception
processResult
in interface ProblemMediatorDef
solverType
- the solver used to create the result.java.lang.Exception
- any error.public void copyToConfig(TestSpec testSpec) throws java.lang.Exception
copyToConfig
in interface ProblemMediatorDef
testSpec
- the model of the tests to perform.java.lang.Exception
- any error.public java.util.ArrayList<java.lang.String> getProblemNames()
public void setDatasetType(java.lang.String thisDatasetType)
setDatasetType
in class org.licas.service.spec.ServiceSpec
thisDatasetType
- the dataset type.public void setHeuristicType(java.lang.String thisHeuristicType)
setHeuristicType
in class org.licas.service.spec.ServiceSpec
thisHeuristicType
- the test heuristic.public java.lang.String getHeuristicType()
getHeuristicType
in class org.licas.service.spec.ServiceSpec
public void clearHeuristicOptions()
public void addHeuristicOption(java.lang.String name, java.lang.Object value)
name
- a variable name.value
- related value. Can be null for no value.public void setHeuristicOptions(java.util.HashMap<java.lang.String,java.lang.Object> thisHeuristicOptions)
thisHeuristicOptions
- the value of heuristicOptions.public java.util.HashMap<java.lang.String,java.lang.Object> getHeuristicOptions()
public void setProblem(Problem thisProblem)
thisProblem
- a description of the problem in terms of tasks to be solved.public Problem getProblem()
public void setSolutionsNumber(int thisSolutionsNumber)
thisSolutionsNumber
- the number of solutions.public int getSolutionsNumber()
public void setSolutionSet(java.util.LinkedHashMap thisSolutionsList)
thisSolutionsList
- the list of solution instances.public java.util.LinkedHashMap<java.lang.String,Solution> getSolutionSet()
public boolean getTestEnded()
public void setFullTrace(boolean thisFullTrace)
thisFullTrace
- true if save a full trace.public boolean getFullTrace()