Scippy

    SCIP

    Solving Constraint Integer Programs

    struct_certificate.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_certificate.h
    26 * @ingroup INTERNALAPI
    27 * @brief data structures for certificate output
    28 * @author Ambros Gleixner
    29 * @author Daniel Steffy
    30 * @author Leon Eifler
    31 */
    32
    33/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
    34
    35#ifndef __SCIP_STRUCT_CERTIFICATE_H__
    36#define __SCIP_STRUCT_CERTIFICATE_H__
    37
    38#include <stdio.h>
    39
    40#include "scip/def.h"
    41#include "scip/pub_fileio.h"
    43#include "scip/type_var.h"
    44#include "scip/type_misc.h"
    45
    46#ifdef __cplusplus
    47extern "C" {
    48#endif
    49
    50/** data structure for hashing bounds of variables in a certificate file */
    52{
    53 int varindex; /**< index of this bound in the certificate file */
    54 SCIP_RATIONAL* boundval; /**< value of the bound */
    55 SCIP_BOUNDTYPE boundtype; /**< is it the upper bound? */
    56 SCIP_Bool isbound; /**< is the last printed index a bound? if it is not, the other information is not useful */
    57 SCIP_Bool isglobal; /**< is the bound global? */
    58 SCIP_Longint certificateindex; /**< index of the bound in the certificate file */
    59};
    60
    61/** data structure for storing necessary information to print verified aggregation of rows */
    63{
    64 SCIP_AGGRROW* aggrrow; /**< aggregation row to be saved */
    65 SCIP_ROW** aggrrows; /**< array of rows used for the aggregation */
    66 SCIP_ROW** negslackrows; /**< array of rows that are implicitly added (using negative slack) */
    67 SCIP_Real* weights; /**< array of weights */
    68 SCIP_Real* negslackweights; /**< array of weights for the negslackrows */
    69 SCIP_Real* substfactor; /**< factor used in the substition of slack variables (weight)/(1-f0) */
    70 int naggrrows; /**< length of the aggrrows array */
    71 int nnegslackrows; /**< length of the negslackrows array */
    72 SCIP_Longint fileindex; /**< index of the aggregated row in the certificate file */
    73 SCIP_Longint arpos; /**< position in the aggrinfo array, so we can access it from the hashmap */
    74};
    75
    76/** data structure for certifying MIR cut (splitcoefs, rhs, fractionality f, 1/1-f, scaling factor, which bounds to use) */
    78{
    79 SCIP_Real* splitcoefficients; /**< coefficients in the split, saved in the complemented variable space */
    80 SCIP_Real* slackcoefficients; /**< coefficients for integer slacks that enter the split */
    81 SCIP_Real* slackweight; /**< continuous part of integer slack that needs to be accounted for */
    82 SCIP_Bool* slackroundeddown; /**< original part of integer slack that needs to be accounted for */
    83 SCIP_Real* slackscale; /**< original part of integer slack that needs to be accounted for */
    84 SCIP_Real* slackusedcoef; /**< coef that was actually used in the slack subsititution */
    85 SCIP_ROW** slackrows; /**< rows whos integer slack is in the split */
    86 int* varinds; /**< indices of variables in split */
    87 int* slacksign; /**< was rhs or lhs used for integer slacks? +1 -> rhs, -1 -> lhs*/
    88 SCIP_Bool* upperused; /**< TRUE if ub was used to complement variable, FALSE if lb was used */
    89 SCIP_Bool* localbdused; /**< TRUE if local bound was used to complement variable, FALSE if global was used */
    90 int nsplitvars; /**< number of variables in the split */
    91 int nlocalvars; /**< number of local bounds used in transformation */
    92 int nslacks; /**< number of integer slacks in the split */
    94 SCIP_RATIONAL* rhs; /**< rhs of the split disjunction */
    95 SCIP_RATIONAL* frac; /**< fractionality of the rhs in the mir cut */
    96 SCIP_Longint arpos; /**< position in the mirinfo array, so we can access it from the hashmap */
    97 SCIP_INTERVAL onedivoneminusf0; /**< rounded value of 1/(1-f0) that was used in MIR procedure */
    98 SCIP_Real scale; /**< scaling factor that was used in cut-postprocessing */
    99 SCIP_Real unroundedrhs; /**< we need to save the rhs if we round down integral cuts for certification */
    100};
    101
    103{
    104 SCIP_Longint assumptionindex_self;/**< line index where node's last assumption is printed */
    105 SCIP_Longint derindex_self; /**< line index of node's own bound, initially inherited from parent */
    106 SCIP_RATIONAL* derbound_self; /**< node's own bound, initially inherited from parent */
    107 SCIP_Longint assumptionindex_left;/**< line index of left branch assumption */
    108 SCIP_Longint derindex_left; /**< line index of derivation assuming assumption left */
    109 SCIP_RATIONAL* derbound_left; /**< bound of left derivation */
    110 SCIP_Longint assumptionindex_right;/**< line index of right branch assumption */
    111 SCIP_Longint derindex_right; /**< line index of derivation assuming assumption right */
    112 SCIP_RATIONAL* derbound_right; /**< bound of right derivation */
    113 unsigned int leftfilled:1; /**< is the data for the left child node set? */
    114 unsigned int leftinfeas:1; /**< is the left node infeasible ? */
    115 unsigned int rightfilled:1; /**< is the data for the right child node set? */
    116 unsigned int rightinfeas:1; /**< is the node right infeasible ? */
    117 unsigned int inheritedbound:1; /**< did the node inherit its bound from its parent node? */
    118};
    119
    120/** certificate data structure */
    122{
    123 SCIP_MESSAGEHDLR* messagehdlr; /**< message handler to use */
    124 SCIP_HASHMAP* nodedatahash; /**< Hashmap storing pointer to data of each node */
    125 SCIP_HASHMAP* aggrinfohash; /**< Hashmap storing aggregation information of rows */
    126 SCIP_HASHMAP* mirinfohash; /**< Hashmap storing split disjunctions */
    127 SCIP_AGGREGATIONINFO** aggrinfo; /**< array to store the aggregation info to avoid memory leaks */
    128 SCIP_MIRINFO** mirinfo; /**< array to store the split info to avoid memory leaks */
    129 SCIP_Longint aggrinfosize; /**< size of aggrinfo array */
    130 SCIP_Longint naggrinfos; /**< number of elements in aggrinfo array */
    131 SCIP_Longint mirinfosize; /**< size of mirinfo array */
    132 SCIP_Longint nmirinfos; /**< number of elements in mirinfo array */
    133 SCIP_CERTIFICATEBOUND* lastinfo; /**< information on last printed certificate index */
    134 BMS_BLKMEM* blkmem; /**< SCIP block memory */
    135 SCIP_Longint indexcounter; /**< counter for line indices in file */
    136 SCIP_Longint indexcounter_ori; /**< counter for line indices in origial problem vipr file */
    137 SCIP_Longint conscounter; /**< counter for line indices in constraint section */
    138 SCIP_Longint lastboundindex; /**< place to store the last bound index to avoid having to add it to the signature of SCIPvarChgUbLocal, varProcessChgUbLocal */
    139 SCIP_FILE* origfile; /**< file to store original problem definition */
    140 SCIP_FILE* transfile; /**< file to store transformed problem (after presolving) */
    141 SCIP_FILE* derivationfile; /**< file to store derivations temporarily */
    142 SCIP_Bool transfile_initialized; /**< boolean to store if the transfile has been initialized */
    143 char* derivationfilename; /**< name of the derivation file */
    144 char* origfilename; /**< name of the original problem file */
    145 SCIP_Real filesize; /**< size of derivation file in MB */
    146 SCIP_Real maxfilesize; /**< maximum size of derivation file in MB (stop printing if exceeded) */
    147 SCIP_HASHMAP* rowdatahash; /**< Hashmap storing mapping between rows and file index */
    148 SCIP_RATIONAL* rootbound; /**< the bound for the root node */
    149 SCIP_RATIONAL* finalbound; /**< the final dual bound value */
    150 SCIP_Longint derindex_root; /**< index of root bound in certificate */
    151 SCIP_Bool rootinfeas; /**< is the root node infeasible */
    152 SCIP_Bool objintegral; /**< is the objective always integral? copy this so we don't need the prob everywhere */
    153 SCIP_Bool workingmirinfo; /**< true if mirinfo is under construction and not sparsely stored, false otherwise */
    154 SCIP_Bool workingaggrinfo; /**< true if aggrinfo is under construction (last entry not in hashmap), false otherwise */
    155 SCIP_RATIONAL** vals; /**< we maintain an array for solvals so we don't have to reallocate at every bounding call */
    156 int valssize; /**< the size of the vals array */
    157};
    158
    159#ifdef __cplusplus
    160}
    161#endif
    162
    163#endif
    common defines and data types used in all packages of SCIP
    #define SCIP_Longint
    Definition: def.h:141
    #define SCIP_Bool
    Definition: def.h:91
    #define SCIP_Real
    Definition: def.h:156
    struct BMS_BlkMem BMS_BLKMEM
    Definition: memory.h:437
    wrapper functions to map file i/o to standard or zlib file i/o
    struct SCIP_File SCIP_FILE
    Definition: pub_fileio.h:43
    SCIP_RATIONAL * boundval
    SCIP_Longint lastboundindex
    SCIP_Longint indexcounter_ori
    SCIP_FILE * derivationfile
    SCIP_Longint indexcounter
    SCIP_HASHMAP * nodedatahash
    SCIP_Longint nmirinfos
    SCIP_MIRINFO ** mirinfo
    SCIP_Longint conscounter
    SCIP_RATIONAL * rootbound
    SCIP_CERTIFICATEBOUND * lastinfo
    SCIP_HASHMAP * mirinfohash
    SCIP_Longint naggrinfos
    SCIP_Longint mirinfosize
    SCIP_Longint aggrinfosize
    SCIP_HASHMAP * rowdatahash
    SCIP_Longint derindex_root
    SCIP_AGGREGATIONINFO ** aggrinfo
    SCIP_RATIONAL ** vals
    SCIP_RATIONAL * finalbound
    SCIP_Bool transfile_initialized
    SCIP_MESSAGEHDLR * messagehdlr
    SCIP_HASHMAP * aggrinfohash
    SCIP_Longint assumptionindex_self
    SCIP_Longint assumptionindex_left
    unsigned int inheritedbound
    unsigned int rightfilled
    SCIP_Longint derindex_self
    unsigned int rightinfeas
    SCIP_RATIONAL * derbound_left
    SCIP_RATIONAL * derbound_self
    SCIP_RATIONAL * derbound_right
    SCIP_Longint assumptionindex_right
    SCIP_Longint derindex_left
    SCIP_Longint derindex_right
    SCIP_Real * slackscale
    SCIP_Real * slackcoefficients
    SCIP_RATIONAL * frac
    SCIP_Longint arpos
    SCIP_ROW ** slackrows
    SCIP_INTERVAL onedivoneminusf0
    SCIP_Real * slackweight
    SCIP_Bool * upperused
    SCIP_Real * splitcoefficients
    SCIP_RATIONAL * rhs
    SCIP_Real * slackusedcoef
    SCIP_Real unroundedrhs
    SCIP_Bool * localbdused
    SCIP_Bool * slackroundeddown
    type definitions for certificate output
    enum SCIP_BoundType SCIP_BOUNDTYPE
    Definition: type_lp.h:60
    type definitions for miscellaneous datastructures
    type definitions for problem variables