Skip to content

Potential benchmark example #11

Description

@a1880

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions