All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
nodesel_uct.c
Go to the documentation of this file.
17 * @brief uct node selector which balances exploration and exploitation by considering node visits
20 * the UCT node selection rule selects the next leaf according to a mixed score of the node's actual lower bound
27 * The authors adapted a game-tree exploration scheme called UCB to MIP trees. Starting from the root node as current node,
30 * \f$ \mbox{score}(N_i) := -\mbox{estimate}_{N_i} + \mbox{weight} \cdot \frac{\mbox{visits}(\mbox{parent}(N_i))}{\mbox{visits}(N_i)}
33 * where \f$\mbox{estimate}\f$ is the node's lower bound normalized by the root lower bound, and \f$\mbox{visits}\f$
34 * denotes the number of times a leaf in the subtree rooted at this node has been explored so far.
36 * The selected node in the sense of the SCIP node selection is the leaf reached by the above criterion.
38 * The authors suggest that this node selection rule is particularly useful at the beginning of the solving process, but
39 * to switch to a different node selection after a number of nodes has been explored to reduce computational overhead.
40 * Our implementation uses only information available from the original SCIP tree which does not support the
41 * forward path mechanism needed for the most efficient node selection. Instead, the algorithm selects the next leaf
42 * by looping over all leaves and comparing the best leaf found so far with the next one. Two leaves l_1, l_2 are compared
43 * by following their paths back upwards until their deepest common ancestor \f$a\f$ is reached, together with the two
44 * children of \f$a\f$ representing the two paths to l_1, l_2. The leaf represented by the child of \f$a\f$
50 * the weight parameter changes the relevance of the visits quotient in the UCT score (see above score formula)
53 * @note It should be avoided to switch to uct node selection after the branch and bound process has begun because
54 * the central UCT score information how often a path was taken is not collected if UCT is inactive. A safe use of
58 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
71 #define DEFAULT_NODELIMIT 31 /**< limit of node selections after which UCT node selection is turned off */
72 #define DEFAULT_USEESTIMATE FALSE /**< should the estimate (TRUE) or the lower bound of a node be used for UCT score? */
73 #define INITIALSIZE 1024 /**< initial size of node visits array (increased dynamically if required) */
88 SCIP_Bool useestimate; /**< should the estimate (TRUE) or the lower bound of a node be used for UCT score? */
132 /* increase visits counter of all nodes along the path until root node is reached (which has NULL as parent) */
147 /** switches to a different node selection rule by assigning the lowest priority of all node selectors to uct */
172 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL, "Reached node limit of UCT node selection rule -> switching to default\n");
178 /** returns UCT score of @p node; the UCT score is a mixture of the node's lower bound or estimate and the number of times
179 * it has been visited so far in relation with the number of times its parent has been visited so far
195 /* the objective part of the UCT score uses the (negative) gap between node estimate and root lower bound */
198 /* if the root lower bound is infinite due to LP errors, we ignore the gap part of the UCT score */
232 /** compares two leaf nodes by comparing the UCT scores of the two children of their deepest common ancestor */
246 /* go back in the tree to find the two shallowest ancestors of node1 and node2 which share the same parent */
249 /* if the nodes have the same depth but not the same parent both pointers can be updated, otherwise only the deeper
314 /** keeps visits array large enough to save visits for all nodes in the branch and bound tree */
326 SCIP_CALL( SCIPallocClearMemoryArray(scip, &nodeseldata->nodevisits, INITIALSIZE) ); /*lint !e506*/
333 if( nodeseldata->sizenodevisits < 2 * nodeseldata->nodelimit && nodeseldata->sizenodevisits < (int)(2 * SCIPgetNNodes(scip)))
338 SCIPdebugMessage("Resizing node visits array, old capacity: %d new capacity : %d\n", nodeseldata->sizenodevisits, newcapacity);
342 BMSclearMemoryArray(&(nodeseldata->nodevisits[nodeseldata->sizenodevisits]), newcapacity - nodeseldata->sizenodevisits); /*lint !e866*/
364 /** solving process initialization method of node selector (called when branch and bound process is about to begin) */
382 /** solving process deinitialization method of node selector (called when branch and bound process data gets freed) */
458 SCIP_CALL( SCIPgetOpenNodesData(scip, &leaves, &children, &siblings, &nleaves, &nchildren, &nsiblings) );
484 SCIPdebugMessage("updating node visits from node number %"SCIP_LONGINT_FORMAT"\n", SCIPnodeGetNumber(*selnode));
530 /* use SCIPincludeNodeselBasic() plus setter functions if you want to set callbacks one-by-one and your code should
533 SCIP_CALL( SCIPincludeNodeselBasic(scip, &nodesel, NODESEL_NAME, NODESEL_DESC, NODESEL_STDPRIORITY,
|