[Scip] New Solution Callback
Jakob Breier
Jakob.Breier at rwth-aachen.de
Fri Jul 16 22:28:19 MEST 2010
Hi,
I am a student from the RWTH Aachen and I am working on a project using
scip. I am working with the C++ Interface and I want to write out the
currently best solutions every time a new solution is found, because the
process crashes quite often (out of memory, system reboot, etc.). I
believe the SOLFOUND event is the proper event to use (?). Unfortunately
the following code does not work:
=============SolFoundEventHandler.h=============
#include "scip/scip.h"
#include "objscip/objeventhdlr.h"
class SolFoundEventHandler : public scip::ObjEventhdlr
{
private:
public:
SolFoundEventHandler();
virtual SCIP_RETCODE scip_exec(
SCIP* scip,
SCIP_EVENTHDLR* eventhdlr,
SCIP_EVENT* event,
SCIP_EVENTDATA* eventdata
) ;
};
============SolFoundEventHandler.cpp============
#include "SolFoundEventHandler.h"
SolFoundEventHandler::SolFoundEventHandler() :
ObjEventhdlr("SOLFOUND","desc")
// As far as I understand the interface the above line should tell
// scip that I want to catch the SOLFOUND event.
{
}
SCIP_RETCODE SolFoundEventHandler::scip_exec(
SCIP* scip,
SCIP_EVENTHDLR* eventhdlr,
SCIP_EVENT* event,
SCIP_EVENTDATA* eventdata
)
{
SCIPerrorMessage("This message will never be printed.");
SCIPABORT();
return SCIP_OKAY;
}
Also "SCIP_CALL_ABORT(SCIPincludeObjEventhdlr(scip_,
&solFoundEventHandler, false));" is called before the solving begins
(solFoundEventHandler is of course an object of type
SolFoundEventHandler). Yet SCIP_RETCODE SolFoundEventHandler::scip_exec
is never called.
Do you know what I do wrong?
Regards,
Jakob Breier
More information about the Scip
mailing list