Пример #1
0
/** solving process initialization method of primal heuristic (called when branch and bound process is about to begin)
 *
 *  This method is called when the presolving was finished and the branch and bound process is about to begin.
 *  The primal heuristic may use this call to initialize its branch and bound specific data.
 *
 */
SCIP_RETCODE Heur2opt::scip_initsol(
   SCIP*              scip,               /**< SCIP data structure */
   SCIP_HEUR*         heur                /**< the primal heuristic itself */
   )
{
   ProbDataTSP* probdata = dynamic_cast<ProbDataTSP*>(SCIPgetObjProbData(scip));
   graph_ = probdata->getGraph();
   capture_graph(graph_);

   ncalls_ = 0;
   sol_ = NULL;
   SCIP_CALL( SCIPallocMemoryArray(scip, &tour_, graph_->nnodes) );
   
   return SCIP_OKAY;
}
Пример #2
0
/** initialization method of primal heuristic (called after problem was transformed) */
SCIP_RETCODE HeurFrats::scip_init(
   SCIP*              scip,               /**< SCIP data structure */
   SCIP_HEUR*         heur                /**< the primal heuristic itself */
   )
{
   ProbDataTSP*   probdata;  

   /* create heuristic data */
   SCIP_CALL( SCIPcreateSol(scip, &sol, heur) );
   
   /* load the problem specific data */
   probdata = dynamic_cast<ProbDataTSP*>(SCIPgetObjProbData(scip));
   assert(probdata != NULL);

   graph = probdata->getGraph();
   assert(graph != NULL);

   capture_graph(graph);

   return SCIP_OKAY;
}