> Hi all,
>
> Can you please advise on the following problem ?
>
> Suppose I have an 1-dimensional array of binary variables, in which
> patterns like these are ok:
>
> A = 1110000;
> A = 0000011;
> A = 0000000;
> A = 1111111;
>
> But this pattern is NOT allowed:
>
> A = 1110111;
>
> So, a zero should not occur if it is surrounded by ones.
>
> I tried to model this, and until now I'm using forced constraints based on
> this pseudo-algorithm (assuming A indexing is one-based for simplicity):
>
> for i := 1 to count(A) do
> for j := i+2 to count(A) do
> for k := i+1 to j-1 do
> A[k] >= A[i] * A[j];
> next
> next
> next
>
> So, if A[k] is zero, then A[i] and A[j] can't be one!
>
> This is working in other commercial solver, but I would like to make this
> work on glpk.
>
> Nevertheless, as I compile it fails saying that the constraint is not
> linear.
>
> Even the commercial solver states the compiling model as INLP
> (non-linear),
> but it solves it in seconds.
>
> Is there any way this could work on glpk ?
>
> Thank you.
>
> --