[SCIP] How to check and separate only integer solutions in a constraint handler?

Mathieu Besançon mathieu.besancon at gmail.com
Sat Apr 15 16:21:41 CEST 2023


[Resending to the whole list]

Dear Juan,
This might be a matter of the priority you set for the constraint handler.
The integrality constraint handler has a priority of 0 so if you want your
constraint handler to only receive integer solutions, its priority should
be negative.
This is explained in the TSP example, TSP/src/ConshdlrSubtour.cpp line 108
onwards:

 *  The integrality constraint handler has a check priority of zero. A
constraint handler which can
 *  (or wants) to check its constraints only for integral solutions should
have a negative check priority
 *  (e.g. the alldiff-constraint can only operate on integral solutions).

The methods you implemented seem to be the relevant ones.

Best,
Mathieu


On Sat, Apr 15, 2023 at 11:03 AM Lastra Diaz Jose <j.lastra at lectra.com>
> wrote:
>
>> Dear all,
>>
>>
>>
>> I am implementing a branch-and-Check approach to solve a 0-1 ILP model
>> and I would like to check the feasibility of integer solutions, and insert
>> a feasibility cut to separate those infeasible solutions. I have
>> implemented a constraint handler based on the TSP example, but I have not
>> understood well what callback I should implement. I have implemented the
>> four separation and enforcement callback below, as done in TSP example, but
>> when I check the solution in these callbacks, the solution is not binary.
>> Likewise, I do not know how to skip non-integer solutions in the check
>> callback.
>>
>>
>>
>> What should I do to check and separate only infeasible integer solutions?
>>
>>
>>
>> - SCIP_DECL_CONSSEPALP
>>
>> - SCIP_DECL_CONSSEPASOL
>>
>> - SCIP_DECL_CONSENFOLP
>>
>> - SCIP_DECL_CONSENFOPS
>>
>> - SCIP_DECL_CONSCHECK
>>
>>
>>
>> ObjConshdlr(scip, "overdemand", "Feasibility cuts",
>>
>>              1000000, -2000000, -2000000, 1, -1, 1, 0,
>>
>>              FALSE, FALSE, TRUE, SCIP_PROPTIMING_BEFORELP,
>> SCIP_PRESOLTIMING_FAST)
>>
>>
>>
>>
>>
>> Thank you very much for your help,
>>
>> Juan
>>
>>
>>
>> [image: cid:image001.png at 01D4B3E6.540B6570]
>>
>> *Juan J. Lastra Díaz, PhD*
>>
>> *Advanced Research department*
>>
>>
>>
>> *t **:   *+34 917 88 88 65
>>
>> *e** :   *j.lastra at lectra.com
>>
>> [image: cid:image002.png at 01D4B3E6.540B6570]
>> <https://www.linkedin.com/company/8538/>[image:
>> cid:image003.png at 01D4B3E6.540B6570]
>> <https://www.facebook.com/LectraOfficial/>[image:
>> cid:image004.png at 01D4B3E6.540B6570]
>> <https://www.instagram.com/lectraofficial/>[image:
>> cid:image005.png at 01D4B3E6.540B6570]
>> <https://www.youtube.com/user/LectraTechChannel?hl=fr>[image:
>> cid:image006.png at 01D4B3E6.540B6570] <https://blog.lectra.com/>
>>
>> C/ Vía de los Poblados, 1 - Edif. C, 1ª Plta.
>>
>> P.E. Alvento - 28033 Madrid - España
>>
>> *lectra.com* <http://www.lectra.com/>
>>
>>
>>
>> This e-mail and any attached files may contain confidential information
>> which is intended exclusively for the recipient. If you are not the
>> specified recipient, you should delete this e-mail from your system
>> immediately, and inform the sender without delay. Reading, distributing,
>> copying, or any other unauthorized use of this e-mail and its attached
>> files is strictly forbidden. Thank you for your comprehension.
>>
>>
>>
>> Este correo electrónico y cualquier archivo adjunto pueden contener
>> información confidencial que está destinada exclusivamente al destinatario.
>> Si usted no es el destinatario especificado, debe eliminar este correo
>> electrónico de su sistema inmediatamente e informar al remitente sin
>> demora. Está terminantemente prohibido leer, distribuir, copiar o cualquier
>> otro uso no autorizado de este correo electrónico y sus archivos adjuntos.
>> Gracias por su comprensión.
>>
>>
>> _______________________________________________
>> Scip mailing list
>> Scip at zib.de
>> https://listserv.zib.de/mailman/listinfo/scip
>>
>
>
> --
> Mathieu Besançon
>


-- 
Mathieu Besançon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.zib.de/pipermail/scip/attachments/20230415/13015ce2/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 6491 bytes
Desc: not available
URL: <http://listserv.zib.de/pipermail/scip/attachments/20230415/13015ce2/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 2149 bytes
Desc: not available
URL: <http://listserv.zib.de/pipermail/scip/attachments/20230415/13015ce2/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.png
Type: image/png
Size: 2033 bytes
Desc: not available
URL: <http://listserv.zib.de/pipermail/scip/attachments/20230415/13015ce2/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.png
Type: image/png
Size: 2340 bytes
Desc: not available
URL: <http://listserv.zib.de/pipermail/scip/attachments/20230415/13015ce2/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image005.png
Type: image/png
Size: 2117 bytes
Desc: not available
URL: <http://listserv.zib.de/pipermail/scip/attachments/20230415/13015ce2/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image006.png
Type: image/png
Size: 2115 bytes
Desc: not available
URL: <http://listserv.zib.de/pipermail/scip/attachments/20230415/13015ce2/attachment-0005.png>


More information about the Scip mailing list