[Scip] have binary variable represent equality of two other vars?
Ambros Gleixner
gleixner at zib.de
Mon Sep 23 07:13:36 CEST 2013
Hi George,
mathematically, you want c = 1 - |a-b|, and James' answer is the
standard linearization for this. You can let Zimpl do this
reformulation for you automatically by writing
c == vabs( a - b )
or using vabs( a - b ) directly in your constraints.
Happy zimpling,
Ambros
Am 20.09.2013 03:25, schrieb George Nychis:
> Haha, I had thought of that solution James. It seemed a little overkill
> to me, but maybe it is the only good way to do this. Let's see if
> someone can turn up with something better, and if all fails I'll settle
> for it. Thanks for pointing it out!
>
>
> On Thu, Sep 19, 2013 at 9:21 PM, James Gunning <James.Gunning at csiro.au
> <mailto:James.Gunning at csiro.au>> wrote:
>
> George, this may be completely dopey, but if one added a slack z to
> the objective, and equations
> z<=1, z>=a-b, z>= b-a, z=1-c (or some suitable simplification),
> that might work..
>
> George Nychis wrote:
>> This might be slightly off-topic, but I don't know where better to
>> ask. I'm having a hard time expressing something in ZIMPL
>> linearly. I have two variables a and b. I want the variable c to
>> be strictly binary and take on the value of 1 when a and b are
>> equal, and 0 otherwise. Does anyone know of a good way to express
>> this?
>>
>> Thanks!
>> George
>>
>>
>> _______________________________________________
>> Scip mailing list
>> Scip at zib.de <mailto:Scip at zib.de>
>> http://listserv.zib.de/mailman/listinfo/scip
>
>
>
>
> _______________________________________________
> Scip mailing list
> Scip at zib.de
> http://listserv.zib.de/mailman/listinfo/scip
>
More information about the Scip
mailing list