Thank you guys for the quick response, porting the rest of the model right now!
2011/10/31 glpk xypron <[email protected]> > Hello Nilo, > > GLPK is a solver for linear problems, hence products of variables > are not allowed. > > > A[k] >= A[i] * A[j]; > If A is an array of binaries you could use a sum: > A[k] + 1 >= A[k-1] + A[k+1]; > > Best regards > > Xypron > > > > > -------- Original-Nachricht -------- > > Datum: Mon, 31 Oct 2011 18:38:49 -0200 > > Von: Nilo Cesar Teixeira <[email protected]> > > An: [email protected] > > Betreff: [Help-glpk] Modeling forced constraints with binary variables > > > 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* > > [email protected] > > (55) (11) 8571-5314 > > -- > Follow me at http://twitter.com/#!/xypron > > NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie! > Jetzt informieren: http://www.gmx.net/de/go/freephone > -- *Nilo Cesar Teixeira* [email protected] (55) (11) 8571-5314
_______________________________________________ Help-glpk mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-glpk
