Пример #1
0
 @Override
 public void onUpdate(Variable var, EventType evt) {
   if (evt == EventType.INSTANTIATE) {
     int nbp = var.getNbProps();
     for (int p = 0; p < nbp; p++) {
       Propagator prop = var.getPropagator(p);
       int pid = prop.getId();
       pid2ari.get(pid).add(-1);
     }
   }
 }
Пример #2
0
 private int weight(IntVar v) {
   int w = 0;
   int nbp = v.getNbProps();
   for (int p = 0; p < nbp; p++) {
     Propagator prop = v.getPropagator(p);
     int pid = prop.getId();
     if (pid2arity.get(pid) > 1) {
       w += counter.getFails(prop);
     } else {
       int a = pid2ari.get(pid).get();
       pid2arity.put(pid, a);
       if (a > 1) {
         w += counter.getFails(prop);
       }
     }
   }
   return w;
 }