help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-glpk] Modeling forced constraints with binary variables


From: Nilo Cesar Teixeira
Subject: [Help-glpk] Modeling forced constraints with binary variables
Date: Mon, 31 Oct 2011 18:38:49 -0200

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.

--
Nilo Cesar Teixeira
address@hidden
(55) (11) 8571-5314


reply via email to

[Prev in Thread] Current Thread [Next in Thread]