minizinc-benchmarks icon indicating copy to clipboard operation
minizinc-benchmarks copied to clipboard

Potential benchmark example

Open a1880 opened this issue 5 years ago • 0 comments

I've tried to solve a problem from a YouTube video using MiniZinc.

% 
%  This model strives to solve the problem
%  discussed in a YouTube video of Michael Penn
%  
%  How large can a subset be???
%  https://youtu.be/ZOx_DMeHjyE
%
%  The solution shown is 905
%
int: n = 1989;

set of int: N = 1..n;

array[N] of var bool: select;

%  selected elements must not be 4 apart
constraint
    forall(i in 1..n-4) (not select[i] \/ not select[i+4]);
      
%  selected elements must not be 7 apart
constraint
    forall(i in 1..n-7) (not select[i] \/ not select[i+7]);      

var N: elements = sum(select);

solve maximize elements;

output ["\(elements) elements"];

The example is rather small. But I found that the various solver back-ends do have remarkably different run-times and optimization results.

a1880 avatar Dec 14 '20 22:12 a1880