help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] Modeling exclusive OR in Mathprog language


From: Michael Hennebry
Subject: Re: [Help-glpk] Modeling exclusive OR in Mathprog language
Date: Thu, 2 Apr 2015 13:17:05 -0500 (CDT)
User-agent: Alpine 1.00 (DEB 882 2007-12-20)

I'm a bit fuzzy on what you want.
If you want to express x=a XOR b, where a, b and x are binaries,
you just need four constraints,
the constraints that cut off 001, 010, 100 and 111.
That will give you the convex hull, which is as good as can be done.

               n
To express, x=XOR a[j]  ,  for some large n,
              j=1
                 n
note that 0 = x XOR XOR a[j]  .
                j=1

Add another integer variable:
         n
0 = x + SUM a[j] - 2*s
        j=1

The range of s in 0..floor((n+1)/2)

--
Michael   address@hidden
"SCSI is NOT magic. There are *fundamental technical
reasons* why it is necessary to sacrifice a young
goat to your SCSI chain now and then."   --   John Woods



reply via email to

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