EvaluateConstraints() method
770191
private void evaluateConstraints(DoubleSolution solution)  {
    double[] constraint = new double[this.getNumberOfConstraints()];

    double x1,x2,x3,x4,x5,x6;
    x1 = solution.getVariableValue(0);
    x2 = solution.getVariableValue(1);
    x3 = solution.getVariableValue(2);
    x4 = solution.getVariableValue(3);
    x5 = solution.getVariableValue(4);
    x6 = solution.getVariableValue(5);

    constraint[0] = (x1 + x2)/2.0 - 1.0;
    constraint[1] = (6.0 - x1 - x2)/6.0;
    constraint[2] = (2.0 - x2 + x1)/2.0;
    constraint[3] = (2.0 - x1 + 3.0*x2)/2.0;
    constraint[4] = (4.0 - (x3-3.0)*(x3-3.0) - x4)/4.0;
    constraint[5] = ((x5-3.0)*(x5-3.0) +x6 - 4.0)/4.0;

    double overallConstraintViolation = 0.0;
    int violatedConstraints = 0;
    for (int i = 0; i < getNumberOfConstraints(); i++) {
      if (constraint[i]<0.0){
        overallConstraintViolation+=constraint[i];
        violatedConstraints++;
      }
    }

    overallConstraintViolationDegree.setAttribute(solution, overallConstraintViolation);
    numberOfViolatedConstraints.setAttribute(solution, violatedConstraints);
  }
1325654
private boolean checkConstraint(Collection<String> constraints, Tile tile)
    {
        return tile != null
               && constraints.contains(mapGroup.getGroup(tile))
               && !tile.getFeature(TileCollision.class).getCollisionFormulas().isEmpty();
    }
1204878
@Override
    public List<Fence> buildConstraint(BtrPlaceTree t, List<BtrpOperand> args) {
        if (checkConformance(t, args)) {
          @SuppressWarnings("unchecked")
          List<VM> vms = (List<VM>) params[0].transform(this, t, args.get(0));
          @SuppressWarnings("unchecked")
          List<Node> ns = (List<Node>) params[1].transform(this, t, args.get(1));
            return vms != null && ns != null ? Fence.newFence(vms, ns) : Collections.emptyList();
        }
        return Collections.emptyList();
    }
598073
private ConstraintSet solveEquality() {
    List<Constraint> current = eqConstraints;
    List<Constraint> next = Lists.newArrayList();
    boolean done = false;
    boolean solvable = this.solvable;

    TypeReplacement nextBindings = new TypeReplacement(bindings);
    while (!done) {
      done = true;
      // Iterative constraint solving algorithm with four cases
      for (Constraint c : current) {
        Type subtype = c.subtype.substitute(nextBindings.getBindings());
        Type supertype = c.supertype.substitute(nextBindings.getBindings());
        
        if (subtype.isFunctional() && supertype.isFunctional()) {
          // Case 1: <a,b> = <c,d> => a = c && b = d
          
          // Replace this constraint with the entailed subtype
          // constraints on argument/return types.
          next.add(new Constraint(supertype.getArgumentType(), subtype.getArgumentType()));
          next.add(new Constraint(subtype.getReturnType(), supertype.getReturnType()));
          done = false;
        } else if (!subtype.isFunctional() && supertype.isFunctional()) {
          // Case 2: A = <c,d> => A = <c,d> (if A is a type var, else fail)
          if (subtype.hasTypeVariables()) {
            nextBindings.add(subtype.getAtomicTypeVar(), supertype);
            done = false;
          } else {
            solvable = false;
          }
        } else if (subtype.isFunctional() && !supertype.isFunctional()) {
          // Case 3: <c,d> = A => A = <c,d> (if A is a type var, else fail)
          if (supertype.hasTypeVariables()) {
            nextBindings.add(supertype.getAtomicTypeVar(), subtype);
            done = false;
          } else {
            solvable = false;
          }
        } else {
          // Case 4: A = B => A = B
          if (subtype.hasTypeVariables() && supertype.hasTypeVariables()) {
            if (subtype.getAtomicTypeVar() != supertype.getAtomicTypeVar()) {
              nextBindings.add(subtype.getAtomicTypeVar(), supertype);
            }
          } else if (subtype.hasTypeVariables()) {
            nextBindings.add(subtype.getAtomicTypeVar(), supertype);
            done = false;
          } else if (supertype.hasTypeVariables()) {
            nextBindings.add(supertype.getAtomicTypeVar(), subtype);
            done = false;
          } else {
            if (!subtype.equals(supertype)) {
              solvable = false;
            }
          }
        }
      }

      current = next;
      next = Lists.newArrayList();
    }
    
    List<Constraint> newSubConstraints = Lists.newArrayList();
    for (Constraint c : subConstraints) {
      newSubConstraints.add(c.substitute(nextBindings.getBindings()));
    }
    return new ConstraintSet(Lists.newArrayList(), newSubConstraints, nextBindings,
        solvable, typeVarCounter);
  }
681363
function setConstraints(oType, oConstraints) {
		var vIsDigitSequence, vMaxLength, vNullable;

		oType.oConstraints = undefined;
		if (oConstraints) {
			vMaxLength = oConstraints.maxLength;
			if (typeof vMaxLength === "string") {
				vMaxLength = parseInt(vMaxLength);
			}
			if (typeof vMaxLength === "number" && !isNaN(vMaxLength) && vMaxLength > 0) {
				oType.oConstraints = {maxLength : vMaxLength };
			} else if (vMaxLength !== undefined) {
				Log.warning("Illegal maxLength: " + oConstraints.maxLength, null, oType.getName());
			}
			vIsDigitSequence = oConstraints.isDigitSequence;
			if (vIsDigitSequence === true || vIsDigitSequence === "true") {
				oType.oConstraints = oType.oConstraints || {};
				oType.oConstraints.isDigitSequence = true;
			} else if (vIsDigitSequence !== undefined && vIsDigitSequence !== false
					&& vIsDigitSequence !== "false") {
				Log.warning("Illegal isDigitSequence: " + vIsDigitSequence, null, oType.getName());
			}

			vNullable = oConstraints.nullable;
			if (vNullable === false || vNullable === "false") {
				oType.oConstraints = oType.oConstraints || {};
				oType.oConstraints.nullable = false;
			} else if (vNullable !== undefined && vNullable !== true && vNullable !== "true") {
				Log.warning("Illegal nullable: " + vNullable, null, oType.getName());
			}
		}
	}
976974
Constraint getLimitConstraint() {
        Constraint result = null;
        for (Constraint constraint : getConstraints()) {
            if (constraint.getConstraintType() == Constraint.LIMIT) {
                // We're assuming only one LIMIT constraint at the moment
                result = constraint;
                break;
            }
        }
        return result;
    }
30568
function setConstraints(oType, oConstraints) {
		var vNullable;

		oType.oConstraints = undefined;
		if (oConstraints) {
			vNullable = oConstraints.nullable;
			if (vNullable === false || vNullable === "false") {
				oType.oConstraints = {nullable : false};
			} else if (vNullable !== undefined && vNullable !== true && vNullable !== "true") {
				Log.warning("Illegal nullable: " + vNullable, null, oType.getName());
			}
		}
		oType._handleLocalizationChange();
	}
767780
def eval_constraints(self, constraints):
        """"""
        # eval_ast is concretizing symbols and evaluating them, this can raise
        # exceptions.
        try:
            return all(self.eval_ast(c) for c in constraints)
        except errors.ClaripyZeroDivisionError:
            return False
4443
function constrain(value, max, size) {
          if (value < 0) {
            return 0;
          }

          if (value + size > max) {
            value = max - size;
            return value < 0 ? 0 : value;
          }

          return value;
        }
1096331
private void validateConstraint(RuleSet ruleSet, Constraint constraint, Severity severity) throws RuleException {
        if (!executedConstraints.contains(constraint)) {
            if (applyRequiredConcepts(ruleSet, constraint)) {
                ruleVisitor.visitConstraint(constraint, severity);
            } else {
                ruleVisitor.skipConstraint(constraint, severity);
            }
            executedConstraints.add(constraint);
        }
    }
1174759
function(){

            var its = this.options.iterations
                ,coef = 1 / its
                ;

            for (var i = 0; i < its; i++){

                // this.shuffleConstraints();
                this.resolveDistanceConstraints( coef );
                this.resolveAngleConstraints( coef );
            }
        }
1040181
@Override
  public void evaluate(DoubleSolution solution) {
    double[] fx = new double[getNumberOfObjectives()];
    double[] x = new double[getNumberOfVariables()];
    for (int i = 0; i < getNumberOfVariables(); i++) {
      x[i] = solution.getVariableValue(i) ;
    }

    fx[0] = 4.0 * x[0] * x[0] + 4 * x[1] * x[1];
    fx[1] = (x[0] - 5.0) * (x[0] - 5.0) + (x[1] - 5.0) * (x[1] - 5.0);

    solution.setObjective(0, fx[0]);
    solution.setObjective(1, fx[1]);

    this.evaluateConstraints(solution);
  }
464049
public void setValidationConstraints(Map<String, Map<String, Map<String, Map<String, ?>>>> validationConstraints) {
		this.validationConstraints = validationConstraints;
	}
296498
protected boolean validate(T obj) throws ParameterException {
    if(constraints != null) {
      for(ParameterConstraint<? super T> cons : this.constraints) {
        cons.test(obj);
      }
    }
    return true;
  }
376496
private void applyConstraints()
    {
        final Map<Tile, Collection<CollisionFormula>> toRemove = new HashMap<>();
        for (int v = 0; v < map.getInTileHeight(); v++)
        {
            for (int h = 0; h < map.getInTileWidth(); h++)
            {
                final Tile tile = map.getTile(h, v);
                if (tile != null)
                {
                    final TileCollision tileCollision = tile.getFeature(TileCollision.class);
                    toRemove.put(tile, checkConstraints(tileCollision, h, v));
                }
            }
        }
        for (final Entry<Tile, Collection<CollisionFormula>> current : toRemove.entrySet())
        {
            final Tile tile = current.getKey();
            final TileCollision tileCollision = tile.getFeature(TileCollision.class);
            for (final CollisionFormula formula : current.getValue())
            {
                tileCollision.removeCollisionFormula(formula);
            }
        }
    }
886259
function getConstraintRelId(constraintsNode, name) {
            var relIds = innerCore.getChildrenRelids(constraintsNode);
            var relId;
            for (var i = 0; i < relIds.length; i++) {
                if (name === innerCore.getAttribute(innerCore.getChild(constraintsNode, relIds[i]), 'name')) {
                    relId = relIds[i];
                    break;
                }
            }
            return relId;
        }
837492
private boolean meetsConstraint(String value, String constraint) {
        return (constraint == null) || constraint.equals(value);
    }