[SCIP] Number of heuristic's calls

André Filipe Lanca Serrano andre.serrano at tuhh.de
Fri May 11 15:59:37 CEST 2018


Hi Gregor,

Thanks for the tips.

> Most likely, SCIP decides to restart the solution process, such that  
> effectively not only 1, but 2 root nodes are evaluated. -> Exactly!

I already verified the logs and SCIP is actually restarted.

I included a statement into the end of heurExec callback to return  
immediately if SCIPheurGetNCalls(heur) > 0 like this:

      /** execution method of primal heuristic */
      static
      SCIP_DECL_HEUREXEC(heurExecAtfmGA)
      {  /*lint --e{715}*/

         ...

         /* only call heuristic once at the root */
	if (SCIPgetDepth(scip) <= 0 && SCIPheurGetNCalls(heur) > 0)
	{
		return SCIP_OKAY;
	}
	return SCIP_OKAY;
      }

It still runs my heuristic twice at the root node... What am I doing  
wrong here?


Quoting Gregor Hendel <hendel at zib.de>:

> Hi Andre,
>
> the properties look good for the purpose you describe, although I  
> would suggest to use the letter 'M' to indicate a heuristic of that  
> name :)
>
> Most likely, SCIP decides to restart the solution process, such that  
> effectively not only 1, but 2 root nodes are evaluated. Can you  
> verify whether SCIP actually restarted from some log file output?
>
> If you really want to run only once, you have to include a statement  
> into the heurExec callback to return immediately if  
> SCIPheurGetNCalls(heur) > 0.
>
> Hope this helps,
> Gregor
>
> Am 09.05.2018 um 16:33 schrieb André Filipe Lanca Serrano:
>> Hi to all,
>>
>> I created an heuristic and I would like to call it just once, in  
>> the root node, as the first heuristic. I'm using the following  
>> properties in my heuristic.
>>
>> #define HEUR_NAME             "myheuristic"
>> #define HEUR_DESC             "My heuristic"
>> #define HEUR_DISPCHAR         'g'
>> #define HEUR_PRIORITY         99999999
>> #define HEUR_FREQ             0
>> #define HEUR_FREQOFS          0
>> #define HEUR_MAXDEPTH         -1
>> #define HEUR_TIMING           SCIP_HEURTIMING_BEFORENODE
>> #define HEUR_USESSUBSCIP      FALSE
>>
>> After running my project I get two calls from my heuristic using  
>> the method SCIPheurGetNCalls(heur). What am I doing wrong here? Am  
>> I missing smth? I followed all the instructions on how to add  
>> primal heuristics and I guess it's smth to do with the properties...
>>
>> Thank you in advance.
>>
>> Kind regards,
>> André Serrano
>>
>> _______________________________________________
>> Scip mailing list
>> Scip at zib.de
>> https://listserv.zib.de/mailman/listinfo/scip
>
> _______________________________________________
> Scip mailing list
> Scip at zib.de
> https://listserv.zib.de/mailman/listinfo/scip





More information about the Scip mailing list