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)

Decomposition of the global constraint increasing which ensures that x is in increasing order.

Link to this function

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)

Decomposition of the global constraint increasing which ensures that x is in increasing order.

Link to this function

latin_square(x)

latin_square(x)

Ensures that an n x n matrix x is a Latin Square.

##Examples##

> latin_square(x)
Link to this function

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
Link to this function

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)

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)

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]]