Build a sat constraint

@param cstr the model-side constraint
@return the solver-side constraint
@throws SchedulerException if the process failed
498230
private ChocoConstraint build(Constraint cstr) throws SchedulerException {
        ChocoMapper mapper = params.getMapper();
        ChocoConstraint cc = mapper.get(cstr);
        if (cc == null) {
            throw new SchedulerModelingException(origin, "No implementation mapped to '" + cstr.getClass().getSimpleName() + "'");
        }
        return cc;
    }
491696
def t0_perpass_to_supconj(t0_perpass, period, ecc, per0):
    
    return ConstraintParameter(t0_perpass._bundle, "t0_perpass_to_supconj({}, {}, {}, {})".format(_get_expr(t0_perpass), _get_expr(period), _get_expr(ecc), _get_expr(per0)))
392678
private static Constraint loadConstraint(Annotation context) {
        Constraint constraint = null;
        final ServiceLoader<Constraint> constraints = ServiceLoader.load(Constraint.class);

        for (Constraint aConstraint : constraints) {
            try {
                aConstraint.getClass().getDeclaredMethod("check", context.annotationType());
                constraint = aConstraint;
                break;
            } catch (NoSuchMethodException e) {
                // Look for next implementation if method not found with required signature.
            }
        }

        if (constraint == null) {
            throw new IllegalStateException("Couldn't found any implementation of " + Constraint.class.getName());
        }
        return constraint;
    }
614911
public void build(final PackageBuildContext context,
                      final ReturnValueConstraintEvaluator constraintNode,
                      final ReturnValueDescr descr,
                      final ContextResolver contextResolver) {

        final String className = getClassName(context);
        
        AnalysisResult analysis = getAnalysis(context, descr);

        if ( analysis == null ) {
            // not possible to get the analysis results
            return;
        }

        buildReturnValueEvaluator(context, 
                                  constraintNode, 
                                  descr, 
                                  contextResolver, 
                                  className, 
                                  analysis);
    }
1005888
public static int dimensionFromConstraint(String constraint, String columnName) {
        Matcher matcher = Z_CONSTRAINT_PATTERN.matcher(constraint);
        if(matcher.find()) {
            String extractedColumnName = matcher.group(1).replace("\"","").replace("`", "");
            if(extractedColumnName.equalsIgnoreCase(columnName)) {
                int constraint_value = Integer.valueOf(matcher.group(8));
                String sign = matcher.group(5);
                if("<>".equals(sign) || "!=".equals(sign)) {
                    constraint_value = constraint_value == 3 ? 2 : 3;
                }
                if("<".equals(sign)) {
                    constraint_value = 2;
                }
                if(">".equals(sign)) {
                    constraint_value = constraint_value == 2 ? 3 : 2;
                }
                return constraint_value;
            }
        }
        return 2;
    }
1144710
@Override
    public List<? extends SatConstraint> buildConstraint(BtrPlaceTree t, List<BtrpOperand> args) {
        if (checkConformance(t, args)) {
            @SuppressWarnings("unchecked")
            Collection<Collection<VM>> vs = (Collection<Collection<VM>>) params[0].transform(this, t, args.get(0));
            @SuppressWarnings("unchecked")
            Collection<Collection<Node>> ps = (Collection<Collection<Node>>) params[1].transform(this, t, args.get(1));
            return vs != null && ps != null ? Collections.singletonList(new SplitAmong(vs, ps, false)) : Collections.emptyList();
        }
        return Collections.emptyList();
    }
1079003
public static Constraint moreControllerThanParticipant()
	{
		return new ConstraintAdapter(1)
		{
			PathAccessor partConv = new PathAccessor("PhysicalEntity/participantOf:Conversion");
			PathAccessor partCompAss = new PathAccessor("PhysicalEntity/participantOf:ComplexAssembly");
			PathAccessor effects = new PathAccessor("PhysicalEntity/controllerOf/controlled*:Conversion");

			@Override
			public boolean satisfies(Match match, int... ind)
			{
				PhysicalEntity pe = (PhysicalEntity) match.get(ind[0]);

				int partCnvCnt = partConv.getValueFromBean(pe).size();
				int partCACnt = partCompAss.getValueFromBean(pe).size();
				int effCnt = effects.getValueFromBean(pe).size();

				return (partCnvCnt - partCACnt) <= effCnt;
			}
		};
	}
810622
OrderedHashSet getDependentConstraints(Constraint constraint) {

        OrderedHashSet set = new OrderedHashSet();

        for (int i = 0, size = constraintList.length; i < size; i++) {
            Constraint c = constraintList[i];

            if (c.getConstraintType() == Constraint.MAIN) {
                if (c.core.uniqueName == constraint.getName()) {
                    set.add(c);
                }
            }
        }

        return set;
    }
433757
def build_constraint_matrix(constrs)
      cbeg = []
      cind = []
      cval = []
      constrs.each.map do |constr|
        cbeg << cind.length
        constr.expression.terms.each do |var, coeff|
          cind << var.index
          cval << coeff
        end
      end

      [cbeg, cind, cval]
    end
454841
public <T extends ThreadPoolTaskScheduler> T configure(T taskScheduler) {
		PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
		map.from(this.poolSize).to(taskScheduler::setPoolSize);
		map.from(this.awaitTermination)
				.to(taskScheduler::setWaitForTasksToCompleteOnShutdown);
		map.from(this.awaitTerminationPeriod).asInt(Duration::getSeconds)
				.to(taskScheduler::setAwaitTerminationSeconds);
		map.from(this.threadNamePrefix).to(taskScheduler::setThreadNamePrefix);
		if (!CollectionUtils.isEmpty(this.customizers)) {
			this.customizers.forEach((customizer) -> customizer.customize(taskScheduler));
		}
		return taskScheduler;
	}
88093
@SuppressWarnings("unchecked")
    public Constraint getConstraint(String ... typeInfo) {
        if( typeInfo == null || typeInfo.length < 1 ) {
            return getConstraints().iterator().next();
        }
        else if( typeInfo.length == 1 ) {
            Constraint c = getConstraint(new String[0]);
            DataType<?> attr = c.getType();
            Boolean b;
            
            b = (Boolean)attr.getValue(typeInfo[0]);
            if( b == null || !b ) {
                return constraints.get(1);
            }
            else {
                return constraints.get(2);
            }
        }
        else {
            return super.getConstraint(typeInfo);
        }
    }
1028630
public static int cusolverSpXcsrsymamdHost(
        cusolverSpHandle handle, 
        int n, 
        int nnzA, 
        cusparseMatDescr descrA, 
        Pointer csrRowPtrA, 
        Pointer csrColIndA, 
        Pointer p)
    {
        return checkResult(cusolverSpXcsrsymamdHostNative(handle, n, nnzA, descrA, csrRowPtrA, csrColIndA, p));
    }
772494
private AbstractRule processConstraint(RulesTextProvider textProvider)
    	throws ParserException
    {
    	log.debug("processConstraint");
        Constraint rule = new Constraint();
        int start = textProvider.getPos();
        LoadCommonRuleData(rule,textProvider);
        textProvider.addTOCElement(null, rule.getDescription(), start, textProvider.getPos(), TYPE_CONSTRAINT);
        exactOrError("{",textProvider);
        Expression condition = processAction(textProvider);
        if (condition.isAssign())
        {
            throw new ParserException("Found an assignment in a condition ",textProvider);
        }
        exactOrError("}",textProvider);
        rule.addCondition(condition);

        return rule;
    }
1077439
@Override
    public List<NoDelay> buildConstraint(BtrPlaceTree t, List<BtrpOperand> args) {
        if (checkConformance(t, args)) {
            @SuppressWarnings("unchecked")
            List<VM> s = (List<VM>) params[0].transform(this, t, args.get(0));
            return s != null ? NoDelay.newNoDelay(s) : Collections.emptyList();
        }
        return Collections.emptyList();
    }
1255210
def add_constraints(constrs)
      cbeg, cind, cval = build_constraint_matrix constrs

      cbeg_buffer = build_pointer_array cbeg, :int
      cind_buffer = build_pointer_array cind, :int
      cval_buffer = build_pointer_array cval, :double
      sense_buffer = build_pointer_array(constrs.map do |c|
        gurobi_sense(c.sense)
      end, :char)
      rhs_buffer = build_pointer_array constrs.map(&:rhs), :double

      names_buffer = build_pointer_array array_to_pointers_to_names(constrs),
                                         :pointer

      ret = Gurobi.GRBaddconstrs @ptr, constrs.length, cind.length,
                                 cbeg_buffer, cind_buffer, cval_buffer,
                                 sense_buffer, rhs_buffer, names_buffer
      fail if ret != 0

      constrs.each do |constr|
        constr.model = self
        constr.index = @constraints.length
        constr.freeze
        @constraints << constr
      end
    end
154061
public static ComparableDateTimeFormatter compile(final String valueStr)
    {
        final ComparableDateTimeFormatter cp = new ComparableDateTimeFormatter();
        cp.delegate = DateTimeFormatter.ofPattern(valueStr);
        cp.pattern = valueStr;
        return cp;
    }
346240
public RuleConditionElement build(RuleBuildContext context,
                                      PatternDescr patternDescr,
                                      Pattern prefixPattern) {
        if (patternDescr.getObjectType() == null) {
            lookupObjectType(context, patternDescr);
        }

        if (patternDescr.getObjectType() == null || patternDescr.getObjectType().equals("")) {
            registerDescrBuildError(context, patternDescr, "ObjectType not correctly defined");
            return null;
        }

        ObjectType objectType = getObjectType(context, patternDescr);
        if (objectType == null) { // if the objectType doesn't exist it has to be query
            return buildQuery(context, patternDescr, patternDescr);
        }

        Pattern pattern = buildPattern(context, patternDescr, objectType);
        processClassObjectType(context, objectType, pattern);
        processAnnotations(context, patternDescr, pattern);
        processSource(context, patternDescr, pattern);
        processConstraintsAndBinds(context, patternDescr, pattern);
        processBehaviors(context, patternDescr, pattern);

        if (!pattern.hasNegativeConstraint() && "on".equals(System.getProperty("drools.negatable"))) {
            // this is a non-negative pattern, so we must inject the constraint
            pattern.addConstraint(new NegConstraint(false));
        }

        // poping the pattern
        context.getDeclarationResolver().popBuildStack();

        return pattern;
    }