Ejemplo n.º 1
0
  private void playEvents() {
    up2date = true;
    int currentC = curChunk.get();
    int currentI = nextTop.get();
    //        long time = -System.nanoTime();
    //        long count = 0;
    for (int chunk = 0; chunk <= currentC; chunk++) {
      int to = (chunk == currentC ? currentI : CHUNK_SIZE);
      for (int cell = 0; cell < to; cell++) {
        IntVar var = varChunks[chunk][cell];
        EventType etype = masChunks[chunk][cell];
        ICause cause = cauChunks[chunk][cell];
        int one = val1Chunks[chunk][cell];
        int two = val2Chunks[chunk][cell];
        int three = val3Chunks[chunk][cell];
        //                System.out.printf("%s %s %d %d %d - %s\n", var, etype, one, two, three,
        // cause);
        //                count++;
        switch (etype) {
          case REMOVE:
            super.removeValue(var, one, cause);
            break;
          case INSTANTIATE:
            super.instantiateTo(var, one, cause, two, three);
            break;
          case INCLOW:
            super.updateLowerBound(var, one, two, cause);
            break;
          case DECUPP:
            super.updateUpperBound(var, one, two, cause);
            break;
          case FULL_PROPAGATION:
            Propagator prop = (Propagator) cause;
            BoolVar bVar = (BoolVar) var;
            super.activePropagator(bVar, prop);
            break;
          default:
            throw new UnsupportedOperationException("Unknown type " + etype);
        }
      }
    }
    //        time += System.nanoTime();
    //        System.out.printf("depth %d, lazy %.3f ", count, time / (1000 * 1000f));

  }
Ejemplo n.º 2
0
 @Override
 public void beforeInitialPropagation() {
   for (Variable v : solver.getVars()) {
     super.getRemovedValues((IntVar) v);
   }
 }