($!= X Y)($!= X Y Z & more)Constrains that X != Y, i.e. (not X = Y = ...)
Constrains that X != Y, i.e. (not X = Y = ...)
($* x y)Takes two arguments. One of the arguments can be a number greater than or equal to -1.
Takes two arguments. One of the arguments can be a number greater than or equal to -1.
($+ x)($+ x y & more)Takes a combination of int-vars and numbers, and returns another number/int-var which is constrained to equal the sum.
Takes a combination of int-vars and numbers, and returns another number/int-var which is constrained to equal the sum.
($- x)($- x & more)Takes a combination of int-vars and numbers, and returns another number/int-var which is constrained to equal (x - y - z - ...) or (-x) if there's only one argument.
Takes a combination of int-vars and numbers, and returns another number/int-var which is constrained to equal (x - y - z - ...) or (-x) if there's only one argument.
($< X__1294__auto__ Y__1295__auto__)($< X__1294__auto__ Y__1295__auto__ & more__1296__auto__)Constrains that X < Y. Giving more than 2 inputs results in an $and statement with multiple $< statements.
Constrains that X < Y. Giving more than 2 inputs results in an $and statement with multiple $< statements.
($<= X__1294__auto__ Y__1295__auto__)($<= X__1294__auto__ Y__1295__auto__ & more__1296__auto__)Constrains that X <= Y. Giving more than 2 inputs results in an $and statement with multiple $<= statements.
Constrains that X <= Y. Giving more than 2 inputs results in an $and statement with multiple $<= statements.
($= X Y)($= X Y Z & more)Constrains that X = Y. Giving more than 2 inputs results in an $and statement with multiple $= statements.
Constrains that X = Y. Giving more than 2 inputs results in an $and statement with multiple $= statements.
($> X__1294__auto__ Y__1295__auto__)($> X__1294__auto__ Y__1295__auto__ & more__1296__auto__)Constrains that X > Y. Giving more than 2 inputs results in an $and statement with multiple $> statements.
Constrains that X > Y. Giving more than 2 inputs results in an $and statement with multiple $> statements.
($>= X__1294__auto__ Y__1295__auto__)($>= X__1294__auto__ Y__1295__auto__ & more__1296__auto__)Constrains that X >= Y. Giving more than 2 inputs results in an $and statement with multiple $>= statements.
Constrains that X >= Y. Giving more than 2 inputs results in an $and statement with multiple $>= statements.
($abs X)Given a variable X, returns the absolute value of X, or |X|.
Given a variable X, returns the absolute value of X, or |X|.
($and & constraints)An "and" statement (i.e. "P^Q^..."); this statement is true if and only if every subconstraint is true.
An "and" statement (i.e. "P^Q^..."); this statement is true if and only if every subconstraint is true.
($cardinality variables frequencies & {:as args})Takes a list of variables, and a frequency map (from numbers to frequencies), constrains that the frequency map is accurate. If the :closed flag is set to true, any keys that aren't in the frequency map can't appear at all in the list of variables.
Example: ($cardinality [:a :b :c :d :e] {1 :ones, 2 :twos} :closed true) => {:a 1, :b 1, :c 2, :d 2, :e 2 :ones 2, :twos 3}
Takes a list of variables, and a frequency map (from numbers to frequencies), constrains
that the frequency map is accurate. If the :closed flag is set to true, any keys that aren't
in the frequency map can't appear at all in the list of variables.
Example: ($cardinality [:a :b :c :d :e] {1 :ones, 2 :twos} :closed true)
=> {:a 1, :b 1, :c 2, :d 2, :e 2
:ones 2, :twos 3}($circuit list-of-vars)($circuit list-of-vars offset)Given a list of int-vars L, and an optional offset number (default 0), the elements of L define a circuit, where (L[i] = j + offset) means that j is the successor of i. Hint: make the offset 1 when using a 1-based list.
Given a list of int-vars L, and an optional offset number (default 0), the elements of L define a circuit, where (L[i] = j + offset) means that j is the successor of i. Hint: make the offset 1 when using a 1-based list.
($cond & clauses)A convenience function for constructing a "cond"-like statement out of $if statements. The final "else" can be specified by itself (being the odd argument) or with the :else keyword.
Example: ($cond P Q, R S, :else T) => ($if P Q ($if R S T))
If no "else" clause is specified, it is "True" by default.
A convenience function for constructing a "cond"-like statement out of $if statements. The final "else" can be specified by itself (being the odd argument) or with the :else keyword. Example: ($cond P Q, R S, :else T) => ($if P Q ($if R S T)) If no "else" clause is specified, it is "True" by default.
($distinct vars)Given a bunch of int-vars, ensures that all of them have different values, i.e. no two of them are equal.
Given a bunch of int-vars, ensures that all of them have different values, i.e. no two of them are equal.
($if if-this then-this)($if if-this then-this else-this)An "if" statement (i.e. "implies", "P=>Q"); this statement is true if and only if P is false or Q is true. In other words, if P is true, Q must be true (otherwise the whole statement is false). An optional "else" field can be specified, which must be true if P is false.
An "if" statement (i.e. "implies", "P=>Q"); this statement is true if and only if P is false or Q is true. In other words, if P is true, Q must be true (otherwise the whole statement is false). An optional "else" field can be specified, which must be true if P is false.
($in var-name & args)Declares that a variable must be in a certain domain. Possible arglist examples: ($in :x 1 5) ($in :x [1 2 3 4 5]) ($in :x 1 5 :bounded)
Declares that a variable must be in a certain domain. Possible arglist examples: ($in :x 1 5) ($in :x [1 2 3 4 5]) ($in :x 1 5 :bounded)
($knapsack weights values occurrences total-weight total-value)Takes constant weights / values for a list of pre-defined items, and a list of variables representing the amount of each item. Constrains that the values of all the items add up to the total-value, while the items' weights add up to total-weight.
Example: ($knapsack [3 1 2] ; weights [5 6 7] ; values [:x :y :z] ; occurrences :W ; total weight :V) ; total value
Takes constant weights / values for a list of pre-defined items, and
a list of variables representing the amount of each item. Constrains that
the values of all the items add up to the total-value, while the items'
weights add up to total-weight.
Example: ($knapsack [3 1 2] ; weights
[5 6 7] ; values
[:x :y :z] ; occurrences
:W ; total weight
:V) ; total value($max & args)The maximum of several arguments. The arguments can be a mixture of int-vars and numbers.
The maximum of several arguments. The arguments can be a mixture of int-vars and numbers.
($min & args)The minimum of several arguments. The arguments can be a mixture of int-vars and numbers.
The minimum of several arguments. The arguments can be a mixture of int-vars and numbers.
($mod X Y)Given variables X and Y, returns X mod Y.
Given variables X and Y, returns X mod Y.
($not C)Given a constraint C, returns "not C" a.k.a. "~C", which is true iff C is false.
Given a constraint C, returns "not C" a.k.a. "~C", which is true iff C is false.
($nth list-of-vars index-var)($nth list-of-vars index-var offset)Given a list of int-vars L, an int-var i, and an optional offset number (default 0), returns a new int-var constrained to equal L[i], or L[i - offset].
Given a list of int-vars L, an int-var i, and an optional offset number (default 0), returns a new int-var constrained to equal L[i], or L[i - offset].
($or & constraints)An "or" statement (i.e. "PvQv..."); this statement is true if and only if at least one subconstraint is true.
An "or" statement (i.e. "PvQv..."); this statement is true if and only if at least one subconstraint is true.
($reify C)Given a constraint C, will generate a bool-var V such that (V = 1) iff C.
Given a constraint C, will generate a bool-var V such that (V = 1) iff C.
($scalar variables coefficients)Given a list of variables X, Y, Z, etc. and a list of number coefficients a, b, c, etc. returns a new variable constrained to equal aX + bY + cZ ...
Given a list of variables X, Y, Z, etc. and a list of number coefficients a, b, c, etc. returns a new variable constrained to equal aX + bY + cZ ...
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |