Example #1
0
File: heur.c Project: gorhan/LFOS
/** calls destructor and frees memory of primal heuristic */
SCIP_RETCODE SCIPheurFree(
   SCIP_HEUR**           heur,               /**< pointer to primal heuristic data structure */
   SCIP_SET*             set                 /**< global SCIP settings */
   )
{
   int d;
   assert(heur != NULL);
   assert(*heur != NULL);
   assert(!(*heur)->initialized);
   assert(set != NULL);
   assert((*heur)->divesets != NULL || (*heur)->ndivesets == 0);

   /* call destructor of primal heuristic */
   if( (*heur)->heurfree != NULL )
   {
      SCIP_CALL( (*heur)->heurfree(set->scip, *heur) );
   }

   for( d = 0; d < (*heur)->ndivesets; ++d )
   {
      assert((*heur)->divesets[d] != NULL);
      divesetFree(&((*heur)->divesets[d]));
   }
   BMSfreeMemoryArrayNull(&(*heur)->divesets);
   SCIPclockFree(&(*heur)->heurclock);
   SCIPclockFree(&(*heur)->setuptime);
   BMSfreeMemoryArray(&(*heur)->name);
   BMSfreeMemoryArray(&(*heur)->desc);
   BMSfreeMemory(heur);

   return SCIP_OKAY;
}
Example #2
0
/** frees memory of reader */
SCIP_RETCODE SCIPreaderFree(
   SCIP_READER**         reader,             /**< pointer to reader data structure */
   SCIP_SET*             set                 /**< global SCIP settings */
   )
{
   assert(reader != NULL);
   assert(*reader != NULL);
   assert(set != NULL);

   /* call destructor of reader */
   if( (*reader)->readerfree != NULL )
   {
      SCIP_CALL( (*reader)->readerfree(set->scip, *reader) );
   }

   /* free clock */
   SCIPclockFree(&(*reader)->readingtime);

   BMSfreeMemoryArray(&(*reader)->name);
   BMSfreeMemoryArray(&(*reader)->desc);
   BMSfreeMemoryArray(&(*reader)->extension);
   BMSfreeMemory(reader);

   return SCIP_OKAY;
}
Example #3
0
/** frees memory of presolver */
SCIP_RETCODE SCIPpresolFree(
   SCIP_PRESOL**         presol,             /**< pointer to presolver data structure */
   SCIP_SET*             set                 /**< global SCIP settings */
   )
{
   assert(presol != NULL);
   assert(*presol != NULL);
   assert(!(*presol)->initialized);
   assert(set != NULL);

   /* call destructor of presolver */
   if( (*presol)->presolfree != NULL )
   {
      SCIP_CALL( (*presol)->presolfree(set->scip, *presol) );
   }

   SCIPclockFree(&(*presol)->presolclock);
   SCIPclockFree(&(*presol)->setuptime);
   BMSfreeMemoryArray(&(*presol)->name);
   BMSfreeMemoryArray(&(*presol)->desc);
   BMSfreeMemory(presol);

   return SCIP_OKAY;
}
Example #4
0
/** calls destructor and frees memory of relaxation handler */
SCIP_RETCODE SCIPrelaxFree(
   SCIP_RELAX**          relax,              /**< pointer to relaxation handler data structure */
   SCIP_SET*             set                 /**< global SCIP settings */
   )
{
   assert(relax != NULL);
   assert(*relax != NULL);
   assert(!(*relax)->initialized);
   assert(set != NULL);

   /* call destructor of relaxation handler */
   if( (*relax)->relaxfree != NULL )
   {
      SCIP_CALL( (*relax)->relaxfree(set->scip, *relax) );
   }

   SCIPclockFree(&(*relax)->relaxclock);
   SCIPclockFree(&(*relax)->setuptime);
   BMSfreeMemoryArray(&(*relax)->name);
   BMSfreeMemoryArray(&(*relax)->desc);
   BMSfreeMemory(relax);

   return SCIP_OKAY;
}
Example #5
0
/** calls destructor and frees memory of separator */
SCIP_RETCODE SCIPsepaFree(
   SCIP_SEPA**           sepa,               /**< pointer to separator data structure */
   SCIP_SET*             set                 /**< global SCIP settings */
   )
{
   assert(sepa != NULL);
   assert(*sepa != NULL);
   assert(!(*sepa)->initialized);
   assert(set != NULL);

   /* call destructor of separator */
   if( (*sepa)->sepafree != NULL )
   {
      SCIP_CALL( (*sepa)->sepafree(set->scip, *sepa) );
   }

   SCIPclockFree(&(*sepa)->sepaclock);
   SCIPclockFree(&(*sepa)->setuptime);
   BMSfreeMemoryArray(&(*sepa)->name);
   BMSfreeMemoryArray(&(*sepa)->desc);
   BMSfreeMemory(sepa);

   return SCIP_OKAY;
}
Example #6
0
File: compr.c Project: gorhan/LFOS
/** calls destructor and frees memory of tree compression */
SCIP_RETCODE SCIPcomprFree(
   SCIP_COMPR**          compr,              /**< pointer to tree compression data structure */
   SCIP_SET*             set                 /**< global SCIP settings */
   )
{
   assert(compr != NULL);
   assert(*compr != NULL);
   assert(!(*compr)->initialized);
   assert(set != NULL);

   /* call destructor of tree compression */
   if( (*compr)->comprfree != NULL )
   {
      SCIP_CALL( (*compr)->comprfree(set->scip, *compr) );
   }

   SCIPclockFree(&(*compr)->comprclock);
   SCIPclockFree(&(*compr)->setuptime);
   BMSfreeMemoryArray(&(*compr)->name);
   BMSfreeMemoryArray(&(*compr)->desc);
   BMSfreeMemory(compr);

   return SCIP_OKAY;
}
Example #7
0
/** frees pricing storage */
SCIP_RETCODE SCIPpricestoreFree(
   SCIP_PRICESTORE**     pricestore          /**< pointer to store pricing storage */
   )
{
   assert(pricestore != NULL);
   assert(*pricestore != NULL);
   assert((*pricestore)->nvars == 0);
   assert((*pricestore)->nbdviolvars == 0);

   SCIPclockFree(&(*pricestore)->probpricingtime);
   BMSfreeMemoryArrayNull(&(*pricestore)->vars);
   BMSfreeMemoryArrayNull(&(*pricestore)->scores);
   BMSfreeMemoryArrayNull(&(*pricestore)->bdviolvars);
   BMSfreeMemoryArrayNull(&(*pricestore)->bdviolvarslb);
   BMSfreeMemoryArrayNull(&(*pricestore)->bdviolvarsub);
   BMSfreeMemory(pricestore);

   return SCIP_OKAY;
}
Example #8
0
/** calls destructor and frees memory of variable pricer */
SCIP_RETCODE SCIPpricerFree(
   SCIP_PRICER**         pricer,             /**< pointer to variable pricer data structure */
   SCIP_SET*             set                 /**< global SCIP settings */
   )
{
   assert(pricer != NULL);
   assert(*pricer != NULL);
   assert(!(*pricer)->initialized);
   assert(set != NULL);

   /* call destructor of variable pricer */
   if( (*pricer)->pricerfree != NULL )
   {
      SCIP_CALL( (*pricer)->pricerfree(set->scip, *pricer) );
   }

   SCIPclockFree(&(*pricer)->pricerclock);
   BMSfreeMemoryArray(&(*pricer)->name);
   BMSfreeMemoryArray(&(*pricer)->desc);
   BMSfreeMemory(pricer);

   return SCIP_OKAY;
}
Example #9
0
/** reads problem data from file with given reader or returns SCIP_DIDNOTRUN */
SCIP_RETCODE SCIPreaderRead(
   SCIP_READER*          reader,             /**< reader */
   SCIP_SET*             set,                /**< global SCIP settings */
   const char*           filename,           /**< name of the input file */
   const char*           extension,          /**< extension of the input file name */
   SCIP_RESULT*          result              /**< pointer to store the result of the callback method */
   )
{
   SCIP_RETCODE retcode;

   assert(reader != NULL);
   assert(set != NULL);
   assert(filename != NULL);
   assert(result != NULL);

   /* check, if reader is applicable on the given file */
   if( readerIsApplicable(reader, extension) && reader->readerread != NULL )
   {
      SCIP_CLOCK* readingtime;

      /**@note we need temporary clock to measure the reading time correctly since in case of creating a new problem
       *       within the reader all clocks are reset (including the reader clocks); this resetting is necessary for
       *       example for those case we people solve several problems using the (same) interactive shell
       */

      assert(!SCIPclockIsRunning(reader->readingtime));

      /* create a temporary clock for measuring the reading time */
      SCIP_CALL( SCIPclockCreate(&readingtime, SCIP_CLOCKTYPE_DEFAULT) );

      /* start timing */
      SCIPclockStart(readingtime, set);

      /* call reader to read problem */
      retcode = reader->readerread(set->scip, reader, filename, result);

      /* stop timing */
      SCIPclockStop(readingtime, set);

      /* add time to reader reading clock */
      SCIPclockSetTime(reader->readingtime, SCIPclockGetTime(reader->readingtime) + SCIPclockGetTime(readingtime));

      /* free the temporary clock */
      SCIPclockFree(&readingtime);
   }
   else
   {
      *result = SCIP_DIDNOTRUN;
      retcode = SCIP_OKAY;
   }

   /* check for reader errors */
   if( retcode == SCIP_NOFILE || retcode == SCIP_READERROR )
      return retcode;

   /* check if the result code is valid in case no reader error occurred */
   assert( *result == SCIP_DIDNOTRUN || *result == SCIP_SUCCESS );

   SCIP_CALL( retcode );

   return SCIP_OKAY;
}
Example #10
0
File: stat.c Project: hhexiy/scip
/** frees problem statistics data */
SCIP_RETCODE SCIPstatFree(
   SCIP_STAT**           stat,               /**< pointer to problem statistics data */
   BMS_BLKMEM*           blkmem              /**< block memory */
   )
{
   assert(stat != NULL);
   assert(*stat != NULL);

   SCIPclockFree(&(*stat)->solvingtime);
   SCIPclockFree(&(*stat)->presolvingtime);
   SCIPclockFree(&(*stat)->primallptime);
   SCIPclockFree(&(*stat)->duallptime);
   SCIPclockFree(&(*stat)->lexduallptime);
   SCIPclockFree(&(*stat)->barrierlptime);
   SCIPclockFree(&(*stat)->divinglptime);
   SCIPclockFree(&(*stat)->strongbranchtime);
   SCIPclockFree(&(*stat)->conflictlptime);
   SCIPclockFree(&(*stat)->lpsoltime);
   SCIPclockFree(&(*stat)->pseudosoltime);
   SCIPclockFree(&(*stat)->sbsoltime);
   SCIPclockFree(&(*stat)->nodeactivationtime);
   SCIPclockFree(&(*stat)->nlpsoltime);
   SCIPclockFree(&(*stat)->copyclock);
   SCIPclockFree(&(*stat)->strongpropclock);

   SCIPhistoryFree(&(*stat)->glbhistory, blkmem);
   SCIPhistoryFree(&(*stat)->glbhistorycrun, blkmem);
   SCIPvbcFree(&(*stat)->vbc);

   BMSfreeMemory(stat);

   return SCIP_OKAY;
}