/** * Builds an ExplanationEngine * * @param slv associated solver's environment */ public LazyExplanationEngine(Solver slv) { super(slv); IEnvironment env = slv.getEnvironment(); curChunk = env.makeInt(0); nextTop = env.makeInt(0); varChunks = new IntVar[1][]; varChunks[0] = new IntVar[CHUNK_SIZE]; cauChunks = new ICause[1][]; cauChunks[0] = new ICause[CHUNK_SIZE]; masChunks = new EventType[1][]; masChunks[0] = new EventType[CHUNK_SIZE]; val1Chunks = new int[1][]; val1Chunks[0] = new int[CHUNK_SIZE]; val2Chunks = new int[1][]; val2Chunks[0] = new int[CHUNK_SIZE]; val3Chunks = new int[1][]; val3Chunks[0] = new int[CHUNK_SIZE]; up2date = false; }
public BitsetIntVarImpl(String name, int min, int max, Solver solver) { super(name, solver); IEnvironment env = solver.getEnvironment(); this.OFFSET = min; int capacity = max - min + 1; this.VALUES = env.makeBitSet(capacity); for (int i = 0; i <= max - min; i++) { this.VALUES.set(i, true); } this.LB = env.makeInt(0); this.UB = env.makeInt(max - min); this.SIZE = env.makeInt(capacity); }
public BitsetIntVarImpl(String name, int[] sortedValues, Solver solver) { super(name, solver); IEnvironment env = solver.getEnvironment(); OFFSET = sortedValues[0]; int capacity = sortedValues[sortedValues.length - 1] - OFFSET + 1; this.VALUES = env.makeBitSet(capacity); for (int i = 0; i < sortedValues.length; i++) { this.VALUES.set(sortedValues[i] - OFFSET, true); } this.LB = env.makeInt(0); this.UB = env.makeInt(capacity - 1); this.SIZE = env.makeInt(sortedValues.length); }
protected DomOverWDeg(Solver solver, long seed) { this.solver = solver; rand = new Random(seed); counter = new FailPerPropagator(solver.getCstrs(), solver); vid2dsize = new TIntIntHashMap(); vid2degree = new TIntIntHashMap(); vid2weig = new TIntIntHashMap(); pid2ari = new TIntObjectHashMap<IStateInt>(); pid2arity = new TIntIntHashMap(10, 0.5F, -1, -1); Variable[] vars = solver.getVars(); for (int i = 0; i < vars.length; i++) { vars[i].addMonitor(this); } Constraint[] cstrs = solver.getCstrs(); for (int i = 0; i < cstrs.length; i++) { Propagator[] props = cstrs[i].getPropagators(); for (int j = 0; j < props.length; j++) { pid2ari.put(props[j].getId(), solver.getEnvironment().makeInt(props[j].arity())); } } }
public BitsetXYSumView(IntVar a, IntVar b, Solver solver) { super(a, b, solver); int lbA = A.getLB(); int ubA = A.getUB(); int lbB = B.getLB(); int ubB = B.getUB(); OFFSET = lbA + lbB; VALUES = solver.getEnvironment().makeBitSet((ubA + ubB) - (lbA + lbB) + 1); DisposableRangeIterator itA = A.getRangeIterator(true); DisposableRangeIterator itB = B.getRangeIterator(true); while (itA.hasNext()) { itB.bottomUpInit(); while (itB.hasNext()) { VALUES.set(itA.min() + itB.min() - OFFSET, itA.max() + itB.max() - OFFSET + 1); itB.next(); } itB.dispose(); itA.next(); } itA.dispose(); SIZE.set(VALUES.cardinality()); }