<div dir="ltr">Dear Mathieu,<div><br></div><div>Thank you so much. Please, let me check and reach out to you if I have any questions.</div><div><br></div><div>Best regards</div><div>Abbas</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Aug 5, 2023 at 6:32 PM Mathieu Besançon <<a href="mailto:mathieu.besancon@gmail.com">mathieu.besancon@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>1. The assert is specific to the test and should not be used as a template for a constraint handler.</div><div>If your check returns SCIP_FEASIBLE, the constraint handler has no reason to enforce the constraint on the LP solution (aka to call consenflp), because there is nothing to do to make the constraint feasible.</div><div><br></div><div>2. The priorities should be explained on the constraint handler page: <a href="https://www.scipopt.org/doc/html/CONS.php" target="_blank">https://www.scipopt.org/doc/html/CONS.php</a></div><div><br></div><div>for 3, maybe check a realistic constraint handler, such as PySCIPOpt/examples/finished/lotsizing_lazy.py</div><div><br></div><div><br></div><div>Hope this helps,</div><div>Mathieu<br></div><div><br></div><div><br></div><div><br></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Aug 4, 2023 at 8:27 PM Abbas Omidi <<a href="mailto:abb.omidi@gmail.com" target="_blank">abb.omidi@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Dear Mathieu,<div><br></div><div>Thank you so much for your informative comments. Now, it makes sense to the <b style="color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji""><i>price-and-cut loop<span style="font-size:14px"> </span></i></b>and also, what is the difference between <span style="background-color:transparent;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;color:rgb(31,35,40)"><b><i>consenfolp/</i></b></span><span style="background-color:transparent;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;color:rgb(31,35,40)"><b><i>consenfops<span style="font-size:11.9px">.</span></i></b></span></div><div><span style="background-color:transparent;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;color:rgb(31,35,40)"><b><i><span style="font-size:11.9px"><br></span></i></b></span></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Is the solution feasible for your constraint? If yes, you can just use SCIP_FEASIBLE as a result.</blockquote><div><br></div><div>Let me explain more on what I am trying to do. I have tried using a simple example and already mentioned the template <a href="https://github.com/scipopt/PySCIPOpt/blob/master/tests/test_conshdlr.py" target="_blank">here</a> to investigate how <b><i>conshdlr</i></b> works and how behaves again adding the custom constraints. The problem I am using has an optimal solution and also I defined SCIP_FEASIBLE as a result in both <b><i>conscheck </i></b>and <b><i>consenflp</i></b>. After declaring the optimization model, I added <b><i>writeProblem</i></b> method to see what exactly is added to the model. Then I called the following method to include <b><i>conshdlr</i></b> :</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">conshdlr = MyConshdlr(shouldtrans=True, shouldcopy=False)<br>s.includeConshdlr(conshdlr, "PyCons", "custom constraint handler implemented in python",<br>                                       sepapriority= 1, enfopriority= 1, chckpriority= 1<br>                             )</blockquote><div><br></div><div>Then I created and added three custom constraint handlers still based on the original problem constraints by using:</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">cons1 = s.createCons(conshdlr, "cons1name")<br>ids.append(id(cons1))</blockquote><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>conshdlr.createData(cons1, 10, "cons1_anothername")</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>s.addPyCons(cons1)</blockquote></div><div><br></div><div>By running the code, it shows the assertion errors on <span style="color:rgb(0,0,0);background-color:rgb(255,255,0);font-family:monospace;font-size:14px;white-space:pre-wrap">--> 143</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,0);font-family:monospace;font-size:14px;white-space:pre-wrap">   </span><span style="color:rgb(0,0,0);background-color:rgb(255,255,0);font-family:monospace;font-size:14px;white-space:pre-wrap">assert</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,0);font-family:monospace;font-size:14px;white-space:pre-wrap"> </span><span style="color:rgb(0,0,0);background-color:rgb(255,255,0);font-family:monospace;font-size:14px;white-space:pre-wrap">"consenfolp"</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,0);font-family:monospace;font-size:14px;white-space:pre-wrap"> </span><span style="color:rgb(0,0,0);background-color:rgb(255,255,0);font-family:monospace;font-size:14px;white-space:pre-wrap">in</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,0);font-family:monospace;font-size:14px;white-space:pre-wrap"> </span><span style="color:rgb(0,0,0);background-color:rgb(255,255,0);font-family:monospace;font-size:14px;white-space:pre-wrap">calls.</span></div><div>Also, the write method shows the following rows added, but it cannot convert that into a readable format:</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">constraint handler <PyCons> cannot print requested format<br>\   [PyCons] <cons1name>: ;<br>constraint handler <PyCons> cannot print requested format<br>\   [PyCons] <cons2name>: ;<br>constraint handler <PyCons> cannot print requested format<br>\   [PyCons] <cons3name>: ;</blockquote><div><br></div><div><br></div><div>My questions are:</div><div>1)  Why do I have an assertion error on <b style="font-style:italic">consenflp </b>while the problem has an optimal solution?<br></div><div>2) How can I find the priority numbers and their definitions of <b><i>sepapriority</i></b>, <b><i>enfopriority</i></b>, and <b><i>chckpriority</i></b>? (I cannot find related documents)</div><div>3) I am not sure why I need to redefine the constraints by createCons, createData, and addPyCons respectively. I just tried to use the template format, and this is why I asked about adding data. If I am doing wrong pleaes, correct me? </div><div><br></div><div><br></div><div>All the best </div><div>Regards</div><div>Abbas</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Aug 3, 2023 at 7:33 PM Mathieu Besançon <<a href="mailto:mathieu.besancon@gmail.com" target="_blank">mathieu.besancon@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Dear Abbas,</div><div><br></div><div>1. The price-and-cut-loop happens before the constraint handler is called, this corresponds to the step where the LP relaxation has been solved, and the rounds of cuts (from separator plugins) have already happened.</div><div><br></div><div>2. consenfoXYZ acts on a primal solution by adding a constraint, cut, or something else. In contrast, the check function only computes whether a violation of the constraint represented by the constraint handler is present at the current solution, and returns whether the solution is feasible or infeasible.<br></div><div><a href="https://www.scipopt.org/doc/html/CONS.php" target="_blank">https://www.scipopt.org/doc/html/CONS.php</a></div><div><br></div><div>2 bis. I am not sure to understand what you mean by this one. Is the solution feasible for your constraint? If yes, you can just use SCIP_FEASIBLE as a result. If this solution is not feasible, then you can do one of the actions detailed in the documentation page linked above. If the only possible thing is determining the current solution as infeasible, then the ENFO constraint can use a result SCIP_INFEASIBLE.</div><div><br></div><div>3. I don't think create data is necessary for a constraint handler but not sure on this one.</div><div><br></div><div>Best,<br></div><div>Mathieu<br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jul 29, 2023 at 9:05 AM Abbas Omidi <<a href="mailto:abb.omidi@gmail.com" target="_blank">abb.omidi@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Dear support team,<br><div><br></div><div><div><span style="color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">I am working on the problem, and I am willing to use SCIP's</span><code style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:11.9px;padding:0.2em 0.4em;margin:0px;border-radius:6px;color:rgb(31,35,40)"><i><b>onshdlr</b></i></code><span style="color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">callback, </span><span style="color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">preferably PySCIPopt,</span><span style="color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px"> to check how the constraints might be added to the model. The problem I have is a simple linear program, MILP, that </span>is solved<span style="color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px"> optimality. I sum up my questions as follows and am wondering if, you can advise me.</span></div><div><span style="color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px"><br></span></div><div><span style="color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">1) As the definition of </span><i><b><span style="background-color:transparent;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;color:rgb(31,35,40);font-size:11.9px">consenfolp/</span><span style="background-color:transparent;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;color:rgb(31,35,40);font-size:11.9px">consenfops</span><span style="background-color:transparent"> </span></b></i><span style="color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">is very specific and contains the term <b><i>price-and-cut loop</i></b>, What does the price-and-cut loop mean?</span></div><div><span style="color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px"><br></span></div><div><span style="color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">2) W</span><span style="color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">hat is the difference between </span><i><b><span style="background-color:transparent;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;color:rgb(31,35,40);font-size:11.9px">consenfolp/</span><span style="background-color:transparent;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;color:rgb(31,35,40);font-size:11.9px">consenfops</span><span style="background-color:transparent"> </span></b></i><span style="color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">and </span><span style="background-color:transparent;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;color:rgb(31,35,40);font-size:11.9px"><i><b>conscheck</b></i></span><span style="font-size:14px;color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji""> </span><span style="color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">when applied to the model?</span></div><div><span style="color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">  </span></div><div><span style="color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">2) </span><span style="color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">As my problem has a primal feasible solution, actually optimal one, and already other callbacks seem to work fine, how is it possible to reject the constraints/solution by </span><i><b><span style="background-color:transparent;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;color:rgb(31,35,40);font-size:11.9px">consenfolp/</span><span style="background-color:transparent">consenfops</span></b></i>?</div><div><span style="color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px"><br></span></div><div><span style="color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">3) Is it still necessary to use</span> <b><i>conshdlr.createData</i></b><span style="color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px"> when we want to add the constraint?</span></div><div><span style="color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px"><br></span></div><div><br></div><div><span style="color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">(The <a href="http://listserv.zib.de/pipermail/scip/2023-July/004687.html" target="_blank">link</a> to my previous post)</span></div><div><span style="color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">Best regards</span></div><div><span style="color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">Abbas</span></div></div></div>
_______________________________________________<br>
Scip mailing list<br>
<a href="mailto:Scip@zib.de" target="_blank">Scip@zib.de</a><br>
<a href="https://listserv.zib.de/mailman/listinfo/scip" rel="noreferrer" target="_blank">https://listserv.zib.de/mailman/listinfo/scip</a><br>
</blockquote></div><br clear="all"><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr">Mathieu Besançon</div></div>
</blockquote></div>
</blockquote></div><br clear="all"><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr">Mathieu Besançon</div></div>
</blockquote></div>