Scippy

    SCIP

    Solving Constraint Integer Programs

    type_event.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 type_event.h
    26 * @ingroup TYPEDEFINITIONS
    27 * @brief type definitions for managing events
    28 * @author Tobias Achterberg
    29 * @author Leona Gottwald
    30 *
    31 * This file defines the interface for event handler implemented in C.
    32 *
    33 * - \ref scip::ObjEventhdlr "C++ wrapper class"
    34 */
    35
    36/** @defgroup DEFPLUGINS_EVENT Default event handlers
    37 * @ingroup DEFPLUGINS
    38 * @brief implementation files (.c files) of the default event handlers of SCIP
    39 */
    40
    41/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
    42
    43#ifndef __SCIP_TYPE_EVENT_H__
    44#define __SCIP_TYPE_EVENT_H__
    45
    46#include "scip/def.h"
    47#include "scip/type_retcode.h"
    48#include "scip/type_scip.h"
    49
    50#if !defined(_MSC_VER) || _MSC_VER > 1600
    51#ifdef __cplusplus
    52#define __STDC_FORMAT_MACROS
    53#endif
    54#include <inttypes.h>
    55#else
    56#define PRIx64 "llx"
    57#endif
    58
    59#ifdef __cplusplus
    60extern "C" {
    61#endif
    62
    63/*
    64 * event types
    65 */
    66
    67#define SCIP_EVENTTYPE_DISABLED UINT64_C(0x0000000000) /**< the event was disabled and has no effect any longer */
    68
    69/* variable events */
    70#define SCIP_EVENTTYPE_VARADDED UINT64_C(0x0000000001) /**< a variable has been added to the transformed problem */
    71#define SCIP_EVENTTYPE_VARDELETED UINT64_C(0x0000000002) /**< a variable will be deleted from the transformed problem */
    72#define SCIP_EVENTTYPE_VARFIXED UINT64_C(0x0000000004) /**< a variable has been fixed, aggregated, or multi-aggregated */
    73#define SCIP_EVENTTYPE_VARUNLOCKED UINT64_C(0x0000000008) /**< the number of rounding locks of a variable was reduced to zero or one */
    74#define SCIP_EVENTTYPE_OBJCHANGED UINT64_C(0x0000000010) /**< the objective value of a variable has been changed */
    75#define SCIP_EVENTTYPE_GLBCHANGED UINT64_C(0x0000000020) /**< the global lower bound of a variable has been changed */
    76#define SCIP_EVENTTYPE_GUBCHANGED UINT64_C(0x0000000040) /**< the global upper bound of a variable has been changed */
    77#define SCIP_EVENTTYPE_LBTIGHTENED UINT64_C(0x0000000080) /**< the local lower bound of a variable has been increased */
    78#define SCIP_EVENTTYPE_LBRELAXED UINT64_C(0x0000000100) /**< the local lower bound of a variable has been decreased */
    79#define SCIP_EVENTTYPE_UBTIGHTENED UINT64_C(0x0000000200) /**< the local upper bound of a variable has been decreased */
    80#define SCIP_EVENTTYPE_UBRELAXED UINT64_C(0x0000000400) /**< the local upper bound of a variable has been increased */
    81#define SCIP_EVENTTYPE_GHOLEADDED UINT64_C(0x0000000800) /**< a global hole has been added to the hole list of a variable's domain */
    82#define SCIP_EVENTTYPE_GHOLEREMOVED UINT64_C(0x0000001000) /**< a global hole has been removed from the hole list of a variable's domain */
    83#define SCIP_EVENTTYPE_LHOLEADDED UINT64_C(0x0000002000) /**< a local hole has been added to the hole list of a variable's domain */
    84#define SCIP_EVENTTYPE_LHOLEREMOVED UINT64_C(0x0000004000) /**< a local hole has been removed from the hole list of a variable's domain */
    85#define SCIP_EVENTTYPE_IMPLADDED UINT64_C(0x0000008000) /**< the variable's implication list, variable bound or clique information was extended */
    86#define SCIP_EVENTTYPE_TYPECHANGED UINT64_C(0x0000010000) /**< the type of a variable has changed */
    87#define SCIP_EVENTTYPE_IMPLTYPECHANGED UINT64_C(0x0000020000) /**< the type of a variable has changed */
    88
    89/* presolving events */
    90#define SCIP_EVENTTYPE_PRESOLVEROUND UINT64_C(0x0000040000) /**< a presolving round has been finished */
    91
    92/* node events */
    93#define SCIP_EVENTTYPE_NODEFOCUSED UINT64_C(0x0000080000) /**< a node has been focused and is now the focus node */
    94#define SCIP_EVENTTYPE_NODEFEASIBLE UINT64_C(0x0000100000) /**< the LP/pseudo solution of the node was feasible */
    95#define SCIP_EVENTTYPE_NODEINFEASIBLE UINT64_C(0x0000200000) /**< the focus node has been proven to be infeasible or was bounded */
    96#define SCIP_EVENTTYPE_NODEBRANCHED UINT64_C(0x0000400000) /**< the focus node has been solved by branching */
    97#define SCIP_EVENTTYPE_NODEDELETE UINT64_C(0x0000800000) /**< a node is about to be deleted from the tree */
    98#define SCIP_EVENTTYPE_DUALBOUNDIMPROVED UINT64_C(0x0001000000) /**< a new best dual feasible solution was found */
    99
    100/* LP events */
    101#define SCIP_EVENTTYPE_FIRSTLPSOLVED UINT64_C(0x0002000000) /**< the node's initial LP was solved */
    102#define SCIP_EVENTTYPE_LPSOLVED UINT64_C(0x0004000000) /**< the node's LP was completely solved with cut & price */
    103
    104/* primal solution events */
    105#define SCIP_EVENTTYPE_POORSOLFOUND UINT64_C(0x0008000000) /**< a good enough primal feasible (but not new best) solution was found */
    106#define SCIP_EVENTTYPE_BESTSOLFOUND UINT64_C(0x0010000000) /**< a new best primal feasible solution was found */
    107
    108/* linear row events */
    109#define SCIP_EVENTTYPE_ROWADDEDSEPA UINT64_C(0x0020000000) /**< a row has been added to SCIP's separation storage */
    110#define SCIP_EVENTTYPE_ROWDELETEDSEPA UINT64_C(0x0040000000) /**< a row has been removed from SCIP's separation storage */
    111#define SCIP_EVENTTYPE_ROWADDEDLP UINT64_C(0x0080000000) /**< a row has been added to the LP */
    112#define SCIP_EVENTTYPE_ROWDELETEDLP UINT64_C(0x0100000000) /**< a row has been removed from the LP */
    113#define SCIP_EVENTTYPE_ROWCOEFCHANGED UINT64_C(0x0200000000) /**< a coefficient of a row has been changed (row specific event) */
    114#define SCIP_EVENTTYPE_ROWCONSTCHANGED UINT64_C(0x0400000000) /**< the constant of a row has been changed (row specific event) */
    115#define SCIP_EVENTTYPE_ROWSIDECHANGED UINT64_C(0x0800000000) /**< a side of a row has been changed (row specific event) */
    116
    117/* sync event */
    118#define SCIP_EVENTTYPE_SYNC UINT64_C(0x1000000000) /**< synchronization event */
    119
    120
    121/* event masks for variable events */
    122#define SCIP_EVENTTYPE_GBDCHANGED (SCIP_EVENTTYPE_GLBCHANGED | SCIP_EVENTTYPE_GUBCHANGED)
    123#define SCIP_EVENTTYPE_LBCHANGED (SCIP_EVENTTYPE_LBTIGHTENED | SCIP_EVENTTYPE_LBRELAXED)
    124#define SCIP_EVENTTYPE_UBCHANGED (SCIP_EVENTTYPE_UBTIGHTENED | SCIP_EVENTTYPE_UBRELAXED)
    125#define SCIP_EVENTTYPE_BOUNDTIGHTENED (SCIP_EVENTTYPE_LBTIGHTENED | SCIP_EVENTTYPE_UBTIGHTENED)
    126#define SCIP_EVENTTYPE_BOUNDRELAXED (SCIP_EVENTTYPE_LBRELAXED | SCIP_EVENTTYPE_UBRELAXED)
    127#define SCIP_EVENTTYPE_BOUNDCHANGED (SCIP_EVENTTYPE_LBCHANGED | SCIP_EVENTTYPE_UBCHANGED)
    128#define SCIP_EVENTTYPE_GHOLECHANGED (SCIP_EVENTTYPE_GHOLEADDED | SCIP_EVENTTYPE_GHOLEREMOVED)
    129#define SCIP_EVENTTYPE_LHOLECHANGED (SCIP_EVENTTYPE_LHOLEADDED | SCIP_EVENTTYPE_LHOLEREMOVED)
    130#define SCIP_EVENTTYPE_HOLECHANGED (SCIP_EVENTTYPE_GHOLECHANGED | SCIP_EVENTTYPE_LHOLECHANGED)
    131#define SCIP_EVENTTYPE_DOMCHANGED (SCIP_EVENTTYPE_BOUNDCHANGED | SCIP_EVENTTYPE_HOLECHANGED)
    132#define SCIP_EVENTTYPE_VARCHANGED (SCIP_EVENTTYPE_VARFIXED | SCIP_EVENTTYPE_VARUNLOCKED | SCIP_EVENTTYPE_OBJCHANGED \
    133 | SCIP_EVENTTYPE_GBDCHANGED | SCIP_EVENTTYPE_DOMCHANGED | SCIP_EVENTTYPE_IMPLADDED \
    134 | SCIP_EVENTTYPE_VARDELETED | SCIP_EVENTTYPE_TYPECHANGED | SCIP_EVENTTYPE_IMPLTYPECHANGED)
    135#define SCIP_EVENTTYPE_VAREVENT (SCIP_EVENTTYPE_VARADDED | SCIP_EVENTTYPE_VARCHANGED)
    136
    137/* event masks for node events */
    138#define SCIP_EVENTTYPE_NODESOLVED (SCIP_EVENTTYPE_NODEFEASIBLE | SCIP_EVENTTYPE_NODEINFEASIBLE \
    139 | SCIP_EVENTTYPE_NODEBRANCHED)
    140#define SCIP_EVENTTYPE_NODEEVENT (SCIP_EVENTTYPE_NODEFOCUSED | SCIP_EVENTTYPE_NODESOLVED)
    141
    142/* event masks for LP events */
    143#define SCIP_EVENTTYPE_LPEVENT (SCIP_EVENTTYPE_FIRSTLPSOLVED | SCIP_EVENTTYPE_LPSOLVED)
    144
    145/* event masks for primal solution events */
    146#define SCIP_EVENTTYPE_SOLFOUND (SCIP_EVENTTYPE_POORSOLFOUND | SCIP_EVENTTYPE_BESTSOLFOUND)
    147#define SCIP_EVENTTYPE_SOLEVENT (SCIP_EVENTTYPE_SOLFOUND)
    148
    149/* event masks for primal/dual bound events */
    150#define SCIP_EVENTTYPE_GAPUPDATED (SCIP_EVENTTYPE_BESTSOLFOUND | SCIP_EVENTTYPE_DUALBOUNDIMPROVED)
    151
    152/* event masks for row events */
    153#define SCIP_EVENTTYPE_ROWCHANGED (SCIP_EVENTTYPE_ROWCOEFCHANGED | SCIP_EVENTTYPE_ROWCONSTCHANGED | SCIP_EVENTTYPE_ROWSIDECHANGED)
    154#define SCIP_EVENTTYPE_ROWEVENT (SCIP_EVENTTYPE_ROWADDEDSEPA | SCIP_EVENTTYPE_ROWDELETEDSEPA | SCIP_EVENTTYPE_ROWADDEDLP | SCIP_EVENTTYPE_ROWDELETEDLP | SCIP_EVENTTYPE_ROWCHANGED)
    155
    156typedef uint64_t SCIP_EVENTTYPE; /**< type of event (bit field) */
    157#define SCIP_EVENTTYPE_FORMAT PRIx64
    158
    159typedef struct SCIP_Eventhdlr SCIP_EVENTHDLR; /**< event handler for a specific events */
    160typedef struct SCIP_EventhdlrData SCIP_EVENTHDLRDATA; /**< event handler data */
    161typedef struct SCIP_Event SCIP_EVENT; /**< event data structure */
    162typedef struct SCIP_EventVarAdded SCIP_EVENTVARADDED; /**< data for variable addition events */
    163typedef struct SCIP_EventVarDeleted SCIP_EVENTVARDELETED; /**< data for variable deletion events */
    164typedef struct SCIP_EventVarFixed SCIP_EVENTVARFIXED; /**< data for variable fixing events */
    165typedef struct SCIP_EventVarUnlocked SCIP_EVENTVARUNLOCKED; /**< data for variable unlocked events */
    166typedef struct SCIP_EventObjChg SCIP_EVENTOBJCHG; /**< data for objective value change events */
    167typedef struct SCIP_EventBdChg SCIP_EVENTBDCHG; /**< data for bound change events */
    168typedef struct SCIP_EventHole SCIP_EVENTHOLE; /**< data for domain hole events */
    169typedef struct SCIP_EventImplAdd SCIP_EVENTIMPLADD; /**< data for implication added events */
    170typedef struct SCIP_EventTypeChg SCIP_EVENTTYPECHG; /**< data for variable type change events */
    171typedef struct SCIP_EventImplTypeChg SCIP_EVENTTYPEIMPLCHG; /**< data for variable implied type change events */
    172typedef struct SCIP_EventRowAddedSepa SCIP_EVENTROWADDEDSEPA; /**< data for row addition to sepastorage events */
    173typedef struct SCIP_EventRowDeletedSepa SCIP_EVENTROWDELETEDSEPA; /**< data for row deletion from sepastorage events */
    174typedef struct SCIP_EventRowAddedLP SCIP_EVENTROWADDEDLP; /**< data for row addition to LP events */
    175typedef struct SCIP_EventRowDeletedLP SCIP_EVENTROWDELETEDLP; /**< data for row deletion from LP events */
    176typedef struct SCIP_EventRowCoefChanged SCIP_EVENTROWCOEFCHANGED; /**< data for row coefficient change events */
    177typedef struct SCIP_EventRowConstChanged SCIP_EVENTROWCONSTCHANGED; /**< data for row constant change events */
    178typedef struct SCIP_EventRowSideChanged SCIP_EVENTROWSIDECHANGED; /**< data for row side change events */
    179typedef struct SCIP_EventData SCIP_EVENTDATA; /**< locally defined event specific data */
    180typedef struct SCIP_EventFilter SCIP_EVENTFILTER; /**< event filter to select events to be processed by an event handler */
    181typedef struct SCIP_EventQueue SCIP_EVENTQUEUE; /**< event queue to cache events and process them later */
    182
    183/** copy method for event handler plugins (called when SCIP copies plugins)
    184 *
    185 * input:
    186 * - scip : SCIP main data structure
    187 * - eventhdlr : the event handler itself
    188 */
    189#define SCIP_DECL_EVENTCOPY(x) SCIP_RETCODE x (SCIP* scip, SCIP_EVENTHDLR* eventhdlr)
    190
    191/** destructor of event handler to free user data (called when SCIP is exiting)
    192 *
    193 * input:
    194 * - scip : SCIP main data structure
    195 * - eventhdlr : the event handler itself
    196 */
    197#define SCIP_DECL_EVENTFREE(x) SCIP_RETCODE x (SCIP* scip, SCIP_EVENTHDLR* eventhdlr)
    198
    199/** initialization method of event handler (called after problem was transformed)
    200 *
    201 * input:
    202 * - scip : SCIP main data structure
    203 * - eventhdlr : the event handler itself
    204 */
    205#define SCIP_DECL_EVENTINIT(x) SCIP_RETCODE x (SCIP* scip, SCIP_EVENTHDLR* eventhdlr)
    206
    207/** deinitialization method of event handler (called before transformed problem is freed)
    208 *
    209 * input:
    210 * - scip : SCIP main data structure
    211 * - eventhdlr : the event handler itself
    212 */
    213#define SCIP_DECL_EVENTEXIT(x) SCIP_RETCODE x (SCIP* scip, SCIP_EVENTHDLR* eventhdlr)
    214
    215/** solving process initialization method of event handler (called when branch and bound process is about to begin)
    216 *
    217 * This method is called when the presolving was finished and the branch and bound process is about to begin.
    218 * The event handler may use this call to initialize its branch and bound specific data.
    219 *
    220 * input:
    221 * - scip : SCIP main data structure
    222 * - eventhdlr : the event handler itself
    223 */
    224#define SCIP_DECL_EVENTINITSOL(x) SCIP_RETCODE x (SCIP* scip, SCIP_EVENTHDLR* eventhdlr)
    225
    226/** solving process deinitialization method of event handler (called before branch and bound process data is freed)
    227 *
    228 * This method is called before the branch and bound process is freed.
    229 * The event handler should use this call to clean up its branch and bound data.
    230 *
    231 * input:
    232 * - scip : SCIP main data structure
    233 * - eventhdlr : the event handler itself
    234 */
    235#define SCIP_DECL_EVENTEXITSOL(x) SCIP_RETCODE x (SCIP* scip, SCIP_EVENTHDLR* eventhdlr)
    236
    237/** frees specific event data
    238 *
    239 * input:
    240 * - scip : SCIP main data structure
    241 * - eventhdlr : the event handler itself
    242 * - eventdata : pointer to the event data to free
    243 */
    244#define SCIP_DECL_EVENTDELETE(x) SCIP_RETCODE x (SCIP* scip, SCIP_EVENTHDLR* eventhdlr, SCIP_EVENTDATA** eventdata)
    245
    246/** execution method of event handler
    247 *
    248 * Processes the event. The method is called every time an event occurs, for which the event handler
    249 * is responsible. Event handlers may declare themselves responsible for events by calling the
    250 * corresponding SCIPcatch...() method. This method creates an event filter object to point to the
    251 * given event handler and event data.
    252 *
    253 * input:
    254 * - scip : SCIP main data structure
    255 * - eventhdlr : the event handler itself
    256 * - event : event to process
    257 * - eventdata : user data for the event
    258 */
    259#define SCIP_DECL_EVENTEXEC(x) SCIP_RETCODE x (SCIP* scip, SCIP_EVENTHDLR* eventhdlr, SCIP_EVENT* event, SCIP_EVENTDATA* eventdata)
    260
    261#ifdef __cplusplus
    262}
    263#endif
    264
    265#endif
    common defines and data types used in all packages of SCIP
    struct SCIP_EventData SCIP_EVENTDATA
    Definition: type_event.h:179
    struct SCIP_EventhdlrData SCIP_EVENTHDLRDATA
    Definition: type_event.h:160
    uint64_t SCIP_EVENTTYPE
    Definition: type_event.h:156
    type definitions for return codes for SCIP methods
    type definitions for SCIP's main datastructure