element
element(x+I) = C
element(V,x{,I}) = C
element(V,x{,I}) = z with x,z cpvar and I integer
z = element(V,x{,I}) with x,z cpvar and I integer
element(M,x,y) = z with x,y,z cpvar
z = element(M,x,y) with x,y,z cpvar
C
|
a constant integer value
|
z
|
the value variable
|
x
|
first index variable
|
y
|
second index variable
|
I
|
optional constant offset for index
|
V
|
a one-dimensional array of integer values
|
M
|
a matrix (two-dimensional array) of integers
|
model "Element" uses "kalis" declarations RY = 43..52 RX = 1..2 D: array(RY) of integer D2: array(RX,RY) of integer x,y,d_of_y,d_of_x_y: cpvar end-declarations D :: (43..52)[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9] D2:: (1..2,43..52)[10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29] setname(x, "x") setname(y, "y") setname(d_of_y, "d_of_y") setname(d_of_x_y, "d_of_x_y") writeln("Original domains: ", x, y, d_of_y, d_of_x_y) element(D,y) = d_of_y element(D2,x,y) = d_of_x_y writeln("After propagation: ", x, y, d_of_y, d_of_x_y) ! Solve the problem while (cp_find_next_sol) do nbSolutions += 1 writeln("Solution ", nbSolutions, ": x:", getsol(x), " y:", getsol(y), " d_of_y:", getsol(d_of_y), " d_of_x_y:", getsol(d_of_x_y)) end-do writeln("done!") end-model
© 2001-2024 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.