Class Engine


  • public class Engine
    extends java.lang.Object
    Class for executing reasoner and returning the result.
    Author:
    Sizonenko, Holger Eichelberger
    • 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
      • 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
      • problemConstraints

        private java.util.List<Constraint> problemConstraints
      • failedElementProjects

        private java.util.List<Project> failedElementProjects
      • 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 be ProgressObserver.NO_OBSERVER if unused
        interceptor - an optional interceptor instance
    • Method Detail

      • 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:
        true for operating, false else
      • 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:
        true if the reasoner tries to stop, false else (operation not implemented)
      • markForReuse

        void markForReuse()
        Marks this instance for re-use. Must be called before the first call to #resolve().
        See Also:
        clear(), reInit()
      • 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 is AssignmentState.DERIVED, but specific reasoning operations such as configuration initialization may require a different state.
        Parameters:
        state - the state to use