I have a script in minizinc that tries to find the set of int, but is unable to do so. The problem statement is given a set of 2 class features, minimal support set needs to be found with constraints that its length should be less than some k, and with some array of set it should contain atleast one of the index value from them. So, suppose, that the solution is {3,4,7} and the array of set (let's call it - atmostone) atmostone = [{1,2,3}, {4,5,6}, {7,8,9}] so the intersection of the solution and each of the set from atmostone array must be of exactly length one.
These are the constraints I implemented, but the error is of model inconsistency.
include "globals.mzn";
include "alldifferent.mzn";
int: t; %number of attributes
int: k; %maximum size of support set
int: n; %number of positive instances
int: m; %number of negative instances
int: c; %number of atMostOne Constraints
array [1..n, 1..t] of 0..1: omegap;
array [1..m, 1..t] of 0..1: omegan;
array [int] of set of int: atMostOne;
set of int: K = 1..k;
set of int: T = 1..t;
var set of T: solution;
function array[int] of var opt int : set2array(var set of int: a) =
[i | i in a];
% constraint alldifferent(solution);
constraint length(set2array(solution)) <= k;
constraint forall(i in 1..length(atMostOne))(length(set2array(solution intersect atMostOne[i])) <= 1);
constraint forall(i in 1..n, j in 1..m)(not(omegap[i, fix(solution)] == omegan[j, fix(solution)]));
solve satisfy;
This is the error:
Compiling support_send.mzn
WARNING: model inconsistency detected
Running support_send.mzn
=====UNSATISFIABLE=====
% Top level failure!
Finished in 88msec
Update:
The data:
t=8; %number of attributes
k=3; %maximum size of support set
n=5; %number of positive instances
m=3; %number of negative instances
c=4; %number of atMostOne Constraints
omegap=[| 0,0,1,0,1,0,0,0 |
1,0,1,1,0,0,0,1|
0,1,0,1,0,0,1,1|
0,1,1,0,1,1,0,1|
0,0,1,0,1,1,1,1
|];
omegan=[| 1,1,0,0,1,0,1,1|
0,1,0,0,1,1,0,0|
1,0,0,1,1,0,0,1
|];
atMostOne =
[{1,2,3},
{4,5,6},
{3,5},
{7,8}];
Any help would be appreciated.
Thank You.