/** * Merge equal IntegerVariable into a unique one. * * @param k number of unique variables * @param nbIntVars number of integer variable within the model * @param color array of indice of unique variables * @param domainByColor domain of unique variables */ @Override protected void apply( final int k, final int nbIntVars, final int[] color, final TIntObjectHashMap<IntegerVariableMerger> domainByColor) { final IntDomainVar[] var = new IntDomainVar[k + 1]; IntegerVariableMerger dtmp; IntegerVariable vtmp; for (int i = 0; i < nbIntVars; i++) { final int col = color[i]; if (col != -1) { final IntegerVariable v = model.getIntVar(i); if (var[col] == null) { dtmp = domainByColor.get(col); vtmp = dtmp.create(); vtmp.addOptions(dtmp.optionsSet); vtmp.findManager(CPModel.properties); var[col] = (IntDomainVar) ppsolver.getMod2Sol().readModelVariable(vtmp); } ppsolver.setVar(v, var[col]); } } }
/** * Delete link between Model object and Solver object. * * @param c constraint to break */ @Override protected void action(final Constraint c) { ppsolver.setCstr(c, null); }