@Override public BranchingDecision getDecision(Decision decision, boolean isLeft) { BranchingDecision br = super.getDecision(decision, isLeft); if (!isLeft) { // a refutation is explained thanks to the previous ones which are refutable if (decision != RootDecision.ROOT) { Explanation explanation = database.get(br.getId()); if (explanation == null) { explanation = new Explanation(); } else { explanation.reset(); } Decision d = decision.getPrevious(); while ((d != RootDecision.ROOT)) { if (d.hasNext()) { explanation.add(d.getPositiveDeduction()); } d = d.getPrevious(); } this.store(br, explanation); } } return br; }
@Override public void explain(ExplanationEngine xengine, Deduction d, Explanation e) { // return super.explain(d); if (d.getVar() == x) { e.add(xengine.getPropagatorActivation(this)); if (d.getmType() == Deduction.Type.ValRem) { y.explain(xengine, VariableState.REM, ((ValueRemoval) d).getVal() - cste, e); } else { throw new UnsupportedOperationException( "PropEqualXY only knows how to explain ValueRemovals"); } } else if (d.getVar() == y) { e.add(xengine.getPropagatorActivation(this)); if (d.getmType() == Deduction.Type.ValRem) { x.explain(xengine, VariableState.REM, ((ValueRemoval) d).getVal() + cste, e); } else { throw new UnsupportedOperationException( "PropEqualXY only knows how to explain ValueRemovals"); } } else { super.explain(xengine, d, e); } }