[Scip] have binary variable represent equality of two other vars?
George Nychis
gnychis at gmail.com
Mon Sep 23 07:21:04 CEST 2013
Hi Ambros,
Thanks a bunch for that trick, I appreciate it. That does work for me
also. Learning more of these hidden gems day by day in ZIMPL and SCIP...
- George
On Mon, Sep 23, 2013 at 1:19 AM, Ambros Gleixner <gleixner at zib.de> wrote:
> Of course it should read c == 1 - vabs( a - b ).
>
> Am 23.09.2013 07:13, schrieb Ambros Gleixner:
>
> 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<http://listserv.zib.de/mailman/listinfo/scip>
>>>>
>>>
>>>
>>>
>>>
>>> ______________________________**_________________
>>> Scip mailing list
>>> Scip at zib.de
>>> http://listserv.zib.de/**mailman/listinfo/scip<http://listserv.zib.de/mailman/listinfo/scip>
>>>
>>> ______________________________**_________________
> Scip mailing list
> Scip at zib.de
> http://listserv.zib.de/**mailman/listinfo/scip<http://listserv.zib.de/mailman/listinfo/scip>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.zib.de/pipermail/scip/attachments/20130923/f3e2a13b/attachment.html>
More information about the Scip
mailing list