Scippy

    SCIP

    Solving Constraint Integer Programs

    struct_syncstore.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-2026 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_syncstore.h
    26 * @ingroup PARALLEL
    27 * @brief the struct definitions for the synchronization store
    28 * @author Stephen J. Maher
    29 * @author Leona Gottwald
    30 */
    31
    32/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
    33
    34#ifndef __STRUCT_SYNCSTORE_H__
    35#define __STRUCT_SYNCSTORE_H__
    36
    37#include "scip/type_syncstore.h"
    38#include "tpi/type_tpi.h"
    39#include "scip/def.h"
    40#include "scip/type_scip.h"
    41#include "scip/type_stat.h"
    42#include "scip/type_lp.h"
    43
    44#ifdef __cplusplus
    45extern "C" {
    46#endif
    47
    49{
    50 int nuses; /**< number of uses of the synchronization store */
    51 SCIP_PARALLELMODE mode; /**< the mode for the parallel solving */
    52 SCIP_Bool initialized; /**< flag to indicate whether the syncstore has been initialized */
    53 int ninitvars; /**< number of variables it has been initialized for */
    54 SCIP_SYNCDATA* syncdata; /**< array of size nsyncdata, containing the synchronization data
    55 * for each active synchronization */
    56 SCIP_SYNCDATA* lastsync; /**< pointer to the last synchronization data that has been synchronized
    57 * by all threads */
    58
    59 SCIP* mainscip; /**< the SCIP instance that was used for initializing the syncstore */
    60 SCIP_Real limit_gap; /**< relative gap limit in main SCIP */
    61 SCIP_Real limit_absgap; /**< absolute gap limit in main SCIP */
    62 SCIP_Bool stopped; /**< flag to indicate if the solving is stopped */
    63 SCIP_LOCK* lock; /**< lock to protect the syncstore data structure from data races */
    64
    65 int nsyncdata; /**< the size of the synchronization data array */
    66 SCIP_Real minsyncdelay; /**< the minimum delay before a synchronization data may be read */
    67 int maxnsyncdelay; /**< maximum number of synchronizations before the reading of the next
    68 * synchronization data is enforced regardless of the minimal synchronization
    69 * delay */
    70 SCIP_Real syncfreqinit; /**< the initial synchronization frequency which is read from the settings
    71 * of the main SCIP when the syncstore is initialized */
    72 SCIP_Real syncfreqmax; /**< the maximum synchronization frequency */
    73 int maxnsols; /**< maximum number of solutions that can be shared in one synchronization */
    74 int nsolvers; /**< number of solvers synchronizing with this syncstore */
    75};
    76
    77
    78struct SCIP_SyncData
    79{
    80 SCIP_Real* solobj; /**< array with the objective value of all stored solutions */
    81 SCIP_Real** sols; /**< array with the solution values of each variable for all stored solutions */
    82 int* solsource; /**< the solverid of the solution came from */
    83 int nsols; /**< number of solutions currently stored in the synchronization data */
    84 SCIP_Real bestlowerbound; /**< largest lower bound on the objective value that was stored in this
    85 * synchronization data */
    86 SCIP_Real bestupperbound; /**< smallest upper bound on the objective value that was stored in this
    87 * synchronization data */
    88 SCIP_Longint syncnum; /**< the synchronization number of this synchronization data */
    89 int winner; /**< the solverid of the solver with the best status */
    90 SCIP_STATUS status; /**< the best status that was stored in this synchronization data */
    91 SCIP_LOCK* lock; /**< a lock to protect this synchronization data */
    92 int syncedcount; /**< a counter of how many solvers have finished writing to this synchronization data */
    93 SCIP_CONDITION* allsynced; /**< a condition variable to signal when the last solver has finished writing to this
    94 * synchronization data */
    95 SCIP_BOUNDSTORE* boundstore; /**< a boundstore for storing all the bound changes that were added to this
    96 * synchronization data */
    97 SCIP_Real syncfreq; /**< the synchronization frequency that was set in this synchronization data */
    98 SCIP_Longint memtotal; /**< the total amount of memory used by all solvers including the main SCIP */
    99};
    100
    101/** struct for storing the position of variables lower and upper bound in the boundstore */
    102typedef struct
    103{
    104 int pos[2]; /**< stores at pos[SCIP_BOUNDTYPE_LOWER] the position of the lowerbound and
    105 * at pos[SCIP_BOUNDTYPE_UPPER] the position of the upperbound */
    106} BoundPos;
    107
    108/** struct for storing a single boundchange in the boundstore */
    109typedef struct
    110{
    111 int varidx; /**< the variables position in the variable array of the main SCIP */
    112 SCIP_Real newbound; /**< the variables new bound */
    113 SCIP_BOUNDTYPE boundtype; /**< the type of the variables new bound */
    114} BoundChg;
    115
    117{
    118 int nvars; /**< the number of variables to store bounds for */
    119 BoundPos* bndpos; /**< array of size nvars to store the positions for all the bound changes
    120 * stored in this boundstore */
    121 BoundChg* bndchg; /**< array of boundchanges */
    122 int nbndchg; /**< the number of boundchanges stored in this bound store */
    123 int bndchgsize; /**< the size of the bound change array */
    124};
    125
    126#ifdef __cplusplus
    127}
    128#endif
    129
    130#endif
    common defines and data types used in all packages of SCIP
    #define SCIP_Longint
    Definition: def.h:148
    #define SCIP_Bool
    Definition: def.h:98
    #define SCIP_Real
    Definition: def.h:163
    SCIP_Real newbound
    SCIP_BOUNDTYPE boundtype
    SCIP_Real limit_gap
    SCIP_Bool initialized
    SCIP_SYNCDATA * syncdata
    SCIP_Real limit_absgap
    SCIP_Real syncfreqmax
    SCIP_Real syncfreqinit
    SCIP_PARALLELMODE mode
    SCIP_LOCK * lock
    SCIP_SYNCDATA * lastsync
    SCIP_Real minsyncdelay
    type definitions for LP management
    enum SCIP_BoundType SCIP_BOUNDTYPE
    Definition: type_lp.h:60
    type definitions for SCIP's main datastructure
    type definitions for problem statistics
    enum SCIP_Status SCIP_STATUS
    Definition: type_stat.h:64
    the type definitions for the synchronization store
    enum SCIP_Parallelmode SCIP_PARALLELMODE
    struct SCIP_SyncData SCIP_SYNCDATA
    the type definitions for the task processing interface