Exemplo n.º 1
0
 @Override
 public boolean why(RuleStore ruleStore, IntVar var, IEventType evt, int value) {
   boolean newrules = ruleStore.addPropagatorActivationRule(this);
   assert var == this.power;
   if (IntEventType.isInclow(evt.getMask())) {
     for (int i = 0; i < n; i++) {
       newrules |= ruleStore.addLowerBoundRule(vars[i]);
     }
   } else if (IntEventType.isDecupp(evt.getMask())) {
     for (int i = 0; i < n; i++) {
       newrules |= ruleStore.addBoundsRule(vars[i]);
     }
     newrules |= ruleStore.addUpperBoundRule(vars[n]);
   } else {
     newrules |= super.why(ruleStore, var, evt, value);
   }
   return newrules;
 }
Exemplo n.º 2
0
 @Override
 public boolean why(RuleStore ruleStore, IntVar var, IEventType evt, int value) {
   return ruleStore.addPropagatorActivationRule(this)
       | ruleStore.addFullDomainRule((var == vars[0]) ? vars[1] : vars[0]);
 }
Exemplo n.º 3
0
 @Override
 public boolean why(RuleStore ruleStore, IntVar var, IEventType evt, int value) {
   boolean nrules = false;
   if (var == S) {
     if (evt == IntEventType.INCLOW) {
       nrules = ruleStore.addLowerBoundRule(E);
       nrules |= ruleStore.addUpperBoundRule(D);
     } else if (evt == IntEventType.DECUPP) {
       nrules = ruleStore.addUpperBoundRule(E);
       nrules |= ruleStore.addLowerBoundRule(D);
     } else {
       throw new SolverException("TaskMonitor exception");
     }
   } else if (var == E) {
     if (evt == IntEventType.INCLOW) {
       nrules = ruleStore.addLowerBoundRule(S);
       nrules |= ruleStore.addLowerBoundRule(D);
     } else if (evt == IntEventType.DECUPP) {
       nrules = ruleStore.addUpperBoundRule(S);
       nrules |= ruleStore.addUpperBoundRule(D);
     } else {
       throw new SolverException("TaskMonitor exception");
     }
   } else if (var == D) {
     if (evt == IntEventType.INCLOW) {
       nrules = ruleStore.addLowerBoundRule(E);
       nrules |= ruleStore.addUpperBoundRule(S);
     } else if (evt == IntEventType.DECUPP) {
       nrules = ruleStore.addLowerBoundRule(S);
       nrules |= ruleStore.addUpperBoundRule(E);
     } else {
       throw new SolverException("TaskMonitor exception");
     }
   }
   return nrules;
 }