public void solveReified(
      JacopSoftConstraintProblem scsp,
      DirectedConstraintGraph dcg,
      HashMap<Constraint, WrappedPrimitiveConstraint> constraintMapper) {
    constraintMap = new HashMap<String, WrappedPrimitiveConstraint>();
    allIndicatorVariables = new ArrayList<BooleanVar>(constraintMapper.size());

    constantOne = new BooleanVar(scsp.getStore(), "constOne", 1, 1);
    constantZero = new BooleanVar(scsp.getStore(), "constZero", 0, 0);
    store = scsp.getStore();

    for (Entry<Constraint, WrappedPrimitiveConstraint> entry : constraintMapper.entrySet()) {
      constraintMap.put(entry.getKey().getName(), entry.getValue());
      allIndicatorVariables.add(entry.getValue().getViolationIndicator());
    }

    IntVar[] vars =
        new IntVar
            [scsp.getVariables().size() + allIndicatorVariables.size() + 3]; // including zero one
    // constants

    if (weighted) {
      for (BooleanVar bv : allIndicatorVariables) {
        bv.weight = Integer.MAX_VALUE / 2;
      }
    }
    vars = allIndicatorVariables.toArray(vars);

    ArrayList<IntVar> classicalVars = new ArrayList<IntVar>(scsp.getVariables());

    for (int i = allIndicatorVariables.size(); i < vars.length - 3; ++i) {
      vars[i] = classicalVars.get(i - allIndicatorVariables.size());
    }
    vars[vars.length - 1] = scsp.getObjective();
    vars[vars.length - 2] = constantZero;
    vars[vars.length - 3] = constantOne;

    search = new DepthFirstSearch<IntVar>();
    search.setPrintInfo(debug);

    select = new InputOrderSelect<IntVar>(store, vars, new IndomainMin<IntVar>());

    if (weighted) {
      select =
          new SimpleSelect<IntVar>(vars, new WeightedDegree<IntVar>(), new IndomainMin<IntVar>());
    }
    // now for the actual enumeration

    objective = scsp.getObjective();
    if (weighted) {
      enumerator = new WeightedViolationDegreeEnumerator(dcg);
    } else {
      enumerator = new ConstraintRelationshipViolationDegreeEnumerator(dcg);
    }

    enumerator.addViolationDegreeListener(this);
    enumerator.enumerate();
  }
  public boolean solveHard(JacopSoftConstraintProblem jscsp) {
    solveReified = false;
    idToConstraintMap =
        new HashMap<String, org.jacop.constraints.Constraint>(jscsp.getConstraints().size());
    for (org.jacop.constraints.Constraint jconstraint : jscsp.getConstraints()) {
      idToConstraintMap.put(jconstraint.id, jconstraint);
    }

    IntVar[] vars = new IntVar[jscsp.getVariables().size()]; // including zero one
    // constants

    ArrayList<IntVar> classicalVars = new ArrayList<IntVar>(jscsp.getVariables());

    store = jscsp.getStore();
    vars = classicalVars.toArray(vars);
    search = new DepthFirstSearch<IntVar>();
    search.setPrintInfo(debug);

    select = new InputOrderSelect<IntVar>(store, vars, new IndomainMin<IntVar>());

    if (weighted) {
      select =
          new SimpleSelect<IntVar>(vars, new WeightedDegree<IntVar>(), new IndomainMin<IntVar>());
    }
    graph = jscsp.getDirectedConstraintGraph();
    upperCostBound = jscsp.getUpperCostBound();

    if (weighted) {
      enumerator = new WeightedViolationDegreeEnumerator(graph);
    } else {
      enumerator = new ConstraintRelationshipViolationDegreeEnumerator(graph);
    }

    enumerator.addViolationDegreeListener(this);
    wasSolved = false;
    enumerator.enumerate();
    return wasSolved;
  }