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   conflictstore.h
26   	 * @ingroup INTERNALAPI
27   	 * @brief  internal methods for storing conflicts
28   	 * @author Jakob Witzig
29   	 */
30   	
31   	/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
32   	
33   	#ifndef __SCIP_CONFLICTSTORE_H__
34   	#define __SCIP_CONFLICTSTORE_H__
35   	
36   	
37   	#include "scip/def.h"
38   	#include "blockmemshell/memory.h"
39   	#include "scip/type_conflictstore.h"
40   	#include "scip/type_retcode.h"
41   	#include "scip/type_cons.h"
42   	#include "scip/type_event.h"
43   	#include "scip/type_conflict.h"
44   	#include "scip/type_prob.h"
45   	#include "scip/type_reopt.h"
46   	#include "scip/type_set.h"
47   	#include "scip/type_stat.h"
48   	#include "scip/type_tree.h"
49   	
50   	#ifdef __cplusplus
51   	extern "C" {
52   	#endif
53   	
54   	/** creates separation storage */
55   	SCIP_RETCODE SCIPconflictstoreCreate(
56   	   SCIP_CONFLICTSTORE**  conflictstore,      /**< pointer to store conflict store */
57   	   SCIP_SET*             set                 /**< global SCIP settings */
58   	   );
59   	
60   	/** frees separation storage */
61   	SCIP_RETCODE SCIPconflictstoreFree(
62   	   SCIP_CONFLICTSTORE**  conflictstore,      /**< pointer to store conflict store */
63   	   BMS_BLKMEM*           blkmem,             /**< block memory */
64   	   SCIP_SET*             set,                /**< global SCIP settings */
65   	   SCIP_STAT*            stat,               /**< dynamic SCIP statistics */
66   	   SCIP_REOPT*           reopt               /**< reoptimization data */
67   	   );
68   	
69   	/** clears conflict store */
70   	SCIP_RETCODE SCIPconflictstoreClear(
71   	   SCIP_CONFLICTSTORE*   conflictstore,      /**< conflict store */
72   	   BMS_BLKMEM*           blkmem,             /**< block memory */
73   	   SCIP_SET*             set,                /**< global SCIP settings */
74   	   SCIP_STAT*            stat,               /**< dynamic SCIP statistics */
75   	   SCIP_REOPT*           reopt               /**< reoptimization data */
76   	   );
77   	
78   	/** cleans up conflict store */
79   	SCIP_RETCODE SCIPconflictstoreClean(
80   	   SCIP_CONFLICTSTORE*   conflictstore,      /**< conflict store */
81   	   BMS_BLKMEM*           blkmem,             /**< block memory */
82   	   SCIP_SET*             set,                /**< global SCIP settings */
83   	   SCIP_STAT*            stat,               /**< dynamic SCIP statistics */
84   	   SCIP_PROB*            transprob,          /**< transformed problem */
85   	   SCIP_REOPT*           reopt               /**< reoptimization data */
86   	   );
87   	
88   	/** adds a constraint to the pool of proof constraints based on dual rays
89   	 *
90   	 *  @note this methods captures the constraint
91   	 */
92   	SCIP_RETCODE SCIPconflictstoreAddDualraycons(
93   	   SCIP_CONFLICTSTORE*   conflictstore,      /**< conflict store */
94   	   SCIP_CONS*            dualproof,          /**< constraint based on a dual ray */
95   	   BMS_BLKMEM*           blkmem,             /**< block memory */
96   	   SCIP_SET*             set,                /**< global SCIP settings */
97   	   SCIP_STAT*            stat,               /**< dynamic SCIP statistics */
98   	   SCIP_PROB*            transprob,          /**< transformed problem */
99   	   SCIP_REOPT*           reopt,              /**< reoptimization data */
100  	   SCIP_Bool             hasrelaxvar         /**< does the dual proof contain at least one variable that exists in
101  	                                               *  the current relaxation only? */
102  	   );
103  	
104  	/** adds a constraint to the pool of proof constraints based on dual solutions
105  	 *
106  	 *  @note this methods captures the constraint
107  	 */
108  	SCIP_RETCODE SCIPconflictstoreAddDualsolcons(
109  	   SCIP_CONFLICTSTORE*   conflictstore,      /**< conflict store */
110  	   SCIP_CONS*            dualproof,          /**< constraint based on a dual solution */
111  	   BMS_BLKMEM*           blkmem,             /**< block memory */
112  	   SCIP_SET*             set,                /**< global SCIP settings */
113  	   SCIP_STAT*            stat,               /**< dynamic SCIP statistics */
114  	   SCIP_PROB*            transprob,          /**< transformed problem */
115  	   SCIP_REOPT*           reopt,              /**< reoptimization data */
116  	   SCIP_Real             scale,              /**< scaling factor that needs to be considered when updating the side */
117  	   SCIP_Bool             updateside,         /**< should the side be updated if a new incumbent is found */
118  	   SCIP_Bool             hasrelaxvar         /**< does the dual proof contain at least one variable that exists in
119  	                                               *  the current relaxation only? */
120  	   );
121  	
122  	/** adds a conflict to the conflict store
123  	 *
124  	 *  @note this method captures the constraint
125  	 */
126  	SCIP_RETCODE SCIPconflictstoreAddConflict(
127  	   SCIP_CONFLICTSTORE*   conflictstore,      /**< conflict store */
128  	   BMS_BLKMEM*           blkmem,             /**< block memory */
129  	   SCIP_SET*             set,                /**< global SCIP settings */
130  	   SCIP_STAT*            stat,               /**< dynamic SCIP statistics */
131  	   SCIP_TREE*            tree,               /**< branch and bound tree (or NULL for an original constraint) */
132  	   SCIP_PROB*            transprob,          /**< transformed problem (or NULL for an original constraint) */
133  	   SCIP_REOPT*           reopt,              /**< reoptimization data */
134  	   SCIP_CONS*            cons,               /**< constraint representing the conflict */
135  	   SCIP_CONFTYPE         conftype,           /**< type of the conflict */
136  	   SCIP_Bool             cutoffinvolved,     /**< is a cutoff bound involved in this conflict */
137  	   SCIP_Real             primalbound         /**< primal bound the conflict depend on (or -SCIPinfinity) */
138  	   );
139  	
140  	/** deletes all conflicts depending on a cutoff bound larger than the given bound */
141  	SCIP_RETCODE SCIPconflictstoreCleanNewIncumbent(
142  	   SCIP_CONFLICTSTORE*   conflictstore,      /**< conflict store */
143  	   SCIP_SET*             set,                /**< global SCIP settings */
144  	   SCIP_STAT*            stat,               /**< dynamic SCIP statistics */
145  	   BMS_BLKMEM*           blkmem,             /**< block memory */
146  	   SCIP_PROB*            transprob,          /**< transformed problem*/
147  	   SCIP_REOPT*           reopt,              /**< reoptimization data */
148  	   SCIP_Real             cutoffbound         /**< current cutoff bound */
149  	   );
150  	
151  	/** returns the maximal size of the conflict pool */
152  	int SCIPconflictstoreGetMaxPoolSize(
153  	   SCIP_CONFLICTSTORE*   conflictstore       /**< conflict store */
154  	   );
155  	
156  	/** returns the initial size of the conflict pool */
157  	int SCIPconflictstoreGetInitPoolSize(
158  	   SCIP_CONFLICTSTORE*   conflictstore       /**< conflict store */
159  	   );
160  	
161  	/** returns the number of stored conflicts on the conflict pool
162  	 *
163  	 *  @note the number of active conflicts can be less
164  	 */
165  	int SCIPconflictstoreGetNConflictsInStore(
166  	   SCIP_CONFLICTSTORE*   conflictstore       /**< conflict store */
167  	   );
168  	
169  	/** returns all active conflicts stored in the conflict store */
170  	SCIP_RETCODE SCIPconflictstoreGetConflicts(
171  	   SCIP_CONFLICTSTORE*   conflictstore,      /**< conflict store */
172  	   SCIP_CONS**           conflicts,          /**< array to store conflicts */
173  	   int                   conflictsize,       /**< size of the conflict array */
174  	   int*                  nconflicts          /**< pointer to store the number of conflicts */
175  	   );
176  	
177  	/** transforms all original conflicts into transformed conflicts */
178  	SCIP_RETCODE SCIPconflictstoreTransform(
179  	   SCIP_CONFLICTSTORE*   conflictstore,      /**< conflict store */
180  	   BMS_BLKMEM*           blkmem,             /**< block memory */
181  	   SCIP_SET*             set,                /**< global SCIP settings */
182  	   SCIP_STAT*            stat,               /**< dynamic SCIP statistics */
183  	   SCIP_TREE*            tree,               /**< branch and bound tree */
184  	   SCIP_PROB*            transprob,          /**< transformed problem */
185  	   SCIP_REOPT*           reopt               /**< reoptimization data */
186  	   );
187  	
188  	/** returns the average number of non-zeros over all stored dual ray constraints */
189  	SCIP_Real SCIPconflictstoreGetAvgNnzDualInfProofs(
190  	   SCIP_CONFLICTSTORE*   conflictstore       /**< conflict store */
191  	   );
192  	
193  	/** return the number of stored dualray constraints */
194  	int SCIPconflictstoreGetNDualInfProofs(
195  	   SCIP_CONFLICTSTORE*   conflictstore       /**< conflict store */
196  	   );
197  	
198  	/** returns the average number of non-zeros over all stored boundexceeding proofs */
199  	SCIP_Real SCIPconflictstoreGetAvgNnzDualBndProofs(
200  	   SCIP_CONFLICTSTORE*   conflictstore       /**< conflict store */
201  	   );
202  	
203  	/** returns the number of all stored boundexceeding proofs */
204  	int SCIPconflictstoreGetNDualBndProofs(
205  	   SCIP_CONFLICTSTORE*   conflictstore       /**< conflict store */
206  	   );
207  	
208  	#ifdef __cplusplus
209  	}
210  	#endif
211  	
212  	#endif
213