Class Engine
java.lang.Object
net.ssehub.easy.reasoning.sseReasoner.Engine
Class for executing reasoner and returning the result.
- Author:
- Sizonenko, Holger Eichelberger
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List<net.ssehub.easy.varModel.confModel.IDecisionVariable> private longprivate intprivate intprivate List<net.ssehub.easy.varModel.model.Project> private List<net.ssehub.easy.reasoning.core.reasoner.Message.SuggestionType> private List<net.ssehub.easy.varModel.model.ModelElement> private List<net.ssehub.easy.varModel.cst.ConstraintSyntaxTree> private List<net.ssehub.easy.varModel.model.Constraint> private intprivate Resolverprivate net.ssehub.easy.reasoning.core.reasoner.ReasoningResultprivate static final Stringprivate static final String -
Constructor Summary
ConstructorsConstructorDescriptionEngine(net.ssehub.easy.varModel.confModel.Configuration cfg, net.ssehub.easy.reasoning.core.reasoner.ReasonerConfiguration reasonerConfig, net.ssehub.easy.basics.progress.ProgressObserver observer, net.ssehub.easy.reasoning.core.reasoner.IReasonerInterceptor interceptor) Main constructor for creating an instance of the reasoner. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidanalyzeMessages(FailedElements failedElements) Analyzes remaining messages.private voidanalyzeProblemConstraints(FailedElements failedElements) Method for analyzing problem points - failed constraints and associated variables.private voidanalyzeProblemVariables(FailedElements failedElements) Method for analyzing failed elements and creating error messages.(package private) voidclear()Clears this instance for reuse.private voidClears information about failed elements.private net.ssehub.easy.reasoning.core.reasoner.MessagecreateMessage(String text, net.ssehub.easy.basics.messages.Status status) Method for creating custom message fields.longMethod for getting evaluation time of the model.longMethod for getting reevaluation count of the model.(package private) booleanReturns whether the reasoner is (still) operating.(package private) voidMarks this instance for re-use.net.ssehub.easy.reasoning.core.reasoner.ReasoningResultreason()Method for launching the reasoner.(package private) voidreInit()Re-initializes this resolver instance to allocated resources only if really needed.(package private) voidsetAssignmentState(net.ssehub.easy.varModel.confModel.IAssignmentState state) Sets the desired assignment state.(package private) booleanstop()Stops/terminates reasoning.
-
Field Details
-
VIOLATED_CONSTRAINTS
- See Also:
-
VIOLATED_VARIABLES
- See Also:
-
resolver
-
result
private net.ssehub.easy.reasoning.core.reasoner.ReasoningResult result -
failedModelElements
-
variablesInConstraints
-
problemDecisions
-
problemConstraintParts
-
problemConstraints
-
failedElementProjects
-
failedElementSuggestions
private List<net.ssehub.easy.reasoning.core.reasoner.Message.SuggestionType> failedElementSuggestions -
constraintVariables
-
errorClassification
-
evaluationTime
private long evaluationTime -
reevaluationCount
private int reevaluationCount -
failedConstraints
private int failedConstraints -
failedAssignments
private int failedAssignments
-
-
Constructor Details
-
Engine
public Engine(net.ssehub.easy.varModel.confModel.Configuration cfg, net.ssehub.easy.reasoning.core.reasoner.ReasonerConfiguration reasonerConfig, net.ssehub.easy.basics.progress.ProgressObserver observer, net.ssehub.easy.reasoning.core.reasoner.IReasonerInterceptor interceptor) Main constructor for creating an instance of the reasoner.- Parameters:
cfg- Configuration to reason on.reasonerConfig- the reasoner configuration to be used for reasoning (e.g. taken from the UI, may be null)observer- An optional progress observer, shall beProgressObserver.NO_OBSERVERif unusedinterceptor- an optional interceptor instance
-
-
Method Details
-
reason
public net.ssehub.easy.reasoning.core.reasoner.ReasoningResult reason()Method for launching the reasoner.- Returns:
ReasoningResultfailed constraints and assignments, if exist.
-
analyzeProblemConstraints
Method for analyzing problem points - failed constraints and associated variables.- Parameters:
failedElements- Problem points.
-
analyzeProblemVariables
Method for analyzing failed elements and creating error messages.- Parameters:
failedElements- All failed elements from the reasoner.
-
analyzeMessages
Analyzes remaining messages.- Parameters:
failedElements- All failed elements from the reasoner.
-
clearFailedInfo
private void clearFailedInfo()Clears information about failed elements. -
createMessage
private net.ssehub.easy.reasoning.core.reasoner.Message createMessage(String text, net.ssehub.easy.basics.messages.Status status) Method for creating custom message fields.- Parameters:
text- Text for the message.status- of the message- Returns:
- Created message.
-
getEvaluationTime
public long getEvaluationTime()Method for getting evaluation time of the model.- Returns:
- Time in milliseconds.
-
getReevaluationCount
public long getReevaluationCount()Method for getting reevaluation count of the model.- Returns:
- Number of reevaluations.
-
isRunning
boolean isRunning()Returns whether the reasoner is (still) operating.- Returns:
truefor operating,falseelse
-
stop
boolean stop()Stops/terminates reasoning. If possible, a reasoner shall stop the reasoning operations as quick as possible. A reasoner must not implement this operation.- Returns:
trueif the reasoner tries to stop,falseelse (operation not implemented)
-
clear
void clear()Clears this instance for reuse.- See Also:
-
markForReuse
void markForReuse()Marks this instance for re-use.- See Also:
-
reInit
void reInit()Re-initializes this resolver instance to allocated resources only if really needed.- See Also:
-
setAssignmentState
void setAssignmentState(net.ssehub.easy.varModel.confModel.IAssignmentState state) Sets the desired assignment state. The default value isAssignmentState.DERIVED, but specific reasoning operations such as configuration initialization may require a different state.- Parameters:
state- the state to use
-