Exemple #1
0
/** destructor of constraint handler to free constraint handler data (called when SCIP is exiting) */
static
SCIP_DECL_CONSFREE(consFreeStp)
{  /*lint --e{715}*/
   SCIP_CONSHDLRDATA* conshdlrdata;

   assert(scip != NULL);
   assert(conshdlr != NULL);
   assert(strcmp(SCIPconshdlrGetName(conshdlr), CONSHDLR_NAME) == 0);

   /* free constraint handler data */
   conshdlrdata = SCIPconshdlrGetData(conshdlr);
   assert(conshdlrdata != NULL);

   SCIPfreeMemory(scip, &conshdlrdata);

   SCIPconshdlrSetData(conshdlr, NULL);

   return SCIP_OKAY;
}
/** destructor of constraint handler to free user data (called when SCIP is exiting) */
static
SCIP_DECL_CONSFREE(consFreeObj)
{  /*lint --e{715}*/
   SCIP_CONSHDLRDATA* conshdlrdata;

   conshdlrdata = SCIPconshdlrGetData(conshdlr);
   assert(conshdlrdata != NULL);
   assert(conshdlrdata->objconshdlr != NULL);
   assert(conshdlrdata->objconshdlr->scip_ == scip);

   /* call virtual method of conshdlr object */
   SCIP_CALL( conshdlrdata->objconshdlr->scip_free(scip, conshdlr) );

   /* free conshdlr object */
   if( conshdlrdata->deleteobject )
      delete conshdlrdata->objconshdlr;

   /* free conshdlr data */
   delete conshdlrdata;
   SCIPconshdlrSetData(conshdlr, NULL); /*lint !e64*/

   return SCIP_OKAY;
}