private static List<Constraint<?>> reduce(List<Constraint<?>> constraints){
  Constraint<?> target=constraints.get(constraints.size() - 1);
  Set<Variable<?>> dependencies=getVariables(target);
  LinkedList<Constraint<?>> coi=new LinkedList<Constraint<?>>();
  coi.add(target);
  for (int i=constraints.size() - 2; i >= 0; i--) {
    Constraint<?> constraint=constraints.get(i);
    Set<Variable<?>> variables=getVariables(constraint);
    for (    Variable<?> var : dependencies) {
      if (variables.contains(var)) {
        dependencies.addAll(variables);
        coi.addFirst(constraint);
        break;
      }
    }
  }
  return coi;
}

private static List < Constraint < ? > > reduce ( List < Constraint < ? > > constraints ) { Constraint < ? > target = constraints . get ( constraints . size ( ) - 1 ) ; Set < Variable < ? > > dependencies = getVariables ( target ) ; LinkedList < Constraint < ? > > coi = new LinkedList < Constraint < ? > > ( ) ; coi . add ( target ) ; for ( int i = constraints . size ( ) - 2 ; i >= 0 ; i -- ) { Constraint < ? > constraint = constraints . get ( i ) ; Set < Variable < ? > > variables = getVariables ( constraint ) ; for ( Variable < ? > var : dependencies ) { if ( variables . contains ( var ) ) { dependencies . addAll ( variables ) ; coi . addFirst ( constraint ) ; break ; } } } return coi ; }
apply cone of influence reduction to constraints with respect to the last constraint in the list
