% propagate and search
declare D1 D2
D1::0#9
D2::0#9
{Browse D1}
{Browse D2}
D1+D2 =: 10
% reduces search space from 100 to 81 possibilities
% D1 and D2 cannot be 0.
D1*D2 >=: 24
% reduces search space to 9 possibilities
% D1 and D2 must be between 4 and 6
D1 <: D2
% reduces search space to 4 possibilities
% D1 must be 4 or 5, and D2 must be 5 or 6
% it does not find unique solution D1=4 D2=6
% You can enter constraints in any order:
% computation is deterministic with no failures.
% propagate and search
% Find a rectangle whose perimeter is 20 and area greater than or
% equal to 24, and width is less than height.
% Find W,H so that (W+H = 10) ^ (W*H >=24) ^ (W < H)
declare
fun {Rectangle}
W H in
W::0#9 H::0#9
W+H =: 10
W*H >=: 24
W <: H
{FD.distribute naive rect(W H)}
rect(W H)
end
{Browse {Search.base.all Rectangle}}
{ExploreAll Rectangle}