Scippy

    SCIP

    Solving Constraint Integer Programs

    nodesel.h
    Go to the documentation of this file.
    1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    2/* */
    3/* This file is part of the program and library */
    4/* SCIP --- Solving Constraint Integer Programs */
    5/* */
    6/* Copyright (c) 2002-2025 Zuse Institute Berlin (ZIB) */
    7/* */
    8/* Licensed under the Apache License, Version 2.0 (the "License"); */
    9/* you may not use this file except in compliance with the License. */
    10/* You may obtain a copy of the License at */
    11/* */
    12/* http://www.apache.org/licenses/LICENSE-2.0 */
    13/* */
    14/* Unless required by applicable law or agreed to in writing, software */
    15/* distributed under the License is distributed on an "AS IS" BASIS, */
    16/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
    17/* See the License for the specific language governing permissions and */
    18/* limitations under the License. */
    19/* */
    20/* You should have received a copy of the Apache-2.0 license */
    21/* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
    22/* */
    23/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    24
    25/**@file nodesel.h
    26 * @ingroup INTERNALAPI
    27 * @brief internal methods for node selectors and node priority queues
    28 * @author Tobias Achterberg
    29 */
    30
    31/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
    32
    33#ifndef __SCIP_NODESEL_H__
    34#define __SCIP_NODESEL_H__
    35
    36
    37#include "scip/def.h"
    39#include "scip/type_event.h"
    40#include "scip/type_retcode.h"
    41#include "scip/type_set.h"
    42#include "scip/type_stat.h"
    43#include "scip/type_lp.h"
    44#include "scip/type_tree.h"
    45#include "scip/type_reopt.h"
    46#include "scip/type_message.h"
    47#include "scip/pub_nodesel.h"
    48#include "scip/type_rational.h"
    49
    50#ifdef __cplusplus
    51extern "C" {
    52#endif
    53
    54/*
    55 * node priority queue methods
    56 */
    57
    58/** creates node priority queue */
    60 SCIP_NODEPQ** nodepq, /**< pointer to a node priority queue */
    61 SCIP_SET* set, /**< global SCIP settings */
    62 SCIP_NODESEL* nodesel /**< node selector to use for sorting the nodes in the queue */
    63 );
    64
    65/** frees node priority queue, but not the data nodes themselves */
    67 SCIP_NODEPQ** nodepq /**< pointer to a node priority queue */
    68 );
    69
    70/** frees node priority queue and all nodes in the queue */
    72 SCIP_NODEPQ** nodepq, /**< pointer to a node priority queue */
    73 BMS_BLKMEM* blkmem, /**< block memory buffers */
    74 SCIP_SET* set, /**< global SCIP settings */
    75 SCIP_STAT* stat, /**< problem statistics */
    76 SCIP_EVENTQUEUE* eventqueue, /**< event queue */
    77 SCIP_EVENTFILTER* eventfilter, /**< global event filter */
    78 SCIP_TREE* tree, /**< branch and bound tree */
    79 SCIP_LP* lp /**< current LP data */
    80 );
    81
    82/** deletes all nodes in the node priority queue */
    84 SCIP_NODEPQ* nodepq, /**< node priority queue */
    85 BMS_BLKMEM* blkmem, /**< block memory buffers */
    86 SCIP_SET* set, /**< global SCIP settings */
    87 SCIP_STAT* stat, /**< problem statistics */
    88 SCIP_EVENTQUEUE* eventqueue, /**< event queue */
    89 SCIP_EVENTFILTER* eventfilter, /**< global event filter */
    90 SCIP_TREE* tree, /**< branch and bound tree */
    91 SCIP_LP* lp /**< current LP data */
    92 );
    93
    94/** returns the node selector associated with the given node priority queue */
    96 SCIP_NODEPQ* nodepq /**< node priority queue */
    97 );
    98
    99/** sets the node selector used for sorting the nodes in the queue, and resorts the queue if necessary */
    101 SCIP_NODEPQ** nodepq, /**< pointer to a node priority queue */
    102 SCIP_SET* set, /**< global SCIP settings */
    103 SCIP_NODESEL* nodesel /**< node selector to use for sorting the nodes in the queue */
    104 );
    105
    106/** compares two nodes; returns -1/0/+1 if node1 better/equal/worse than node2 */
    108 SCIP_NODEPQ* nodepq, /**< node priority queue */
    109 SCIP_SET* set, /**< global SCIP settings */
    110 SCIP_NODE* node1, /**< first node to compare */
    111 SCIP_NODE* node2 /**< second node to compare */
    112 );
    113
    114/** inserts node into node priority queue */
    116 SCIP_NODEPQ* nodepq, /**< node priority queue */
    117 SCIP_SET* set, /**< global SCIP settings */
    118 SCIP_NODE* node /**< node to be inserted */
    119 );
    120
    121/** removes node from the node priority queue */
    123 SCIP_NODEPQ* nodepq, /**< node priority queue */
    124 SCIP_SET* set, /**< global SCIP settings */
    125 SCIP_NODE* node /**< node to remove */
    126 );
    127
    128/** returns the best node of the queue without removing it */
    130 const SCIP_NODEPQ* nodepq /**< node priority queue */
    131 );
    132
    133/** returns the nodes array of the queue */
    135 const SCIP_NODEPQ* nodepq /**< node priority queue */
    136 );
    137
    138/** returns the number of nodes stored in the node priority queue */
    139int SCIPnodepqLen(
    140 const SCIP_NODEPQ* nodepq /**< node priority queue */
    141 );
    142
    143/** gets the minimal lower bound of all nodes in the queue */
    145 SCIP_NODEPQ* nodepq, /**< node priority queue */
    146 SCIP_SET* set /**< global SCIP settings */
    147 );
    148
    149/** gets the minimal exact lower bound of all nodes in the queue or NULL if empty */
    151 SCIP_NODEPQ* nodepq, /**< node priority queue */
    152 SCIP_SET* set /**< global SCIP settings */
    153 );
    154
    155/** gets the node with minimal lower bound of all nodes in the queue */
    157 SCIP_NODEPQ* nodepq, /**< node priority queue */
    158 SCIP_SET* set /**< global SCIP settings */
    159 );
    160
    161/** gets the sum of lower bounds of all nodes in the queue */
    163 SCIP_NODEPQ* nodepq /**< node priority queue */
    164 );
    165
    166/** free all nodes from the queue that are cut off by the given upper bound */
    168 SCIP_NODEPQ* nodepq, /**< node priority queue */
    169 BMS_BLKMEM* blkmem, /**< block memory buffer */
    170 SCIP_SET* set, /**< global SCIP settings */
    171 SCIP_STAT* stat, /**< dynamic problem statistics */
    172 SCIP_EVENTQUEUE* eventqueue, /**< event queue */
    173 SCIP_EVENTFILTER* eventfilter, /**< global event filter */
    174 SCIP_TREE* tree, /**< branch and bound tree */
    175 SCIP_REOPT* reopt, /**< reoptimization data structure */
    176 SCIP_LP* lp, /**< current LP data */
    177 SCIP_Real cutoffbound /**< cutoff bound: all nodes with lowerbound >= cutoffbound are cut off */
    178 );
    179
    180
    181
    182
    183/*
    184 * node selector methods
    185 */
    186
    187/** copies the given node selector to a new scip */
    189 SCIP_NODESEL* nodesel, /**< node selector */
    190 SCIP_SET* set /**< SCIP_SET of SCIP to copy to */
    191 );
    192
    193/** creates a node selector */
    195 SCIP_NODESEL** nodesel, /**< pointer to store node selector */
    196 SCIP_SET* set, /**< global SCIP settings */
    197 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
    198 BMS_BLKMEM* blkmem, /**< block memory for parameter settings */
    199 const char* name, /**< name of node selector */
    200 const char* desc, /**< description of node selector */
    201 int stdpriority, /**< priority of the node selector in standard mode */
    202 int memsavepriority, /**< priority of the node selector in memory saving mode */
    203 SCIP_DECL_NODESELCOPY ((*nodeselcopy)), /**< copy method of node selector or NULL if you don't want to copy your plugin into sub-SCIPs */
    204 SCIP_DECL_NODESELFREE ((*nodeselfree)), /**< destructor of node selector */
    205 SCIP_DECL_NODESELINIT ((*nodeselinit)), /**< initialize node selector */
    206 SCIP_DECL_NODESELEXIT ((*nodeselexit)), /**< deinitialize node selector */
    207 SCIP_DECL_NODESELINITSOL((*nodeselinitsol)),/**< solving process initialization method of node selector */
    208 SCIP_DECL_NODESELEXITSOL((*nodeselexitsol)),/**< solving process deinitialization method of node selector */
    209 SCIP_DECL_NODESELSELECT((*nodeselselect)),/**< node selection method */
    210 SCIP_DECL_NODESELCOMP ((*nodeselcomp)), /**< node comparison method */
    211 SCIP_NODESELDATA* nodeseldata /**< node selector data */
    212 );
    213
    214/** frees memory of node selector */
    216 SCIP_NODESEL** nodesel, /**< pointer to node selector data structure */
    217 SCIP_SET* set /**< global SCIP settings */
    218 );
    219
    220/** initializes node selector */
    222 SCIP_NODESEL* nodesel, /**< node selector */
    223 SCIP_SET* set /**< global SCIP settings */
    224 );
    225
    226/** deinitializes node selector */
    228 SCIP_NODESEL* nodesel, /**< node selector */
    229 SCIP_SET* set /**< global SCIP settings */
    230 );
    231
    232/** informs node selector that the branch and bound process is being started */
    234 SCIP_NODESEL* nodesel, /**< node selector */
    235 SCIP_SET* set /**< global SCIP settings */
    236 );
    237
    238/** informs node selector that the branch and bound process data is being freed */
    240 SCIP_NODESEL* nodesel, /**< node selector */
    241 SCIP_SET* set /**< global SCIP settings */
    242 );
    243
    244/** select next node to be processed */
    246 SCIP_NODESEL* nodesel, /**< node selector */
    247 SCIP_SET* set, /**< global SCIP settings */
    248 SCIP_NODE** selnode /**< pointer to store node to be processed next */
    249 );
    250
    251/** compares two nodes; returns -1/0/+1 if node1 better/equal/worse than node2 */
    253 SCIP_NODESEL* nodesel, /**< node selector */
    254 SCIP_SET* set, /**< global SCIP settings */
    255 SCIP_NODE* node1, /**< first node to compare */
    256 SCIP_NODE* node2 /**< second node to compare */
    257 );
    258
    259/** sets priority of node selector in standard mode */
    261 SCIP_NODESEL* nodesel, /**< node selector */
    262 SCIP_SET* set, /**< global SCIP settings */
    263 int priority /**< new priority of the node selector */
    264 );
    265
    266/** sets priority of node selector in memory saving mode */
    268 SCIP_NODESEL* nodesel, /**< node selector */
    269 SCIP_SET* set, /**< global SCIP settings */
    270 int priority /**< new priority of the node selector */
    271 );
    272
    273/** sets copy method of node selector */
    275 SCIP_NODESEL* nodesel, /**< node selector */
    276 SCIP_DECL_NODESELCOPY ((*nodeselcopy)) /**< copy method of node selector or NULL if you don't want to copy your plugin into sub-SCIPs */
    277 );
    278
    279/** sets destructor method of node selector */
    281 SCIP_NODESEL* nodesel, /**< node selector */
    282 SCIP_DECL_NODESELFREE ((*nodeselfree)) /**< destructor of node selector */
    283 );
    284
    285/** sets initialization method of node selector */
    287 SCIP_NODESEL* nodesel, /**< node selector */
    288 SCIP_DECL_NODESELINIT ((*nodeselinit)) /**< initialize node selector */
    289 );
    290
    291/** sets deinitialization method of node selector */
    293 SCIP_NODESEL* nodesel, /**< node selector */
    294 SCIP_DECL_NODESELEXIT ((*nodeselexit)) /**< deinitialize node selector */
    295 );
    296
    297/** sets solving process initialization method of node selector */
    299 SCIP_NODESEL* nodesel, /**< node selector */
    300 SCIP_DECL_NODESELINITSOL ((*nodeselinitsol))/**< solving process initialization method of node selector */
    301 );
    302
    303/** sets solving process deinitialization method of node selector */
    305 SCIP_NODESEL* nodesel, /**< node selector */
    306 SCIP_DECL_NODESELEXITSOL ((*nodeselexitsol))/**< solving process deinitialization method of node selector */
    307 );
    308
    309/** enables or disables all clocks of \p nodesel, depending on the value of the flag */
    311 SCIP_NODESEL* nodesel, /**< the node selector for which all clocks should be enabled or disabled */
    312 SCIP_Bool enable /**< should the clocks of the node selector be enabled? */
    313 );
    314
    315#ifdef __cplusplus
    316}
    317#endif
    318
    319#endif
    common defines and data types used in all packages of SCIP
    #define SCIP_Bool
    Definition: def.h:91
    #define SCIP_Real
    Definition: def.h:156
    memory allocation routines
    struct BMS_BlkMem BMS_BLKMEM
    Definition: memory.h:437
    SCIP_Real SCIPnodepqGetLowerbound(SCIP_NODEPQ *nodepq, SCIP_SET *set)
    Definition: nodesel.c:639
    void SCIPnodeselSetFree(SCIP_NODESEL *nodesel, SCIP_DECL_NODESELFREE((*nodeselfree)))
    Definition: nodesel.c:1297
    int SCIPnodepqLen(const SCIP_NODEPQ *nodepq)
    Definition: nodesel.c:628
    void SCIPnodepqDestroy(SCIP_NODEPQ **nodepq)
    Definition: nodesel.c:130
    SCIP_RETCODE SCIPnodepqRemove(SCIP_NODEPQ *nodepq, SCIP_SET *set, SCIP_NODE *node)
    Definition: nodesel.c:581
    SCIP_RETCODE SCIPnodeselExit(SCIP_NODESEL *nodesel, SCIP_SET *set)
    Definition: nodesel.c:1077
    void SCIPnodeselEnableOrDisableClocks(SCIP_NODESEL *nodesel, SCIP_Bool enable)
    Definition: nodesel.c:1362
    void SCIPnodeselSetInitsol(SCIP_NODESEL *nodesel, SCIP_DECL_NODESELINITSOL((*nodeselinitsol)))
    Definition: nodesel.c:1330
    int SCIPnodeselCompare(SCIP_NODESEL *nodesel, SCIP_SET *set, SCIP_NODE *node1, SCIP_NODE *node2)
    Definition: nodesel.c:1178
    SCIP_RETCODE SCIPnodeselCreate(SCIP_NODESEL **nodesel, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, int stdpriority, int memsavepriority, SCIP_DECL_NODESELCOPY((*nodeselcopy)), SCIP_DECL_NODESELFREE((*nodeselfree)), SCIP_DECL_NODESELINIT((*nodeselinit)), SCIP_DECL_NODESELEXIT((*nodeselexit)), SCIP_DECL_NODESELINITSOL((*nodeselinitsol)), SCIP_DECL_NODESELEXITSOL((*nodeselexitsol)), SCIP_DECL_NODESELSELECT((*nodeselselect)), SCIP_DECL_NODESELCOMP((*nodeselcomp)), SCIP_NODESELDATA *nodeseldata)
    Definition: nodesel.c:978
    SCIP_RETCODE SCIPnodeselFree(SCIP_NODESEL **nodesel, SCIP_SET *set)
    Definition: nodesel.c:1012
    SCIP_RETCODE SCIPnodeselCopyInclude(SCIP_NODESEL *nodesel, SCIP_SET *set)
    Definition: nodesel.c:892
    SCIP_RATIONAL * SCIPnodepqGetLowerboundExact(SCIP_NODEPQ *nodepq, SCIP_SET *set)
    Definition: nodesel.c:662
    SCIP_RETCODE SCIPnodepqSetNodesel(SCIP_NODEPQ **nodepq, SCIP_SET *set, SCIP_NODESEL *nodesel)
    Definition: nodesel.c:219
    void SCIPnodeselSetCopy(SCIP_NODESEL *nodesel, SCIP_DECL_NODESELCOPY((*nodeselcopy)))
    Definition: nodesel.c:1286
    SCIP_RETCODE SCIPnodeselExitsol(SCIP_NODESEL *nodesel, SCIP_SET *set)
    Definition: nodesel.c:1131
    SCIP_RETCODE SCIPnodepqFree(SCIP_NODEPQ **nodepq, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_EVENTQUEUE *eventqueue, SCIP_EVENTFILTER *eventfilter, SCIP_TREE *tree, SCIP_LP *lp)
    Definition: nodesel.c:144
    SCIP_RETCODE SCIPnodeselSelect(SCIP_NODESEL *nodesel, SCIP_SET *set, SCIP_NODE **selnode)
    Definition: nodesel.c:1155
    void SCIPnodeselSetStdPriority(SCIP_NODESEL *nodesel, SCIP_SET *set, int priority)
    Definition: nodesel.c:1225
    void SCIPnodeselSetExitsol(SCIP_NODESEL *nodesel, SCIP_DECL_NODESELEXITSOL((*nodeselexitsol)))
    Definition: nodesel.c:1341
    SCIP_NODESEL * SCIPnodepqGetNodesel(SCIP_NODEPQ *nodepq)
    Definition: nodesel.c:209
    void SCIPnodeselSetInit(SCIP_NODESEL *nodesel, SCIP_DECL_NODESELINIT((*nodeselinit)))
    Definition: nodesel.c:1308
    SCIP_RETCODE SCIPnodepqInsert(SCIP_NODEPQ *nodepq, SCIP_SET *set, SCIP_NODE *node)
    Definition: nodesel.c:283
    SCIP_NODE * SCIPnodepqFirst(const SCIP_NODEPQ *nodepq)
    Definition: nodesel.c:602
    SCIP_RETCODE SCIPnodepqBound(SCIP_NODEPQ *nodepq, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_EVENTQUEUE *eventqueue, SCIP_EVENTFILTER *eventfilter, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp, SCIP_Real cutoffbound)
    Definition: nodesel.c:719
    int SCIPnodepqCompare(SCIP_NODEPQ *nodepq, SCIP_SET *set, SCIP_NODE *node1, SCIP_NODE *node2)
    Definition: nodesel.c:267
    SCIP_RETCODE SCIPnodepqCreate(SCIP_NODEPQ **nodepq, SCIP_SET *set, SCIP_NODESEL *nodesel)
    Definition: nodesel.c:108
    SCIP_Real SCIPnodepqGetLowerboundSum(SCIP_NODEPQ *nodepq)
    Definition: nodesel.c:709
    SCIP_RETCODE SCIPnodeselInitsol(SCIP_NODESEL *nodesel, SCIP_SET *set)
    Definition: nodesel.c:1107
    void SCIPnodeselSetExit(SCIP_NODESEL *nodesel, SCIP_DECL_NODESELEXIT((*nodeselexit)))
    Definition: nodesel.c:1319
    SCIP_NODE ** SCIPnodepqNodes(const SCIP_NODEPQ *nodepq)
    Definition: nodesel.c:618
    SCIP_NODE * SCIPnodepqGetLowerboundNode(SCIP_NODEPQ *nodepq, SCIP_SET *set)
    Definition: nodesel.c:685
    SCIP_RETCODE SCIPnodeselInit(SCIP_NODESEL *nodesel, SCIP_SET *set)
    Definition: nodesel.c:1041
    SCIP_RETCODE SCIPnodepqClear(SCIP_NODEPQ *nodepq, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_EVENTQUEUE *eventqueue, SCIP_EVENTFILTER *eventfilter, SCIP_TREE *tree, SCIP_LP *lp)
    Definition: nodesel.c:168
    void SCIPnodeselSetMemsavePriority(SCIP_NODESEL *nodesel, SCIP_SET *set, int priority)
    Definition: nodesel.c:1249
    public methods for node selectors
    Definition: heur_padm.c:135
    type definitions for managing events
    type definitions for LP management
    type definitions for message output methods
    #define SCIP_DECL_NODESELEXIT(x)
    Definition: type_nodesel.h:86
    #define SCIP_DECL_NODESELCOMP(x)
    Definition: type_nodesel.h:140
    #define SCIP_DECL_NODESELINITSOL(x)
    Definition: type_nodesel.h:97
    #define SCIP_DECL_NODESELCOPY(x)
    Definition: type_nodesel.h:61
    #define SCIP_DECL_NODESELEXITSOL(x)
    Definition: type_nodesel.h:108
    #define SCIP_DECL_NODESELINIT(x)
    Definition: type_nodesel.h:78
    #define SCIP_DECL_NODESELSELECT(x)
    Definition: type_nodesel.h:123
    #define SCIP_DECL_NODESELFREE(x)
    Definition: type_nodesel.h:70
    struct SCIP_NodeselData SCIP_NODESELDATA
    Definition: type_nodesel.h:52
    type definitions for rational numbers
    type definitions for collecting reoptimization information
    type definitions for return codes for SCIP methods
    enum SCIP_Retcode SCIP_RETCODE
    Definition: type_retcode.h:63
    type definitions for global SCIP settings
    type definitions for problem statistics
    type definitions for branch and bound tree