Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential benchmark example #11

Open
a1880 opened this issue Dec 14, 2020 · 0 comments
Open

Potential benchmark example #11

a1880 opened this issue Dec 14, 2020 · 0 comments

Comments

@a1880
Copy link

a1880 commented Dec 14, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant