[SCIP] Help with Constraint Handler

Marc Pfetsch pfetsch at mathematik.tu-darmstadt.de
Sat Jan 20 17:19:31 CET 2024


Hi Enrico,

as you correctly determined, you need to implement this function. This 
is not because of correctness, but because SCIP needs the functionality. 
In this function you need to create a transformed constraint (if the 
constraint handler has any). Almost every constraint handler depends on 
variables that should be updated to the transformed variables. But if 
you are sure that you do not need to update anything you can just create 
the target constraint and return it in targetcons.

Best

Marc


On 19/01/2024 13:18, Enrico Calandrini wrote:
> Hi everyone,
> 
> first of all thanks a lot for your works!
> 
> Now, I write to you because I'm trying to create a new constraint 
> handler in my project. I have read the online documentation about this 
> argument and implemented all the fundamentals callback. Even if the 
> handler is not quite finished, I wanted to check the formal correctness 
> of my work so far trying to include it in the project. However, when I 
> try to compute the code, I get the following error:
> 
> //home/something.cpp:342:71: error: invalid new-expression of abstract 
> class type ‘dummy_Conhdlr’/
> /  342 |    auto conhdlr = new dummy_Conhdlr( scip , this , CutSepPar );/
> /      | /
> /In file included from /home///something.//cpp:36:/
> //home///something//.h:52:7: note:   because the following virtual 
> functions are pure within ‘//dummy_Conhdlr//’:/
> /   52 | class dummy_Conhdlr : public scip::ObjConshdlr/
> /      |       ^~~~~~~~~~~~~~~~~~~~~~/
> /In file included from /usr/local/include/scip/scip.h:63,/
> /                 from ///home/something//.h:39,/
> /                 from ///home/something//.cpp:34:/
> //usr/local/include/objscip/objconshdlr.h:268:12: note:     ‘virtual 
> SCIP_RETCODE scip::ObjConshdlr::scip_trans(SCIP*, SCIP_CONSHDLR*, 
> SCIP_CONS*, SCIP_CONS**)’/
> /  268 |    virtual SCIP_DECL_CONSTRANS(scip_trans) = 0;/
> /
> /
> If I understand correctly the error, it is saying that I need to 
> implement the /scip_trans/ function, but I don't understand why. I have 
> some constraint data in my handler, but I don't want to change them 
> during the execution, so according to the documentation I should not 
> need to implement it.
> 
> Thank you very much in advance for your help!
> 
> Best regards,
> 
> Enrico
> 
> _______________________________________________
> Scip mailing list
> Scip at zib.de
> https://listserv.zib.de/mailman/listinfo/scip


More information about the Scip mailing list