Hakank.CPUtils (Fixpoint v0.20.2)
Link to this section Summary
Functions
decreasing(x)
get_solution_value(res,sol,var_name)
increasing(x)
latin_square(x)
mat_at(m,i,j)
print_matrix(x,rows,cols, format \ "~2w")
scalar_product(xs,ys,total)
timeit(fun)
transpose(m)
Link to this section Functions
decreasing(x)
decreasing(x)
Decomposition of the global constraint increasing which ensures that
x is in increasing order.
get_solution_value(res, sol, var_name)
get_solution_value(res,sol,var_name)
Return the solution of variable named var_name (e.g. "x[3]") for
a specific solution sol.
Note: var_name handles only the single named variables found in
`res.variables`.
increasing(x)
increasing(x)
Decomposition of the global constraint increasing which ensures that
x is in increasing order.
latin_square(x)
latin_square(x)
Ensures that an n x n matrix x is a Latin Square.
##Examples##
> latin_square(x)
mat_at(m, i, j)
mat_at(m,i,j)
Returns the value (i,j) of the 2d matrix mat.
##Examples##
iex> [[1,2,3],[4,5,6],[7,8,9]] |> mat_at(1,2)
6
print_matrix(x, rows, cols, format \\ "~2w")
print_matrix(x,rows,cols, format \ "~2w")
Pretty print x as a matrix.
Note: x is assumed to be a list of rows*cols elements.
format is the spacing of the values, defaults to "~2w".
scalar_product(xs, ys, total)
scalar_product(xs,ys,total)
Ensures that xs * ys = total.
It is assumed that xs and ys are of the same length.
total can be either a decision variable or a constraint.
timeit(fun)
timeit(fun)
A simple timing function, returns the time in seconds (as a string).
##Examples##
> Util.timeit(&Test1.main/0)
> Util.timeit(fn () -> Test1.run() end)
transpose(m)
transpose(m)
Returns a transposed version of m.
##Example##
iex> [[1,2,3],[4,5,6],[7,8,9]] |> transpose
[[1, 4, 7], [2, 5, 8], [3, 6, 9]]