Class LearnExplained

  • All Implemented Interfaces:
    Learn
    Direct Known Subclasses:
    LearnCBJ, MoveLearnBinaryTDR

    public class LearnExplained
    extends Object
    implements Learn
    An abstract class to deal with explanation-based learning. Created by cprudhom on 05/11/2015. Project: choco.
    • Field Detail

      • mModel

        protected final Model mModel
        The solver to explain.
      • mExplainer

        protected final IExplanationEngine mExplainer
        The explanation engine, which computes and returns explanation of a state.
      • lastExplanation

        protected Explanation lastExplanation
        The last explanation computed.
    • Constructor Detail

      • LearnExplained

        public LearnExplained​(Model mModel,
                              boolean partialExplanationsOn,
                              boolean recordCauses)
        Equips the solver with an explanation engine, which is able to explain failures and solutions.
        Parameters:
        mModel - the solver to equip
        partialExplanationsOn - set to true to enable partial explanations, false otherwise
        recordCauses - set to true to record causes in explanations, false otherwise
        Throws:
        SolverException - if views are enabled. Views provide incomplete explanation.
    • Method Detail

      • record

        public void record​(Solver solver)
        Description copied from interface: Learn
        Validate and record a new piece of knowledge, that is, the current position is a dead-end.
        Specified by:
        record in interface Learn
      • forget

        public void forget​(Solver solver)
        Description copied from interface: Learn
        Forget some pieces of knowledge.
        Specified by:
        forget in interface Learn
      • onSolution

        public void onSolution​(Solver solver)
        Actions to do when a solution is found. By default, it records the basic explanation related to the refutation of the last decision.
      • onFailure

        public void onFailure​(Solver solver)
        Actions to do when a failure is met.
      • getLastExplanation

        public final Explanation getLastExplanation()
        Return the explanation of the last conflict
        Returns:
        an explanation