Class Engine
- java.lang.Object
-
- net.ssehub.easy.reasoning.sseReasoner.Engine
-
public class Engine extends java.lang.ObjectClass for executing reasoner and returning the result.- Author:
- Sizonenko, Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<IDecisionVariable>constraintVariablesprivate java.util.List<java.lang.Integer>errorClassificationprivate longevaluationTimeprivate intfailedAssignmentsprivate intfailedConstraintsprivate java.util.List<Project>failedElementProjectsprivate java.util.List<Message.SuggestionType>failedElementSuggestionsprivate java.util.List<ModelElement>failedModelElementsprivate java.util.List<ConstraintSyntaxTree>problemConstraintPartsprivate java.util.List<Constraint>problemConstraintsprivate java.util.List<java.util.Set<IDecisionVariable>>problemDecisionsprivate intreevaluationCountprivate Resolverresolverprivate ReasoningResultresultprivate java.util.List<java.util.Set<AbstractVariable>>variablesInConstraintsprivate static java.lang.StringVIOLATED_CONSTRAINTSprivate static java.lang.StringVIOLATED_VARIABLES
-
Constructor Summary
Constructors Constructor Description Engine(Configuration cfg, ReasonerConfiguration reasonerConfig, ProgressObserver observer, IReasonerInterceptor interceptor)Main constructor for creating an instance of the reasoner.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 voidclearFailedInfo()Clears information about failed elements.private MessagecreateMessage(java.lang.String text)Method for creating custom message fields.longgetEvaluationTime()Method for getting evaluation time of the model.longgetReevaluationCount()Method for getting reevaluation count of the model.(package private) booleanisRunning()Returns whether the reasoner is (still) operating.(package private) voidmarkForReuse()Marks this instance for re-use.ReasoningResultreason()Method for launching the reasoner.(package private) voidreInit()Re-initializes this resolver instance to allocated resources only if really needed.(package private) voidsetAssignmentState(IAssignmentState state)Sets the desired assignment state.(package private) booleanstop()Stops/terminates reasoning.
-
-
-
Field Detail
-
VIOLATED_CONSTRAINTS
private static final java.lang.String VIOLATED_CONSTRAINTS
- See Also:
- Constant Field Values
-
VIOLATED_VARIABLES
private static final java.lang.String VIOLATED_VARIABLES
- See Also:
- Constant Field Values
-
resolver
private Resolver resolver
-
result
private ReasoningResult result
-
failedModelElements
private java.util.List<ModelElement> failedModelElements
-
variablesInConstraints
private java.util.List<java.util.Set<AbstractVariable>> variablesInConstraints
-
problemDecisions
private java.util.List<java.util.Set<IDecisionVariable>> problemDecisions
-
problemConstraintParts
private java.util.List<ConstraintSyntaxTree> problemConstraintParts
-
problemConstraints
private java.util.List<Constraint> problemConstraints
-
failedElementProjects
private java.util.List<Project> failedElementProjects
-
failedElementSuggestions
private java.util.List<Message.SuggestionType> failedElementSuggestions
-
constraintVariables
private java.util.List<IDecisionVariable> constraintVariables
-
errorClassification
private java.util.List<java.lang.Integer> errorClassification
-
evaluationTime
private long evaluationTime
-
reevaluationCount
private int reevaluationCount
-
failedConstraints
private int failedConstraints
-
failedAssignments
private int failedAssignments
-
-
Constructor Detail
-
Engine
public Engine(Configuration cfg, ReasonerConfiguration reasonerConfig, ProgressObserver observer, 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 Detail
-
reason
public ReasoningResult reason()
Method for launching the reasoner.- Returns:
ReasoningResultfailed constraints and assignments, if exist.
-
analyzeProblemConstraints
private void analyzeProblemConstraints(FailedElements failedElements)
Method for analyzing problem points - failed constraints and associated variables.- Parameters:
failedElements- Problem points.
-
analyzeProblemVariables
private void analyzeProblemVariables(FailedElements failedElements)
Method for analyzing failed elements and creating error messages.- Parameters:
failedElements- All failed elements from the reasoner.
-
clearFailedInfo
private void clearFailedInfo()
Clears information about failed elements.
-
createMessage
private Message createMessage(java.lang.String text)
Method for creating custom message fields.- Parameters:
text- Text for 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(),reInit()
-
markForReuse
void markForReuse()
Marks this instance for re-use. Must be called before the first call to#resolve().
-
reInit
void reInit()
Re-initializes this resolver instance to allocated resources only if really needed.- See Also:
markForReuse(),clear()
-
setAssignmentState
void setAssignmentState(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
-
-