Scippy

    SCIP

    Solving Constraint Integer Programs

    struct_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 struct_event.h
    26 * @ingroup INTERNALAPI
    27 * @brief datastructures for managing events
    28 * @author Tobias Achterberg
    29 */
    30
    31/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
    32
    33#ifndef __SCIP_STRUCT_EVENT_H__
    34#define __SCIP_STRUCT_EVENT_H__
    35
    36
    37#include "scip/def.h"
    38#include "scip/type_clock.h"
    39#include "scip/type_event.h"
    40#include "scip/type_var.h"
    41#include "scip/type_sol.h"
    42#include "scip/type_tree.h"
    43
    44#ifdef __cplusplus
    45extern "C" {
    46#endif
    47
    48/** data for variable addition events */
    50{
    51 SCIP_VAR* var; /**< variable that was added to the problem */
    52};
    53
    54/** data for variable deletion events */
    56{
    57 SCIP_VAR* var; /**< variable that will be deleted from the problem */
    58};
    59
    60/** data for variable fixing events */
    62{
    63 SCIP_VAR* var; /**< variable that was fixed */
    64};
    65
    66/** data for locks change events */
    68{
    69 SCIP_VAR* var; /**< variable for which the lock numbers were changed */
    70};
    71
    72/** data for objective value change events */
    74{
    75 SCIP_Real oldobj; /**< old objective value before value changed */
    76 SCIP_Real newobj; /**< new objective value after value changed */
    77 SCIP_RATIONAL* oldobjexact; /**< exact old obj (NULL if not an exact change) */
    78 SCIP_RATIONAL* newobjexact; /**< exact new obj (NULL if not an exact change) */
    79 SCIP_VAR* var; /**< variable whose objective value changed */
    80};
    81
    82/** data for bound change events */
    84{
    85 SCIP_Real oldbound; /**< old bound before bound changed */
    86 SCIP_Real newbound; /**< new bound after bound changed */
    87 SCIP_RATIONAL* oldboundexact; /**< exact old variable bound (NULL if not an exact change) */
    88 SCIP_RATIONAL* newboundexact; /**< exact new variable bound (NULL if not an exact change) */
    89 SCIP_VAR* var; /**< variable whose bound changed */
    90};
    91
    92/** data for domain hole events */
    94{
    95 SCIP_Real left; /**< left bound of open interval in hole */
    96 SCIP_Real right; /**< right bound of open interval in hole */
    97 SCIP_VAR* var; /**< variable for which a hole was removed */
    98};
    99
    100/** data for implication added events */
    102{
    103 SCIP_VAR* var; /**< variable for which an implication, variable bound, or clique was added */
    104};
    105
    106/** data for variable type change events */
    108{
    109 SCIP_VARTYPE oldtype; /**< old variable type */
    110 SCIP_VARTYPE newtype; /**< new variable type */
    111 SCIP_VAR* var; /**< variable whose type changed */
    112};
    113
    114/** data for variable implied type change events */
    116{
    117 SCIP_IMPLINTTYPE oldtype; /**< old variable implied type */
    118 SCIP_IMPLINTTYPE newtype; /**< new variable implied type */
    119 SCIP_VAR* var; /**< variable whose type changed */
    120};
    121
    122/** data for row addition to separation storage events */
    124{
    125 SCIP_ROW* row; /**< row that was added to separation storage */
    126};
    127
    128/** data for row deletion from separation storage events */
    130{
    131 SCIP_ROW* row; /**< row that was deleted from separation storage */
    132};
    133
    134/** data for row addition to LP events */
    136{
    137 SCIP_ROW* row; /**< row that was added to the LP */
    138};
    139
    140/** data for row deletion from LP events */
    142{
    143 SCIP_ROW* row; /**< row that was deleted from the LP */
    144};
    145
    146/** data for row coefficient change events */
    148{
    149 SCIP_ROW* row; /**< row which coefficient has changed */
    150 SCIP_COL* col; /**< column which coefficient has changed */
    151 SCIP_Real oldval; /**< old value of coefficient */
    152 SCIP_Real newval; /**< new value of coefficient */
    153};
    154
    155/** data for row constant change events */
    157{
    158 SCIP_ROW* row; /**< row which constant has changed */
    159 SCIP_Real oldval; /**< old value of constant */
    160 SCIP_Real newval; /**< new value of constant */
    161};
    162
    163/** data for row side change events */
    165{
    166 SCIP_ROW* row; /**< row which side has changed */
    167 SCIP_SIDETYPE side; /**< which side has changed */
    168 SCIP_Real oldval; /**< old value of side */
    169 SCIP_Real newval; /**< new value of side */
    170};
    171
    172/** event data structure */
    174{
    175 union
    176 {
    177 SCIP_EVENTVARADDED eventvaradded; /**< data for variable addition events */
    178 SCIP_EVENTVARDELETED eventvardeleted; /**< data for variable deletion events */
    179 SCIP_EVENTVARFIXED eventvarfixed; /**< data for variable fixing events */
    180 SCIP_EVENTVARUNLOCKED eventvarunlocked; /**< data for locks change events */
    181 SCIP_EVENTOBJCHG eventobjchg; /**< data for objective value change events */
    182 SCIP_EVENTBDCHG eventbdchg; /**< data for bound change events */
    183 SCIP_EVENTHOLE eventhole; /**< data for domain hole events */
    184 SCIP_EVENTIMPLADD eventimpladd; /**< data for implication added events */
    185 SCIP_EVENTTYPECHG eventtypechg; /**< data for variable type change events */
    186 SCIP_EVENTTYPEIMPLCHG eventimpltypechg; /**< data for variable implied type change events */
    187 SCIP_EVENTROWADDEDSEPA eventrowaddedsepa; /**< data for row addition to separation storage events */
    188 SCIP_EVENTROWDELETEDSEPA eventrowdeletedsepa; /**< data for row deletion from separation storage events */
    189 SCIP_EVENTROWADDEDLP eventrowaddedlp; /**< data for row addition to LP events */
    190 SCIP_EVENTROWDELETEDLP eventrowdeletedlp; /**< data for row deletion from LP events */
    191 SCIP_EVENTROWCOEFCHANGED eventrowcoefchanged; /**< data for row coefficient change events */
    192 SCIP_EVENTROWCONSTCHANGED eventrowconstchanged; /**< data for row constant change events */
    193 SCIP_EVENTROWSIDECHANGED eventrowsidechanged; /**< data for row side change events */
    194 SCIP_NODE* node; /**< data for node and LP events */
    195 SCIP_SOL* sol; /**< data for primal solution events */
    197 SCIP_EVENTTYPE eventtype; /**< type of event */
    198};
    199
    200/** event filter to select events to be processed by an event handler */
    202{
    203 SCIP_EVENTTYPE* eventtypes; /**< array with types of event to process; 0 marks a deleted event catch entry */
    204 SCIP_EVENTHDLR** eventhdlrs; /**< array with event handlers to process the event */
    205 SCIP_EVENTDATA** eventdata; /**< array with user data for the issued event */
    206 int* nextpos; /**< linked lists for free, delayed added and delayed deleted slot positions */
    207 int size; /**< size of filter arrays (available slots in arrays) */
    208 int len; /**< number entries in filter arrays (used and deleted) */
    209 int firstfreepos; /**< first deleted slot; remaining slots are in poslist */
    210 int firstdeletedpos; /**< first delayed deleted slot; remaining slots are in poslist */
    211 SCIP_EVENTTYPE eventmask; /**< mask for events that are handled by any event handler in the filter */
    212 SCIP_EVENTTYPE delayedeventmask; /**< mask for delayed added events */
    213 SCIP_Bool delayupdates; /**< should additions and deletions to the filter be delayed? */
    214};
    215
    216/** event handler */
    218{
    219 char* name; /**< name of event handler */
    220 char* desc; /**< description of event handler */
    221 SCIP_DECL_EVENTCOPY ((*eventcopy)); /**< copy method of event handler or NULL if you don't want to copy your plugin into sub-SCIPs */
    222 SCIP_DECL_EVENTFREE ((*eventfree)); /**< destructor of event handler */
    223 SCIP_DECL_EVENTINIT ((*eventinit)); /**< initialize event handler */
    224 SCIP_DECL_EVENTEXIT ((*eventexit)); /**< deinitialize event handler */
    225 SCIP_DECL_EVENTINITSOL((*eventinitsol)); /**< solving process initialization method of event handler */
    226 SCIP_DECL_EVENTEXITSOL((*eventexitsol)); /**< solving process deinitialization method of event handler */
    227 SCIP_DECL_EVENTDELETE ((*eventdelete)); /**< free specific event data */
    228 SCIP_DECL_EVENTEXEC ((*eventexec)); /**< execute event handler */
    229 SCIP_EVENTHDLRDATA* eventhdlrdata; /**< event handler data */
    230 SCIP_CLOCK* setuptime; /**< time spend for setting up this event handler for the next stages */
    231 SCIP_CLOCK* eventtime; /**< time spend in this event handler execution method */
    232 SCIP_Bool initialized; /**< is event handler initialized? */
    233};
    234
    235/** event queue to cache events and process them later */
    237{
    238 SCIP_EVENT** events; /**< array with queued events */
    239 int eventssize; /**< number of available slots in events array */
    240 int nevents; /**< number of events in queue (used slots if events array) */
    241 SCIP_Bool delayevents; /**< should the events be delayed and processed later? */
    242};
    243
    244#ifdef __cplusplus
    245}
    246#endif
    247
    248#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
    SCIP_Real oldbound
    Definition: struct_event.h:85
    SCIP_Real newbound
    Definition: struct_event.h:86
    SCIP_RATIONAL * newboundexact
    Definition: struct_event.h:88
    SCIP_VAR * var
    Definition: struct_event.h:89
    SCIP_RATIONAL * oldboundexact
    Definition: struct_event.h:87
    SCIP_EVENTTYPE delayedeventmask
    Definition: struct_event.h:212
    SCIP_EVENTHDLR ** eventhdlrs
    Definition: struct_event.h:204
    SCIP_Bool delayupdates
    Definition: struct_event.h:213
    SCIP_EVENTTYPE eventmask
    Definition: struct_event.h:211
    SCIP_EVENTTYPE * eventtypes
    Definition: struct_event.h:203
    SCIP_EVENTDATA ** eventdata
    Definition: struct_event.h:205
    SCIP_VAR * var
    Definition: struct_event.h:97
    SCIP_Real left
    Definition: struct_event.h:95
    SCIP_Real right
    Definition: struct_event.h:96
    SCIP_IMPLINTTYPE newtype
    Definition: struct_event.h:118
    SCIP_IMPLINTTYPE oldtype
    Definition: struct_event.h:117
    SCIP_RATIONAL * newobjexact
    Definition: struct_event.h:78
    SCIP_Real newobj
    Definition: struct_event.h:76
    SCIP_RATIONAL * oldobjexact
    Definition: struct_event.h:77
    SCIP_Real oldobj
    Definition: struct_event.h:75
    SCIP_VAR * var
    Definition: struct_event.h:79
    SCIP_EVENT ** events
    Definition: struct_event.h:238
    SCIP_Bool delayevents
    Definition: struct_event.h:241
    SCIP_VARTYPE oldtype
    Definition: struct_event.h:109
    SCIP_VARTYPE newtype
    Definition: struct_event.h:110
    SCIP_EVENTROWCONSTCHANGED eventrowconstchanged
    Definition: struct_event.h:192
    SCIP_EVENTROWCOEFCHANGED eventrowcoefchanged
    Definition: struct_event.h:191
    SCIP_EVENTROWDELETEDLP eventrowdeletedlp
    Definition: struct_event.h:190
    SCIP_EVENTROWDELETEDSEPA eventrowdeletedsepa
    Definition: struct_event.h:188
    SCIP_EVENTROWSIDECHANGED eventrowsidechanged
    Definition: struct_event.h:193
    SCIP_EVENTVARFIXED eventvarfixed
    Definition: struct_event.h:179
    SCIP_NODE * node
    Definition: struct_event.h:194
    SCIP_EVENTTYPECHG eventtypechg
    Definition: struct_event.h:185
    SCIP_EVENTTYPEIMPLCHG eventimpltypechg
    Definition: struct_event.h:186
    SCIP_EVENTTYPE eventtype
    Definition: struct_event.h:197
    SCIP_EVENTVARUNLOCKED eventvarunlocked
    Definition: struct_event.h:180
    SCIP_EVENTBDCHG eventbdchg
    Definition: struct_event.h:182
    SCIP_EVENTROWADDEDSEPA eventrowaddedsepa
    Definition: struct_event.h:187
    SCIP_EVENTHOLE eventhole
    Definition: struct_event.h:183
    SCIP_EVENTIMPLADD eventimpladd
    Definition: struct_event.h:184
    SCIP_EVENTOBJCHG eventobjchg
    Definition: struct_event.h:181
    SCIP_EVENTVARADDED eventvaradded
    Definition: struct_event.h:177
    union SCIP_Event::@18 data
    SCIP_EVENTROWADDEDLP eventrowaddedlp
    Definition: struct_event.h:189
    SCIP_SOL * sol
    Definition: struct_event.h:195
    SCIP_EVENTVARDELETED eventvardeleted
    Definition: struct_event.h:178
    SCIP_DECL_EVENTINITSOL((*eventinitsol))
    SCIP_DECL_EVENTEXIT((*eventexit))
    SCIP_DECL_EVENTEXEC((*eventexec))
    SCIP_DECL_EVENTDELETE((*eventdelete))
    SCIP_DECL_EVENTFREE((*eventfree))
    SCIP_Bool initialized
    Definition: struct_event.h:232
    SCIP_DECL_EVENTEXITSOL((*eventexitsol))
    SCIP_DECL_EVENTCOPY((*eventcopy))
    SCIP_CLOCK * setuptime
    Definition: struct_event.h:230
    SCIP_CLOCK * eventtime
    Definition: struct_event.h:231
    SCIP_DECL_EVENTINIT((*eventinit))
    SCIP_EVENTHDLRDATA * eventhdlrdata
    Definition: struct_event.h:229
    type definitions for clocks and timing issues
    type definitions for managing events
    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
    enum SCIP_SideType SCIP_SIDETYPE
    Definition: type_lp.h:68
    type definitions for storing primal CIP solutions
    type definitions for branch and bound tree
    type definitions for problem variables
    enum SCIP_ImplintType SCIP_IMPLINTTYPE
    Definition: type_var.h:117
    enum SCIP_Vartype SCIP_VARTYPE
    Definition: type_var.h:73