1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 2 /* */ 3 /* This file is part of the program and library */ 4 /* SCIP --- Solving Constraint Integer Programs */ 5 /* */ 6 /* Copyright (c) 2002-2023 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 symmetry_lexred.h 26 * @ingroup OTHER_CFILES 27 * @brief methods for handling symmetries by dynamic lexicographic ordering reduction 28 * @author Jasper van Doornmalen 29 */ 30 31 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/ 32 33 #ifndef __SCIP_SYMMETRY_LEXRED_H__ 34 #define __SCIP_SYMMETRY_LEXRED_H__ 35 36 #include "scip/def.h" 37 #include "scip/type_retcode.h" 38 #include "scip/type_scip.h" 39 #include "scip/type_var.h" 40 #include "scip/type_event.h" 41 #include "symmetry/type_symmetry.h" 42 43 #ifdef __cplusplus 44 extern "C" { 45 #endif 46 47 48 /* 49 * Data structures 50 */ 51 52 /** data for dynamic lexicographic reduction propagator */ 53 struct SCIP_LexRedData; 54 typedef struct SCIP_LexRedData SCIP_LEXREDDATA; /**< data for dynamic lexicographic reduction propagator */ 55 56 /* 57 * Interface methods 58 */ 59 60 /** prints lexicographic reduction propagation data */ 61 SCIP_EXPORT 62 SCIP_RETCODE SCIPlexicographicReductionGetStatistics( 63 SCIP* scip, /**< SCIP data structure */ 64 SCIP_LEXREDDATA* masterdata, /**< pointer to global data for lexicographic reduction propagator */ 65 int* nred, /**< total number of reductions applied */ 66 int* ncutoff /**< total number of cutoffs applied */ 67 ); 68 69 70 /** prints lexicographic reduction propagation data */ 71 SCIP_EXPORT 72 SCIP_RETCODE SCIPlexicographicReductionPrintStatistics( 73 SCIP* scip, /**< SCIP data structure */ 74 SCIP_LEXREDDATA* masterdata /**< pointer to global data for lexicographic reduction propagator */ 75 ); 76 77 78 /** applies lexicographic reduction propagation */ 79 SCIP_EXPORT 80 SCIP_RETCODE SCIPlexicographicReductionPropagate( 81 SCIP* scip, /**< SCIP data structure */ 82 SCIP_LEXREDDATA* masterdata, /**< pointer to global data for lexicographic reduction propagator */ 83 SCIP_Bool* infeasible, /**< pointer to store whether infeasibility is found */ 84 int* nred, /**< pointer to store the number of domain reductions */ 85 SCIP_Bool* didrun /**< a global pointer maintaining if any symmetry propagator has run 86 * only set this to TRUE when a reduction is found, never set to FALSE */ 87 ); 88 89 /** adds permutation for lexicographic reduction propagation */ 90 SCIP_EXPORT 91 SCIP_RETCODE SCIPlexicographicReductionAddPermutation( 92 SCIP* scip, /**< SCIP data structure */ 93 SCIP_LEXREDDATA* masterdata, /**< pointer to global data for lexicographic reduction propagator */ 94 SCIP_VAR** permvars, /**< variable array of the permutation */ 95 int npermvars, /**< number of variables in that array */ 96 int* perm, /**< permutation */ 97 SYM_SYMTYPE symtype, /**< type of symmetries in perm */ 98 SCIP_Real* permvardomaincenter, /**< array containing center point for each variable domain */ 99 SCIP_Bool usedynamicorder, /**< whether a dynamic variable order shall be used */ 100 SCIP_Bool* success /**< to store whether the component is successfully added */ 101 ); 102 103 /** resets lexicographic reduction propagation (removes all permutations) */ 104 SCIP_EXPORT 105 SCIP_RETCODE SCIPlexicographicReductionReset( 106 SCIP* scip, /**< SCIP data structure */ 107 SCIP_LEXREDDATA* masterdata /**< pointer to global data for lexicographic reduction propagator */ 108 ); 109 110 111 /** frees lexicographic reduction data */ 112 SCIP_EXPORT 113 SCIP_RETCODE SCIPlexicographicReductionFree( 114 SCIP* scip, /**< SCIP data structure */ 115 SCIP_LEXREDDATA** masterdata /**< pointer to global data for lexicographic reduction propagator */ 116 ); 117 118 119 /** initializes structures needed for lexicographic reduction propagation 120 * 121 * This is only done exactly once. 122 */ 123 SCIP_EXPORT 124 SCIP_RETCODE SCIPincludeLexicographicReduction( 125 SCIP* scip, /**< SCIP data structure */ 126 SCIP_LEXREDDATA** masterdata, /**< pointer to global data for lexicographic reduction propagator */ 127 SCIP_EVENTHDLR* shadowtreeeventhdlr /**< pointer to the shadow tree eventhdlr */ 128 ); 129 130 #ifdef __cplusplus 131 } 132 #endif 133 134 #endif 135