java.lang.Object
net.ssehub.easy.reasoning.sseReasoner.Engine

public class Engine extends Object
Class for executing reasoner and returning the result.
Author:
Sizonenko, Holger Eichelberger
  • Field Details

    • VIOLATED_CONSTRAINTS

      private static final String VIOLATED_CONSTRAINTS
      See Also:
    • VIOLATED_VARIABLES

      private static final String VIOLATED_VARIABLES
      See Also:
    • resolver

      private Resolver resolver
    • result

      private net.ssehub.easy.reasoning.core.reasoner.ReasoningResult result
    • failedModelElements

      private List<net.ssehub.easy.varModel.model.ModelElement> failedModelElements
    • variablesInConstraints

      private List<Set<net.ssehub.easy.varModel.model.AbstractVariable>> variablesInConstraints
    • problemDecisions

      private List<Set<net.ssehub.easy.varModel.confModel.IDecisionVariable>> problemDecisions
    • problemConstraintParts

      private List<net.ssehub.easy.varModel.cst.ConstraintSyntaxTree> problemConstraintParts
    • problemConstraints

      private List<net.ssehub.easy.varModel.model.Constraint> problemConstraints
    • failedElementProjects

      private List<net.ssehub.easy.varModel.model.Project> failedElementProjects
    • failedElementSuggestions

      private List<net.ssehub.easy.reasoning.core.reasoner.Message.SuggestionType> failedElementSuggestions
    • constraintVariables

      private List<net.ssehub.easy.varModel.confModel.IDecisionVariable> constraintVariables
    • errorClassification

      private List<Integer> 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 be ProgressObserver.NO_OBSERVER if unused
      interceptor - an optional interceptor instance
  • Method Details

    • reason

      public net.ssehub.easy.reasoning.core.reasoner.ReasoningResult reason()
      Method for launching the reasoner.
      Returns:
      ReasoningResult failed 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.
    • analyzeMessages

      private void analyzeMessages(FailedElements failedElements)
      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:
      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)
    • 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 is AssignmentState.DERIVED, but specific reasoning operations such as configuration initialization may require a different state.
      Parameters:
      state - the state to use