RosettaCodeData/Task/Longest-increasing-subsequence/Picat/longest-increasing-subsequence-3.picat
2023-07-01 13:44:08 -04:00

22 lines
457 B
Text

import sat. % for lis_cp
% import cp. % Slower than sat on larger instances.
go =>
nolog,
Tests = [
[3,2,6,4,5,1],
[0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15],
[1,1,1,1],
[4,65,2,-31,0,99,83,782,1]
],
Funs = [lis_mode, lis_cp],
foreach(Fun in Funs)
println(fun=Fun),
foreach(Test in Tests)
call(Fun,Test,Lis,Len),
printf("%w: LIS=%w (len=%d)\n",Test, Lis,Len)
end,
nl,
end,
nl.