Liking cljdoc? Tell your friends :D

loco.constraints


$!=clj

($!= X Y)
($!= X Y Z & more)

Constrains that X != Y, i.e. (not X = Y = ...)

Constrains that X != Y, i.e. (not X = Y = ...)
sourceraw docstring

$*clj

($* 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.
sourceraw docstring

$+clj

($+ 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.
sourceraw docstring

$-clj

($- 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.
sourceraw docstring

$<clj

($< 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.
sourceraw docstring

$<=clj

($<= 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.
sourceraw docstring

$=clj

($= 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.
sourceraw docstring

$>clj

($> 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.
sourceraw docstring

$>=clj

($>= 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.
sourceraw docstring

$absclj

($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|.
sourceraw docstring

$andclj

($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.
sourceraw docstring

$cardinalityclj

($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}
sourceraw docstring

$circuitclj

($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.
sourceraw docstring

$condclj

($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.
sourceraw docstring

$distinctclj

($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.
sourceraw docstring

$falseclj

($false)

Always false.

Always false.
sourceraw docstring

$ifclj

($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.
sourceraw docstring

$inclj

($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)
sourceraw docstring

$knapsackclj

($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
sourceraw docstring

$maxclj

($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.
sourceraw docstring

$minclj

($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.
sourceraw docstring

$modclj

($mod X Y)

Given variables X and Y, returns X mod Y.

Given variables X and Y, returns X mod Y.
sourceraw docstring

$notclj

($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.
sourceraw docstring

$nthclj

($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].
sourceraw docstring

$orclj

($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.
sourceraw docstring

$reifyclj

($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.
sourceraw docstring

$scalarclj

($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 ...
sourceraw docstring

$trueclj

($true)

Always true.

Always true.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close