Simplifies `e`. If `e` is None, simplifies the constraints of this
        state.
187529
def simplify(self, e=None):
        
        if e is None:
            return self._solver.simplify()
        elif isinstance(e, (int, float, bool)):
            return e
        elif isinstance(e, claripy.ast.Base) and e.op in claripy.operations.leaf_operations_concrete:
            return e
        elif isinstance(e, SimActionObject) and e.op in claripy.operations.leaf_operations_concrete:
            return e.ast
        elif not isinstance(e, (SimActionObject, claripy.ast.Base)):
            return e
        else:
            return self._claripy_simplify(e)
1306862
def constrain_oddeven(self, diff, **kwargs):
        
        if 'odd-even' not in self.constraints:
            self.constraints.append('odd-even')
        for pop in self.poplist:
            if isinstance(pop, EclipsePopulation_Px2):
                pop.constrain_oddeven(diff, **kwargs)
        self.oddeven_diff = diff
826489
def hasconstraint(self):
        
        constrained = False
        for term in self._terms:
            constrained = constrained or term.hasconstraint
        return constrained
361063
def simplify(self, options=None):
        

        # TODO: we might want to get rid of this method and just move
        # it into the JSONEncoder in report.py

        simple = super(GenericChange, self).simplify(options)

        ld = self.pretty_ldata()
        if ld is not None:
            simple["old_data"] = ld

        rd = self.pretty_rdata()
        if rd is not None:
            simple["new_data"] = rd

        return simple
931474
def constrain (n, min, max):

    ''' '''

    if n < min:
        return min
    if n > max:
        return max
    return n
302713
private static void precedenceIfOverlap(ReconfigurationProblem rp, Slice d, Slice c) {
        Model csp = rp.getModel();
        //No need to place the constraints if the slices do not have a chance to overlap
        if (!(c.getHoster().isInstantiated() && !d.getHoster().contains(c.getHoster().getValue()))
                && !(d.getHoster().isInstantiated() && !c.getHoster().contains(d.getHoster().getValue()))
                ) {
            BoolVar eq = csp.boolVar(rp.makeVarLabel(d.getHoster(), "", c.getHoster(), "?"));
          rp.getModel().arithm(d.getHoster(), "=", c.getHoster()).reifyWith(eq);
          org.chocosolver.solver.constraints.Constraint leqCstr = rp.getModel().arithm(c.getEnd(), "<=", d.getStart());
            ChocoUtils.postImplies(rp, eq, leqCstr);
        }
    }
99076
public final void setConstraint(@NonNull final Constraint<Type> constraint) {
        Condition.INSTANCE.ensureNotNull(constraint, "The constraint may not be null");
        this.constraint = constraint;
    }
428619
private ConstraintSet makeAtomic() {
    boolean done = false;
    List<Constraint> current = subConstraints;
    List<Constraint> next = Lists.newArrayList();
    TypeReplacement nextBindings = new TypeReplacement(bindings);
    boolean solvable = this.solvable;
    while (!done) {
      done = true;
      for (Constraint c : current) {
        Constraint substituted = c.substitute(nextBindings.getBindings());
        Type subtype = substituted.subtype;
        Type supertype = substituted.supertype;
        
        if (subtype.isFunctional() && supertype.isFunctional()) {
          next.add(new Constraint(supertype.getArgumentType(), subtype.getArgumentType()));
          next.add(new Constraint(subtype.getReturnType(), supertype.getReturnType()));
          done = false;
        } else if (!subtype.isFunctional() && supertype.isFunctional()) {
          if (subtype.hasTypeVariables()) {
            Type subtypeReplacement = upcast(supertype, next, false);
            nextBindings.add(subtype.getAtomicTypeVar(), subtypeReplacement);
            done = false;
          } else {
            solvable = false;
          }
        } else if (subtype.isFunctional() && !supertype.isFunctional()) {
          if (supertype.hasTypeVariables()) {
            Type supertypeReplacement = upcast(subtype, next, true);
            nextBindings.add(supertype.getAtomicTypeVar(), supertypeReplacement);
            done = false;
          } else {
            solvable = false;
          }
        } else {
          next.add(substituted);
        }
      }

      current = next;
      next = Lists.newArrayList();
    }

    return new ConstraintSet(Lists.newArrayList(), current, nextBindings,
        solvable, typeVarCounter);
  }
1330084
def _merge_constraints(constraints, overrides):
    
    for o in overrides:
        i = 0
        while i < len(constraints):
            c = constraints[i]
            if _same(o, c):
                constraints[i].update(o)
                break
            i = i + 1
333820
def enforce_bounds(self, v):
        
        self._enforce_bounds = v
        self.k1.enforce_bounds = v
        self.k2.enforce_bounds = v
10537
static MinimizedCondition fromConditionNode(Node n) {
    checkState(n.getParent() != null);
    switch (n.getToken()) {
      case NOT:
      case AND:
      case OR:
      case HOOK:
      case COMMA:
        return computeMinimizedCondition(n);
      default:
        return unoptimized(n);
    }
  }
875108
def satisfies_constraints(self, possible_solution):
        """"""
        for c in self._constraints:
            values = c.extract_values(possible_solution)
            if any(type(v) is NilObject for v in values) or not c(*values):
                return False
        return True
665788
def reset_small(self, eq):
        """"""
        assert eq in ('f', 'g')
        for idx, var in enumerate(self.__dict__[eq]):
            if abs(var) <= 1e-12:
                self.__dict__[eq][idx] = 0
692060
def indicator_constraints(self,x):
        
        x = np.atleast_2d(x)
        I_x = np.ones((x.shape[0],1))
        if self.constraints is not None:
            for d in self.constraints:
                try:
                    exec('constraint = lambda x:' + d['constraint'], globals())
                    ind_x = (constraint(x) <= 0) * 1
                    I_x *= ind_x.reshape(x.shape[0],1)
                except:
                    print('Fail to compile the constraint: ' + str(d))
                    raise
        return I_x
664227
function Constraint(left_op, right_op, isList) {
  this.left = left_op;
  this.right = right_op;
  this.isList = false;
  if (isList) {
    this.isList = isList;
  }
}
628535
function () {
		var parts = this._parts,
		    tolerance = this.options.smoothFactor;

		for (var i = 0, len = parts.length; i < len; i++) {
			parts[i] = L.LineUtil.simplify(parts[i], tolerance);
		}
	}
1249857
def _solve(self, sense=None):
        
        # Remove the constraints from the last run
        while len(self._remove_constr) > 0:
            self._remove_constr.pop().delete()

        try:
            return self._prob.solve(sense=sense)
        except lp.SolverError as e:
            raise_from(MOMAError(text_type(e)), e)
        finally:
            self._remove_constr = []