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 cons_countsols.h 26 * @ingroup CONSHDLRS 27 * @brief Constraint handler for counting feasible solutions 28 * @author Stefan Heinz 29 * @author Michael Winkler 30 * 31 */ 32 33 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/ 34 35 #ifndef __SCIP_CONS_COUNTSOLS_H__ 36 #define __SCIP_CONS_COUNTSOLS_H__ 37 38 #include "scip/def.h" 39 #include "scip/type_dialog.h" 40 #include "scip/type_misc.h" 41 #include "scip/type_retcode.h" 42 #include "scip/type_scip.h" 43 #include "scip/type_var.h" 44 45 #ifdef __cplusplus 46 extern "C" { 47 #endif 48 49 /** creates the handler for countsol constraints and includes it in SCIP 50 * 51 * @ingroup ConshdlrIncludes 52 * */ 53 SCIP_EXPORT 54 SCIP_RETCODE SCIPincludeConshdlrCountsols( 55 SCIP* scip /**< SCIP data structure */ 56 ); 57 58 /**@addtogroup CONSHDLRS 59 * 60 * @{ 61 * 62 * @name Constraint Handler for counting solutions 63 * 64 * @{ 65 * 66 * If this constraint handler is activated than it counts or collects all feasible solutions. We refer to \ref COUNTER for 67 * more details about using SCIP for counting feasible solutions. 68 */ 69 70 /** dialog execution method for the count command */ 71 SCIP_EXPORT 72 SCIP_DECL_DIALOGEXEC(SCIPdialogExecCountPresolve); 73 74 /** dialog execution method for the count command */ 75 SCIP_EXPORT 76 SCIP_DECL_DIALOGEXEC(SCIPdialogExecCount); 77 78 /** execution method of dialog for writing all solutions */ 79 SCIP_EXPORT 80 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteAllsolutions); 81 82 /** execute counting */ 83 SCIP_EXPORT 84 SCIP_RETCODE SCIPcount( 85 SCIP* scip /**< SCIP data structure */ 86 ); 87 88 /** returns number of feasible solutions found as SCIP_Longint; if the number does not fit into 89 * a SCIP_Longint the valid flag is set to FALSE 90 */ 91 SCIP_EXPORT 92 SCIP_Longint SCIPgetNCountedSols( 93 SCIP* scip, /**< SCIP data structure */ 94 SCIP_Bool* valid /**< pointer to store if the return value is valid */ 95 ); 96 97 /** returns number of counted solutions as string */ 98 SCIP_EXPORT 99 void SCIPgetNCountedSolsstr( 100 SCIP* scip, /**< SCIP data structure */ 101 char** buffer, /**< buffer to store the number for counted solutions */ 102 int buffersize, /**< buffer size */ 103 int* requiredsize /**< pointer to store the required size */ 104 ); 105 106 /** returns number of counted feasible subtrees */ 107 SCIP_EXPORT 108 SCIP_Longint SCIPgetNCountedFeasSubtrees( 109 SCIP* scip /**< SCIP data structure */ 110 ); 111 112 /** Method to get the sparse solution. 113 * 114 * @note You get the pointer to the sparse solutions stored in the constraint handler (not a copy). 115 * 116 * @note The sparse solutions are stored w.r.t. the active variables. This are the variables which got not removed 117 * during presolving. For none active variables the value has to be computed depending on their aggregation 118 * type. See for more details about that \ref COLLECTALLFEASEBLES. 119 */ 120 SCIP_EXPORT 121 void SCIPgetCountedSparseSols( 122 SCIP* scip, /**< SCIP data structure */ 123 SCIP_VAR*** vars, /**< pointer to variable array defining to variable order */ 124 int* nvars, /**< number of variables */ 125 SCIP_SPARSESOL*** sols, /**< pointer to the solutions */ 126 int* nsols /**< pointer to number of solutions */ 127 ); 128 129 /** setting SCIP parameters for such that a valid counting process is possible */ 130 SCIP_EXPORT 131 SCIP_RETCODE SCIPsetParamsCountsols( 132 SCIP* scip /**< SCIP data structure */ 133 ); 134 135 /** @} */ 136 137 /** @} */ 138 139 #ifdef __cplusplus 140 } 141 #endif 142 143 #endif 144