Encodes and adds the AMO constraint to the given solver.
@param s    the solver
@param lits the literals for the constraint
355816
public void encode(final MiniSatStyleSolver s, final LNGIntVector lits) {
    assert lits.size() != 0;
    if (lits.size() == 1)
      addUnitClause(s, lits.get(0));
    else {
      final LNGIntVector seqAuxiliary = new LNGIntVector();
      for (int i = 0; i < lits.size() - 1; i++) {
        seqAuxiliary.push(mkLit(s.nVars(), false));
        MaxSAT.newSATVariable(s);
      }
      for (int i = 0; i < lits.size(); i++) {
        if (i == 0) {
          addBinaryClause(s, lits.get(i), not(seqAuxiliary.get(i)));
          addBinaryClause(s, not(lits.get(i)), seqAuxiliary.get(i));
        } else if (i == lits.size() - 1) {
          addBinaryClause(s, lits.get(i), seqAuxiliary.get(i - 1));
          addBinaryClause(s, not(lits.get(i)), not(seqAuxiliary.get(i - 1)));
        } else {
          addBinaryClause(s, not(seqAuxiliary.get(i - 1)), seqAuxiliary.get(i));
          addTernaryClause(s, lits.get(i), not(seqAuxiliary.get(i)), seqAuxiliary.get(i - 1));
          addBinaryClause(s, not(lits.get(i)), seqAuxiliary.get(i));
          addBinaryClause(s, not(lits.get(i)), not(seqAuxiliary.get(i - 1)));
        }
      }
    }
  }
70525
private static Variable[] litsAsVars(final Literal[] lits) {
    final Variable[] vars = new Variable[lits.length];
    for (int i = 0; i < vars.length; i++)
      vars[i] = lits[i].variable();
    return vars;
  }
204780
public void addAlphaConstraint(AlphaNodeFieldConstraint constraint) {
        if ( constraint != null ) {
            AlphaNodeFieldConstraint[] tmp = this.alphaConstraints;
            this.alphaConstraints = new AlphaNodeFieldConstraint[tmp.length + 1];
            System.arraycopy( tmp,
                              0,
                              this.alphaConstraints,
                              0,
                              tmp.length );
            this.alphaConstraints[this.alphaConstraints.length - 1] = constraint;
            this.updateRequiredDeclarations( constraint );
        }
    }
988429
public void mTokens() throws RecognitionException {
        // InternalSARL.g:1:8: ( T__25 | T__26 | T__27 | T__28 | T__29 | T__30 | T__31 | T__32 | T__33 | T__34 | T__35 | T__36 | T__37 | T__38 | T__39 | T__40 | T__41 | T__42 | T__43 | T__44 | T__45 | T__46 | T__47 | T__48 | T__49 | T__50 | T__51 | T__52 | T__53 | T__54 | T__55 | T__56 | T__57 | T__58 | T__59 | T__60 | T__61 | T__62 | T__63 | T__64 | T__65 | T__66 | T__67 | T__68 | T__69 | T__70 | T__71 | T__72 | T__73 | T__74 | T__75 | T__76 | T__77 | T__78 | T__79 | T__80 | T__81 | T__82 | T__83 | T__84 | T__85 | T__86 | T__87 | T__88 | T__89 | T__90 | T__91 | T__92 | T__93 | T__94 | T__95 | T__96 | T__97 | T__98 | T__99 | T__100 | T__101 | T__102 | T__103 | T__104 | T__105 | T__106 | T__107 | T__108 | T__109 | T__110 | T__111 | T__112 | T__113 | T__114 | T__115 | T__116 | T__117 | T__118 | T__119 | T__120 | T__121 | T__122 | T__123 | T__124 | T__125 | T__126 | T__127 | T__128 | T__129 | T__130 | T__131 | T__132 | T__133 | T__134 | T__135 | T__136 | T__137 | T__138 | T__139 | T__140 | T__141 | T__142 | T__143 | T__144 | RULE_ID | RULE_RICH_TEXT | RULE_RICH_TEXT_START | RULE_RICH_TEXT_END | RULE_RICH_TEXT_INBETWEEN | RULE_COMMENT_RICH_TEXT_INBETWEEN | RULE_COMMENT_RICH_TEXT_END | RULE_HEX | RULE_INT | RULE_DECIMAL | RULE_STRING | RULE_ML_COMMENT | RULE_SL_COMMENT | RULE_WS | RULE_ANY_OTHER )
        int alt54=135;
        alt54 = dfa54.predict(input);
        switch (alt54) {
            case 1 :
                // InternalSARL.g:1:10: T__25
                {
                mT__25(); 

                }
                break;
            case 2 :
                // InternalSARL.g:1:16: T__26
                {
                mT__26(); 

                }
                break;
            case 3 :
                // InternalSARL.g:1:22: T__27
                {
                mT__27(); 

                }
                break;
            case 4 :
                // InternalSARL.g:1:28: T__28
                {
                mT__28(); 

                }
                break;
            case 5 :
                // InternalSARL.g:1:34: T__29
                {
                mT__29(); 

                }
                break;
            case 6 :
                // InternalSARL.g:1:40: T__30
                {
                mT__30(); 

                }
                break;
            case 7 :
                // InternalSARL.g:1:46: T__31
                {
                mT__31(); 

                }
                break;
            case 8 :
                // InternalSARL.g:1:52: T__32
                {
                mT__32(); 

                }
                break;
            case 9 :
                // InternalSARL.g:1:58: T__33
                {
                mT__33(); 

                }
                break;
            case 10 :
                // InternalSARL.g:1:64: T__34
                {
                mT__34(); 

                }
                break;
            case 11 :
                // InternalSARL.g:1:70: T__35
                {
                mT__35(); 

                }
                break;
            case 12 :
                // InternalSARL.g:1:76: T__36
                {
                mT__36(); 

                }
                break;
            case 13 :
                // InternalSARL.g:1:82: T__37
                {
                mT__37(); 

                }
                break;
            case 14 :
                // InternalSARL.g:1:88: T__38
                {
                mT__38(); 

                }
                break;
            case 15 :
                // InternalSARL.g:1:94: T__39
                {
                mT__39(); 

                }
                break;
            case 16 :
                // InternalSARL.g:1:100: T__40
                {
                mT__40(); 

                }
                break;
            case 17 :
                // InternalSARL.g:1:106: T__41
                {
                mT__41(); 

                }
                break;
            case 18 :
                // InternalSARL.g:1:112: T__42
                {
                mT__42(); 

                }
                break;
            case 19 :
                // InternalSARL.g:1:118: T__43
                {
                mT__43(); 

                }
                break;
            case 20 :
                // InternalSARL.g:1:124: T__44
                {
                mT__44(); 

                }
                break;
            case 21 :
                // InternalSARL.g:1:130: T__45
                {
                mT__45(); 

                }
                break;
            case 22 :
                // InternalSARL.g:1:136: T__46
                {
                mT__46(); 

                }
                break;
            case 23 :
                // InternalSARL.g:1:142: T__47
                {
                mT__47(); 

                }
                break;
            case 24 :
                // InternalSARL.g:1:148: T__48
                {
                mT__48(); 

                }
                break;
            case 25 :
                // InternalSARL.g:1:154: T__49
                {
                mT__49(); 

                }
                break;
            case 26 :
                // InternalSARL.g:1:160: T__50
                {
                mT__50(); 

                }
                break;
            case 27 :
                // InternalSARL.g:1:166: T__51
                {
                mT__51(); 

                }
                break;
            case 28 :
                // InternalSARL.g:1:172: T__52
                {
                mT__52(); 

                }
                break;
            case 29 :
                // InternalSARL.g:1:178: T__53
                {
                mT__53(); 

                }
                break;
            case 30 :
                // InternalSARL.g:1:184: T__54
                {
                mT__54(); 

                }
                break;
            case 31 :
                // InternalSARL.g:1:190: T__55
                {
                mT__55(); 

                }
                break;
            case 32 :
                // InternalSARL.g:1:196: T__56
                {
                mT__56(); 

                }
                break;
            case 33 :
                // InternalSARL.g:1:202: T__57
                {
                mT__57(); 

                }
                break;
            case 34 :
                // InternalSARL.g:1:208: T__58
                {
                mT__58(); 

                }
                break;
            case 35 :
                // InternalSARL.g:1:214: T__59
                {
                mT__59(); 

                }
                break;
            case 36 :
                // InternalSARL.g:1:220: T__60
                {
                mT__60(); 

                }
                break;
            case 37 :
                // InternalSARL.g:1:226: T__61
                {
                mT__61(); 

                }
                break;
            case 38 :
                // InternalSARL.g:1:232: T__62
                {
                mT__62(); 

                }
                break;
            case 39 :
                // InternalSARL.g:1:238: T__63
                {
                mT__63(); 

                }
                break;
            case 40 :
                // InternalSARL.g:1:244: T__64
                {
                mT__64(); 

                }
                break;
            case 41 :
                // InternalSARL.g:1:250: T__65
                {
                mT__65(); 

                }
                break;
            case 42 :
                // InternalSARL.g:1:256: T__66
                {
                mT__66(); 

                }
                break;
            case 43 :
                // InternalSARL.g:1:262: T__67
                {
                mT__67(); 

                }
                break;
            case 44 :
                // InternalSARL.g:1:268: T__68
                {
                mT__68(); 

                }
                break;
            case 45 :
                // InternalSARL.g:1:274: T__69
                {
                mT__69(); 

                }
                break;
            case 46 :
                // InternalSARL.g:1:280: T__70
                {
                mT__70(); 

                }
                break;
            case 47 :
                // InternalSARL.g:1:286: T__71
                {
                mT__71(); 

                }
                break;
            case 48 :
                // InternalSARL.g:1:292: T__72
                {
                mT__72(); 

                }
                break;
            case 49 :
                // InternalSARL.g:1:298: T__73
                {
                mT__73(); 

                }
                break;
            case 50 :
                // InternalSARL.g:1:304: T__74
                {
                mT__74(); 

                }
                break;
            case 51 :
                // InternalSARL.g:1:310: T__75
                {
                mT__75(); 

                }
                break;
            case 52 :
                // InternalSARL.g:1:316: T__76
                {
                mT__76(); 

                }
                break;
            case 53 :
                // InternalSARL.g:1:322: T__77
                {
                mT__77(); 

                }
                break;
            case 54 :
                // InternalSARL.g:1:328: T__78
                {
                mT__78(); 

                }
                break;
            case 55 :
                // InternalSARL.g:1:334: T__79
                {
                mT__79(); 

                }
                break;
            case 56 :
                // InternalSARL.g:1:340: T__80
                {
                mT__80(); 

                }
                break;
            case 57 :
                // InternalSARL.g:1:346: T__81
                {
                mT__81(); 

                }
                break;
            case 58 :
                // InternalSARL.g:1:352: T__82
                {
                mT__82(); 

                }
                break;
            case 59 :
                // InternalSARL.g:1:358: T__83
                {
                mT__83(); 

                }
                break;
            case 60 :
                // InternalSARL.g:1:364: T__84
                {
                mT__84(); 

                }
                break;
            case 61 :
                // InternalSARL.g:1:370: T__85
                {
                mT__85(); 

                }
                break;
            case 62 :
                // InternalSARL.g:1:376: T__86
                {
                mT__86(); 

                }
                break;
            case 63 :
                // InternalSARL.g:1:382: T__87
                {
                mT__87(); 

                }
                break;
            case 64 :
                // InternalSARL.g:1:388: T__88
                {
                mT__88(); 

                }
                break;
            case 65 :
                // InternalSARL.g:1:394: T__89
                {
                mT__89(); 

                }
                break;
            case 66 :
                // InternalSARL.g:1:400: T__90
                {
                mT__90(); 

                }
                break;
            case 67 :
                // InternalSARL.g:1:406: T__91
                {
                mT__91(); 

                }
                break;
            case 68 :
                // InternalSARL.g:1:412: T__92
                {
                mT__92(); 

                }
                break;
            case 69 :
                // InternalSARL.g:1:418: T__93
                {
                mT__93(); 

                }
                break;
            case 70 :
                // InternalSARL.g:1:424: T__94
                {
                mT__94(); 

                }
                break;
            case 71 :
                // InternalSARL.g:1:430: T__95
                {
                mT__95(); 

                }
                break;
            case 72 :
                // InternalSARL.g:1:436: T__96
                {
                mT__96(); 

                }
                break;
            case 73 :
                // InternalSARL.g:1:442: T__97
                {
                mT__97(); 

                }
                break;
            case 74 :
                // InternalSARL.g:1:448: T__98
                {
                mT__98(); 

                }
                break;
            case 75 :
                // InternalSARL.g:1:454: T__99
                {
                mT__99(); 

                }
                break;
            case 76 :
                // InternalSARL.g:1:460: T__100
                {
                mT__100(); 

                }
                break;
            case 77 :
                // InternalSARL.g:1:467: T__101
                {
                mT__101(); 

                }
                break;
            case 78 :
                // InternalSARL.g:1:474: T__102
                {
                mT__102(); 

                }
                break;
            case 79 :
                // InternalSARL.g:1:481: T__103
                {
                mT__103(); 

                }
                break;
            case 80 :
                // InternalSARL.g:1:488: T__104
                {
                mT__104(); 

                }
                break;
            case 81 :
                // InternalSARL.g:1:495: T__105
                {
                mT__105(); 

                }
                break;
            case 82 :
                // InternalSARL.g:1:502: T__106
                {
                mT__106(); 

                }
                break;
            case 83 :
                // InternalSARL.g:1:509: T__107
                {
                mT__107(); 

                }
                break;
            case 84 :
                // InternalSARL.g:1:516: T__108
                {
                mT__108(); 

                }
                break;
            case 85 :
                // InternalSARL.g:1:523: T__109
                {
                mT__109(); 

                }
                break;
            case 86 :
                // InternalSARL.g:1:530: T__110
                {
                mT__110(); 

                }
                break;
            case 87 :
                // InternalSARL.g:1:537: T__111
                {
                mT__111(); 

                }
                break;
            case 88 :
                // InternalSARL.g:1:544: T__112
                {
                mT__112(); 

                }
                break;
            case 89 :
                // InternalSARL.g:1:551: T__113
                {
                mT__113(); 

                }
                break;
            case 90 :
                // InternalSARL.g:1:558: T__114
                {
                mT__114(); 

                }
                break;
            case 91 :
                // InternalSARL.g:1:565: T__115
                {
                mT__115(); 

                }
                break;
            case 92 :
                // InternalSARL.g:1:572: T__116
                {
                mT__116(); 

                }
                break;
            case 93 :
                // InternalSARL.g:1:579: T__117
                {
                mT__117(); 

                }
                break;
            case 94 :
                // InternalSARL.g:1:586: T__118
                {
                mT__118(); 

                }
                break;
            case 95 :
                // InternalSARL.g:1:593: T__119
                {
                mT__119(); 

                }
                break;
            case 96 :
                // InternalSARL.g:1:600: T__120
                {
                mT__120(); 

                }
                break;
            case 97 :
                // InternalSARL.g:1:607: T__121
                {
                mT__121(); 

                }
                break;
            case 98 :
                // InternalSARL.g:1:614: T__122
                {
                mT__122(); 

                }
                break;
            case 99 :
                // InternalSARL.g:1:621: T__123
                {
                mT__123(); 

                }
                break;
            case 100 :
                // InternalSARL.g:1:628: T__124
                {
                mT__124(); 

                }
                break;
            case 101 :
                // InternalSARL.g:1:635: T__125
                {
                mT__125(); 

                }
                break;
            case 102 :
                // InternalSARL.g:1:642: T__126
                {
                mT__126(); 

                }
                break;
            case 103 :
                // InternalSARL.g:1:649: T__127
                {
                mT__127(); 

                }
                break;
            case 104 :
                // InternalSARL.g:1:656: T__128
                {
                mT__128(); 

                }
                break;
            case 105 :
                // InternalSARL.g:1:663: T__129
                {
                mT__129(); 

                }
                break;
            case 106 :
                // InternalSARL.g:1:670: T__130
                {
                mT__130(); 

                }
                break;
            case 107 :
                // InternalSARL.g:1:677: T__131
                {
                mT__131(); 

                }
                break;
            case 108 :
                // InternalSARL.g:1:684: T__132
                {
                mT__132(); 

                }
                break;
            case 109 :
                // InternalSARL.g:1:691: T__133
                {
                mT__133(); 

                }
                break;
            case 110 :
                // InternalSARL.g:1:698: T__134
                {
                mT__134(); 

                }
                break;
            case 111 :
                // InternalSARL.g:1:705: T__135
                {
                mT__135(); 

                }
                break;
            case 112 :
                // InternalSARL.g:1:712: T__136
                {
                mT__136(); 

                }
                break;
            case 113 :
                // InternalSARL.g:1:719: T__137
                {
                mT__137(); 

                }
                break;
            case 114 :
                // InternalSARL.g:1:726: T__138
                {
                mT__138(); 

                }
                break;
            case 115 :
                // InternalSARL.g:1:733: T__139
                {
                mT__139(); 

                }
                break;
            case 116 :
                // InternalSARL.g:1:740: T__140
                {
                mT__140(); 

                }
                break;
            case 117 :
                // InternalSARL.g:1:747: T__141
                {
                mT__141(); 

                }
                break;
            case 118 :
                // InternalSARL.g:1:754: T__142
                {
                mT__142(); 

                }
                break;
            case 119 :
                // InternalSARL.g:1:761: T__143
                {
                mT__143(); 

                }
                break;
            case 120 :
                // InternalSARL.g:1:768: T__144
                {
                mT__144(); 

                }
                break;
            case 121 :
                // InternalSARL.g:1:775: RULE_ID
                {
                mRULE_ID(); 

                }
                break;
            case 122 :
                // InternalSARL.g:1:783: RULE_RICH_TEXT
                {
                mRULE_RICH_TEXT(); 

                }
                break;
            case 123 :
                // InternalSARL.g:1:798: RULE_RICH_TEXT_START
                {
                mRULE_RICH_TEXT_START(); 

                }
                break;
            case 124 :
                // InternalSARL.g:1:819: RULE_RICH_TEXT_END
                {
                mRULE_RICH_TEXT_END(); 

                }
                break;
            case 125 :
                // InternalSARL.g:1:838: RULE_RICH_TEXT_INBETWEEN
                {
                mRULE_RICH_TEXT_INBETWEEN(); 

                }
                break;
            case 126 :
                // InternalSARL.g:1:863: RULE_COMMENT_RICH_TEXT_INBETWEEN
                {
                mRULE_COMMENT_RICH_TEXT_INBETWEEN(); 

                }
                break;
            case 127 :
                // InternalSARL.g:1:896: RULE_COMMENT_RICH_TEXT_END
                {
                mRULE_COMMENT_RICH_TEXT_END(); 

                }
                break;
            case 128 :
                // InternalSARL.g:1:923: RULE_HEX
                {
                mRULE_HEX(); 

                }
                break;
            case 129 :
                // InternalSARL.g:1:932: RULE_INT
                {
                mRULE_INT(); 

                }
                break;
            case 130 :
                // InternalSARL.g:1:941: RULE_DECIMAL
                {
                mRULE_DECIMAL(); 

                }
                break;
            case 131 :
                // InternalSARL.g:1:954: RULE_STRING
                {
                mRULE_STRING(); 

                }
                break;
            case 132 :
                // InternalSARL.g:1:966: RULE_ML_COMMENT
                {
                mRULE_ML_COMMENT(); 

                }
                break;
            case 133 :
                // InternalSARL.g:1:982: RULE_SL_COMMENT
                {
                mRULE_SL_COMMENT(); 

                }
                break;
            case 134 :
                // InternalSARL.g:1:998: RULE_WS
                {
                mRULE_WS(); 

                }
                break;
            case 135 :
                // InternalSARL.g:1:1006: RULE_ANY_OTHER
                {
                mRULE_ANY_OTHER(); 

                }
                break;

        }

    }
1042687
def add(self, *args):
        """"""
        self._constrs.extend(self._moma._prob.add_linear_constraints(*args))
1120206
private static String fixSymbols(final String s, final DecimalFormatSymbols symbols) {
		final char groupingSeparator = symbols.getGroupingSeparator();
		final char decimalSeparator = symbols.getDecimalSeparator();
		return s.replace(String.valueOf(groupingSeparator), "").replace(decimalSeparator, DEFAULT_DECIMAL_SEPARATOR);
	}
498516
public void addInclusion(SVar<T> s1, SVar<T> s2) {
	this.add(new LtConstraint<SVar<T>,Set<T>>(s1, s2));
    }
473744
public final void setConstraints(@NonNull final Constraint<Type>[] constraints) {
        Condition.INSTANCE.ensureNotNull(constraints, "The constraints may not be null");
        Condition.INSTANCE.ensureAtLeast(constraints.length, 1, "The constraints may not be empty");
        this.constraints = constraints;
    }
14233
def add_constraints(constrs)
      GLPK.glp_add_rows(@ptr, constrs.length)

      # Store each constraint and initialize a matrix used to hold
      # the coefficients of each value in the constraint matrix
      #
      # * ia - row (constraint) index
      # * ja - column (variable) index
      # * ar - constraint coefficient
      constrs.each do |constr|
        store_constraint constr
        constr.expression.terms.each do |var, coeff|
          @ia << constr.index
          @ja << var.index
          @ar << coeff
        end
      end

      ia_buffer = build_pointer_array @ia, :int
      ja_buffer = build_pointer_array @ja, :int
      ar_buffer = build_pointer_array @ar, :double

      GLPK.glp_load_matrix(@ptr, @ar.length - 1, ia_buffer, ja_buffer,
                           ar_buffer)

      @constraints.concat constrs
    end
981315
public final void addConstraint(@NonNull final Constraint<CharSequence> constraint) {
        Condition.INSTANCE.ensureNotNull(constraint, "The constraint may not be null");

        if (!constraints.contains(constraint)) {
            constraints.add(constraint);
            verifyPasswordStrength();
        }
    }
196722
private void addUnitClause(final MiniSatStyleSolver s, int a, int blocking) {
    assert this.clause.size() == 0;
    assert a != LIT_UNDEF;
    assert var(a) < s.nVars();
    this.clause.push(a);
    if (blocking != LIT_UNDEF)
      this.clause.push(blocking);
    s.addClause(this.clause, null);
    this.clause.clear();
  }
224555
def _expr2sat(ex, litmap): # pragma: no cover
    """"""
    if isinstance(ex, Literal):
        return str(litmap[ex])
    elif isinstance(ex, NotOp):
        return "-(" + _expr2sat(ex.x, litmap) + ")"
    elif isinstance(ex, OrOp):
        return "+(" + " ".join(_expr2sat(x, litmap)
                               for x in ex.xs) + ")"
    elif isinstance(ex, AndOp):
        return "*(" + " ".join(_expr2sat(x, litmap)
                               for x in ex.xs) + ")"
    elif isinstance(ex, XorOp):
        return ("xor(" + " ".join(_expr2sat(x, litmap)
                                  for x in ex.xs) + ")")
    elif isinstance(ex, EqualOp):
        return "=(" + " ".join(_expr2sat(x, litmap)
                               for x in ex.xs) + ")"
    else:
        fstr = ("expected ex to be a Literal or Not/Or/And/Xor/Equal op, "
                "got {0.__name__}")
        raise ValueError(fstr.format(type(ex)))
1064536
public void addConstraint (Shutdowner lhs, Constraint constraint, Shutdowner rhs)
    {
        switch (constraint) {
        case RUNS_BEFORE:
            _cycle.addShutdownConstraint(lhs, Lifecycle.Constraint.RUNS_BEFORE, rhs);
            break;
        case RUNS_AFTER:
            _cycle.addShutdownConstraint(lhs, Lifecycle.Constraint.RUNS_AFTER, rhs);
            break;
        }
    }
721542
public void setSizeConstraints(java.util.Collection<SizeConstraint> sizeConstraints) {
        if (sizeConstraints == null) {
            this.sizeConstraints = null;
            return;
        }

        this.sizeConstraints = new java.util.ArrayList<SizeConstraint>(sizeConstraints);
    }
1260912
public void addSchemaSource(Source s) {
        sources.add(s);
        validator.setSchemaSources(sources.toArray(new Source[0]));
    }
550767
Constraint getUniqueConstraintForExprs(Expression[] indexExprs) {
        for (int i = 0, size = constraintList.length; i < size; i++) {
            Constraint exprc = constraintList[i];

            if (exprc.isUniqueWithExprs(indexExprs)) {
                return exprc;
            }
        }
        return null;
    }
1067821
public static InsnList loadStringConst(String s) {
        Validate.notNull(s);
        InsnList ret = new InsnList();
        ret.add(new LdcInsnNode(s));
        return ret;
    }