Scippy

SCIP

Solving Constraint Integer Programs

scip_copy.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-2019 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not visit scip.zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file scip_copy.h
17  * @ingroup PUBLICCOREAPI
18  * @brief public methods for problem copies
19  * @author Tobias Achterberg
20  * @author Timo Berthold
21  * @author Thorsten Koch
22  * @author Alexander Martin
23  * @author Marc Pfetsch
24  * @author Kati Wolter
25  * @author Gregor Hendel
26  * @author Robert Lion Gottwald
27  */
28 
29 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
30 
31 #ifndef __SCIP_SCIP_COPY_H__
32 #define __SCIP_SCIP_COPY_H__
33 
34 
35 #include "scip/def.h"
36 #include "scip/type_cons.h"
37 #include "scip/type_misc.h"
38 #include "scip/type_retcode.h"
39 #include "scip/type_scip.h"
40 #include "scip/type_var.h"
41 
42 /* In debug mode, we include the SCIP's structure in scip.c, such that no one can access
43  * this structure except the interface methods in scip.c.
44  * In optimized mode, the structure is included in scip.h, because some of the methods
45  * are implemented as defines for performance reasons (e.g. the numerical comparisons).
46  * Additionally, the internal "set.h" is included, such that the defines in set.h are
47  * available in optimized mode.
48  */
49 #ifdef NDEBUG
50 #include "scip/struct_scip.h"
51 #include "scip/struct_stat.h"
52 #include "scip/set.h"
53 #include "scip/tree.h"
54 #include "scip/misc.h"
55 #include "scip/var.h"
56 #include "scip/cons.h"
57 #include "scip/solve.h"
58 #include "scip/debug.h"
59 #endif
60 
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64 
65 /**@addtogroup CopyMethods
66  *
67  * @{
68  */
69 
70 /** copies plugins from sourcescip to targetscip; in case that a constraint handler which does not need constraints
71  * cannot be copied, valid will return FALSE. All plugins can declare that, if their copy process failed, the
72  * copied SCIP instance might not represent the same problem semantics as the original.
73  * Note that in this case dual reductions might be invalid.
74  *
75  * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
76  * Also, 'passmessagehdlr' should be set to FALSE.
77  *
78  * @note Do not change the source SCIP environment during the copying process.
79  *
80  * @note This method does not copy Benders' plugins. To this end, the method SCIPcopyBenders() must be called
81  * separately.
82  *
83  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
84  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
85  *
86  * @pre This method can be called if sourcescip is in one of the following stages:
87  * - \ref SCIP_STAGE_PROBLEM
88  * - \ref SCIP_STAGE_TRANSFORMED
89  * - \ref SCIP_STAGE_INITPRESOLVE
90  * - \ref SCIP_STAGE_PRESOLVING
91  * - \ref SCIP_STAGE_EXITPRESOLVE
92  * - \ref SCIP_STAGE_PRESOLVED
93  * - \ref SCIP_STAGE_INITSOLVE
94  * - \ref SCIP_STAGE_SOLVING
95  * - \ref SCIP_STAGE_SOLVED
96  *
97  * @pre This method can be called if targetscip is in one of the following stages:
98  * - \ref SCIP_STAGE_INIT
99  * - \ref SCIP_STAGE_FREE
100  *
101  * @post After calling this method targetscip reaches one of the following stages depending on if and when the solution
102  * process was interrupted:
103  * - \ref SCIP_STAGE_PROBLEM
104  *
105  * @note sourcescip stage does not get changed
106  *
107  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
108  */
109 extern
111  SCIP* sourcescip, /**< source SCIP data structure */
112  SCIP* targetscip, /**< target SCIP data structure */
113  SCIP_Bool copyreaders, /**< should the file readers be copied */
114  SCIP_Bool copypricers, /**< should the variable pricers be copied */
115  SCIP_Bool copyconshdlrs, /**< should the constraint handlers be copied */
116  SCIP_Bool copyconflicthdlrs, /**< should the conflict handlers be copied */
117  SCIP_Bool copypresolvers, /**< should the presolvers be copied */
118  SCIP_Bool copyrelaxators, /**< should the relaxation handler be copied */
119  SCIP_Bool copyseparators, /**< should the separators be copied */
120  SCIP_Bool copypropagators, /**< should the propagators be copied */
121  SCIP_Bool copyheuristics, /**< should the heuristics be copied */
122  SCIP_Bool copyeventhdlrs, /**< should the event handlers be copied */
123  SCIP_Bool copynodeselectors, /**< should the node selectors be copied */
124  SCIP_Bool copybranchrules, /**< should the branchrules be copied */
125  SCIP_Bool copydisplays, /**< should the display columns be copied */
126  SCIP_Bool copydialogs, /**< should the dialogs be copied */
127  SCIP_Bool copytables, /**< should the statistics tables be copied */
128  SCIP_Bool copynlpis, /**< should the NLPIs be copied */
129  SCIP_Bool passmessagehdlr, /**< should the message handler be passed */
130  SCIP_Bool* valid /**< pointer to store whether plugins, in particular all constraint
131  * handlers which do not need constraints were validly copied */
132  );
133 
134 /** copies all Benders' decomposition plugins
135  *
136  * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
137  *
138  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
139  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
140  *
141  * @pre This method can be called if sourcescip is in one of the following stages:
142  * - \ref SCIP_STAGE_PROBLEM
143  * - \ref SCIP_STAGE_TRANSFORMED
144  * - \ref SCIP_STAGE_INITPRESOLVE
145  * - \ref SCIP_STAGE_PRESOLVING
146  * - \ref SCIP_STAGE_EXITPRESOLVE
147  * - \ref SCIP_STAGE_PRESOLVED
148  * - \ref SCIP_STAGE_INITSOLVE
149  * - \ref SCIP_STAGE_SOLVING
150  * - \ref SCIP_STAGE_SOLVED
151  *
152  * @pre This method can be called if targetscip is in one of the following stages:
153  * - \ref SCIP_STAGE_INIT
154  * - \ref SCIP_STAGE_FREE
155  *
156  * @post After calling this method targetscip reaches one of the following stages depending on if and when the solution
157  * process was interrupted:
158  * - \ref SCIP_STAGE_PROBLEM
159  *
160  * @note sourcescip stage does not get changed
161  *
162  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
163  */
164 extern
166  SCIP* sourcescip, /**< source SCIP data structure */
167  SCIP* targetscip, /**< target SCIP data structure */
168  SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables corresponding
169  * target variables; must not be NULL */
170  SCIP_Bool* valid /**< pointer to store whether all plugins were validly copied */
171  );
172 
173 /** create a problem by copying the problem data of the source SCIP
174  *
175  * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
176  * @note Do not change the source SCIP environment during the copying process
177  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
178  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
179  *
180  * @pre This method can be called if sourcescip is in one of the following stages:
181  * - \ref SCIP_STAGE_PROBLEM
182  * - \ref SCIP_STAGE_TRANSFORMED
183  * - \ref SCIP_STAGE_INITPRESOLVE
184  * - \ref SCIP_STAGE_PRESOLVING
185  * - \ref SCIP_STAGE_EXITPRESOLVE
186  * - \ref SCIP_STAGE_PRESOLVED
187  * - \ref SCIP_STAGE_INITSOLVE
188  * - \ref SCIP_STAGE_SOLVING
189  * - \ref SCIP_STAGE_SOLVED
190  *
191  * @pre This method can be called if targetscip is in one of the following stages:
192  * - \ref SCIP_STAGE_INIT
193  * - \ref SCIP_STAGE_PROBLEM
194  * - \ref SCIP_STAGE_TRANSFORMED
195  * - \ref SCIP_STAGE_INITPRESOLVE
196  * - \ref SCIP_STAGE_PRESOLVING
197  * - \ref SCIP_STAGE_EXITPRESOLVE
198  * - \ref SCIP_STAGE_PRESOLVED
199  * - \ref SCIP_STAGE_INITSOLVE
200  * - \ref SCIP_STAGE_SOLVING
201  * - \ref SCIP_STAGE_SOLVED
202  * - \ref SCIP_STAGE_FREE
203  *
204  * @post After calling this method targetscip reaches one of the following stages depending on if and when the solution
205  * process was interrupted:
206  * - \ref SCIP_STAGE_PROBLEM
207  *
208  * @note sourcescip stage does not get changed
209  *
210  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
211  */
212 extern
214  SCIP* sourcescip, /**< source SCIP data structure */
215  SCIP* targetscip, /**< target SCIP data structure */
216  SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables corresponding
217  * target variables, or NULL */
218  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
219  * target constraints, or NULL */
220  SCIP_Bool global, /**< create a global or a local copy? */
221  const char* name /**< problem name */
222  );
223 
224 /** create a problem by copying the original problem data of the source SCIP
225  *
226  * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
227  * @note Do not change the source SCIP environment during the copying process
228  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
229  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
230  *
231  * @pre This method can be called if sourcescip is in one of the following stages:
232  * - \ref SCIP_STAGE_PROBLEM
233  * - \ref SCIP_STAGE_TRANSFORMED
234  * - \ref SCIP_STAGE_INITPRESOLVE
235  * - \ref SCIP_STAGE_PRESOLVING
236  * - \ref SCIP_STAGE_EXITPRESOLVE
237  * - \ref SCIP_STAGE_PRESOLVED
238  * - \ref SCIP_STAGE_INITSOLVE
239  * - \ref SCIP_STAGE_SOLVING
240  * - \ref SCIP_STAGE_SOLVED
241  *
242  * @pre This method can be called if targetscip is in one of the following stages:
243  * - \ref SCIP_STAGE_INIT
244  * - \ref SCIP_STAGE_FREE
245  *
246  * @post After calling this method targetscip reaches one of the following stages depending on if and when the solution
247  * process was interrupted:
248  * - \ref SCIP_STAGE_PROBLEM
249  *
250  * @note sourcescip stage does not get changed
251  *
252  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
253  */
254 extern
256  SCIP* sourcescip, /**< source SCIP data structure */
257  SCIP* targetscip, /**< target SCIP data structure */
258  SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables corresponding
259  * target variables, or NULL */
260  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
261  * target constraints, or NULL */
262  const char* name /**< problem name of target */
263  );
264 
265 /** enables constraint compression.
266  *
267  * If constraint compression is enabled, fixed variables will be treated as constants
268  * by all constraints that are copied after calling this method.
269  *
270  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
271  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
272  *
273  * @pre This method can be called if scip is in one of the following stages:
274  * - \ref SCIP_STAGE_PROBLEM
275  *
276  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
277  */
278 extern
280  SCIP* scip /**< source SCIP data structure */
281  );
282 
283 /** is constraint compression enabled?
284  *
285  * If constraint compression is enabled, fixed variables can be treated as constants
286  * by all constraints that are copied after calling this method.
287  *
288  * @return TRUE if problem constraint compression is enabled, otherwise FALSE
289  *
290  * @pre This method can be called if scip is in one of the following stages:
291  * - \ref SCIP_STAGE_PROBLEM
292  * - \ref SCIP_STAGE_TRANSFORMING
293  * - \ref SCIP_STAGE_TRANSFORMED
294  * - \ref SCIP_STAGE_INITPRESOLVE
295  * - \ref SCIP_STAGE_PRESOLVING
296  * - \ref SCIP_STAGE_EXITPRESOLVE
297  * - \ref SCIP_STAGE_PRESOLVED
298  * - \ref SCIP_STAGE_INITSOLVE
299  * - \ref SCIP_STAGE_SOLVING
300  * - \ref SCIP_STAGE_SOLVED
301  * - \ref SCIP_STAGE_EXITSOLVE
302  * - \ref SCIP_STAGE_FREETRANS
303  *
304  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
305  */
306 extern
308  SCIP* scip /**< source SCIP data structure */
309  );
310 
311 /** returns copy of the source variable; if there already is a copy of the source variable in the variable hash map,
312  * it is just returned as target variable; elsewise a new variable will be created and added to the target SCIP; this
313  * created variable is added to the variable hash map and returned as target variable
314  *
315  * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
316  * @note Do not change the source SCIP environment during the copying process
317  * @note if a new variable was created, this variable will be added to the target-SCIP, but it is not captured
318  *
319  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
320  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
321  *
322  * @pre This method can be called if sourcescip is in one of the following stages:
323  * - \ref SCIP_STAGE_PROBLEM
324  * - \ref SCIP_STAGE_TRANSFORMED
325  * - \ref SCIP_STAGE_INITPRESOLVE
326  * - \ref SCIP_STAGE_PRESOLVING
327  * - \ref SCIP_STAGE_EXITPRESOLVE
328  * - \ref SCIP_STAGE_PRESOLVED
329  * - \ref SCIP_STAGE_INITSOLVE
330  * - \ref SCIP_STAGE_SOLVING
331  * - \ref SCIP_STAGE_SOLVED
332  *
333  * @pre This method can be called if targetscip is in one of the following stages:
334  * - \ref SCIP_STAGE_PROBLEM
335  * - \ref SCIP_STAGE_TRANSFORMED
336  * - \ref SCIP_STAGE_INITPRESOLVE
337  * - \ref SCIP_STAGE_PRESOLVING
338  * - \ref SCIP_STAGE_EXITPRESOLVE
339  * - \ref SCIP_STAGE_SOLVING
340  *
341  * @note targetscip stage does not get changed
342  *
343  * @note sourcescip stage does not get changed
344  *
345  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
346  */
347 extern
349  SCIP* sourcescip, /**< source SCIP data structure */
350  SCIP* targetscip, /**< target SCIP data structure */
351  SCIP_VAR* sourcevar, /**< source variable */
352  SCIP_VAR** targetvar, /**< pointer to store the target variable */
353  SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables to the corresponding
354  * target variables, or NULL */
355  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
356  * target constraints, or NULL */
357  SCIP_Bool global, /**< should global or local bounds be used? */
358  SCIP_Bool* success /**< pointer to store whether the copying was successful or not */
359  );
360 
361 /** copies all active variables from source-SCIP and adds these variable to the target-SCIP; the mapping between these
362  * variables are stored in the variable hashmap, target-SCIP has to be in problem creation stage, fixed and aggregated
363  * variables do not get copied
364  *
365  * @note the variables are added to the target-SCIP but not captured
366  *
367  * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
368  * @note Do not change the source SCIP environment during the copying process
369  *
370  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
371  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
372  *
373  * @pre This method can be called if sourcescip is in one of the following stages:
374  * - \ref SCIP_STAGE_PROBLEM
375  * - \ref SCIP_STAGE_TRANSFORMED
376  * - \ref SCIP_STAGE_INITPRESOLVE
377  * - \ref SCIP_STAGE_PRESOLVING
378  * - \ref SCIP_STAGE_EXITPRESOLVE
379  * - \ref SCIP_STAGE_PRESOLVED
380  * - \ref SCIP_STAGE_INITSOLVE
381  * - \ref SCIP_STAGE_SOLVING
382  * - \ref SCIP_STAGE_SOLVED
383  *
384  * @pre This method can be called if targetscip is in one of the following stages:
385  * - \ref SCIP_STAGE_PROBLEM
386  *
387  * @note sourcescip stage does not get changed
388  *
389  * @note targetscip stage does not get changed
390  *
391  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
392  */
393 extern
395  SCIP* sourcescip, /**< source SCIP data structure */
396  SCIP* targetscip, /**< target SCIP data structure */
397  SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables to the corresponding
398  * target variables, or NULL */
399  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
400  * target constraints, or NULL */
401  SCIP_VAR** fixedvars, /**< source variables whose copies should be fixed in the target SCIP environment, or NULL */
402  SCIP_Real* fixedvals, /**< array of fixing values for target SCIP variables, or NULL */
403  int nfixedvars, /**< number of source variables whose copies should be fixed in the target SCIP environment, or NULL */
404  SCIP_Bool global /**< should global or local bounds be used? */
405  );
406 
407 /** copies all original variables from source-SCIP and adds these variable to the target-SCIP; the mapping between these
408  * variables are stored in the variable hashmap, target-SCIP has to be in problem creation stage, fixed and aggregated
409  * variables do not get copied
410  *
411  * @note the variables are added to the target-SCIP but not captured
412  *
413  * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
414  * @note Do not change the source SCIP environment during the copying process
415  *
416  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
417  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
418  *
419  * @pre This method can be called if sourcescip is in one of the following stages:
420  * - \ref SCIP_STAGE_PROBLEM
421  * - \ref SCIP_STAGE_TRANSFORMED
422  * - \ref SCIP_STAGE_INITPRESOLVE
423  * - \ref SCIP_STAGE_PRESOLVING
424  * - \ref SCIP_STAGE_EXITPRESOLVE
425  * - \ref SCIP_STAGE_PRESOLVED
426  * - \ref SCIP_STAGE_INITSOLVE
427  * - \ref SCIP_STAGE_SOLVING
428  * - \ref SCIP_STAGE_SOLVED
429  *
430  * @pre This method can be called if targetscip is in one of the following stages:
431  * - \ref SCIP_STAGE_PROBLEM
432  *
433  * @note sourcescip stage does not get changed
434  *
435  * @note targetscip stage does not get changed
436  *
437  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
438  */
439 extern
441  SCIP* sourcescip, /**< source SCIP data structure */
442  SCIP* targetscip, /**< target SCIP data structure */
443  SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables to the corresponding
444  * target variables, or NULL */
445  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
446  * target constraints, or NULL */
447  SCIP_VAR** fixedvars, /**< source variables whose copies should be fixed in the target SCIP environment, or NULL */
448  SCIP_Real* fixedvals, /**< array of fixing values for target SCIP variables, or NULL */
449  int nfixedvars /**< number of source variables whose copies should be fixed in the target SCIP environment, or NULL */
450  );
451 
452 /** merges the histories of variables from a source SCIP into a target SCIP. The two data structures should point to
453  * different SCIP instances.
454  *
455  * @note the notion of source and target is inverted here; \p sourcescip usually denotes a copied SCIP instance, whereas
456  * \p targetscip denotes the original instance
457  */
458 
459 extern
461  SCIP* sourcescip, /**< source SCIP data structure */
462  SCIP* targetscip, /**< target SCIP data structure */
463  SCIP_VAR** sourcevars, /**< source variables for history merge */
464  SCIP_VAR** targetvars, /**< target variables for history merge */
465  int nvars /**< number of variables in both variable arrays */
466  );
467 
468 /** returns copy of the source constraint; if there already is a copy of the source constraint in the constraint hash
469  * map, it is just returned as target constraint; elsewise a new constraint will be created; this created constraint is
470  * added to the constraint hash map and returned as target constraint; the variable map is used to map the variables of
471  * the source SCIP to the variables of the target SCIP
472  *
473  * @warning If a constraint is marked to be checked for feasibility but not to be enforced, a LP or pseudo solution may
474  * be declared feasible even if it violates this particular constraint. This constellation should only be
475  * used, if no LP or pseudo solution can violate the constraint -- e.g. if a local constraint is redundant due
476  * to the variable's local bounds.
477  *
478  * @note The constraint is not added to the target SCIP. You can check whether a constraint is added by calling
479  * SCIPconsIsAdded(). (If you mix SCIPgetConsCopy() with SCIPcopyConss() you should pay attention to what you add
480  * explicitly and what is already added.)
481  *
482  * @note The constraint is always captured, either during the creation of the copy or after finding the copy of the
483  * constraint in the constraint hash map
484  *
485  * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
486  * @note Do not change the source SCIP environment during the copying process
487  *
488  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
489  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
490  *
491  * @pre This method can be called if sourcescip is in one of the following stages:
492  * - \ref SCIP_STAGE_PROBLEM
493  * - \ref SCIP_STAGE_TRANSFORMED
494  * - \ref SCIP_STAGE_INITPRESOLVE
495  * - \ref SCIP_STAGE_PRESOLVING
496  * - \ref SCIP_STAGE_EXITPRESOLVE
497  * - \ref SCIP_STAGE_PRESOLVED
498  * - \ref SCIP_STAGE_INITSOLVE
499  * - \ref SCIP_STAGE_SOLVING
500  * - \ref SCIP_STAGE_SOLVED
501  *
502  * @pre This method can be called if targetscip is in one of the following stages:
503  * - \ref SCIP_STAGE_PROBLEM
504  * - \ref SCIP_STAGE_TRANSFORMING
505  * - \ref SCIP_STAGE_INITPRESOLVE
506  * - \ref SCIP_STAGE_PRESOLVING
507  * - \ref SCIP_STAGE_EXITPRESOLVE
508  * - \ref SCIP_STAGE_PRESOLVED
509  * - \ref SCIP_STAGE_SOLVING
510  * - \ref SCIP_STAGE_EXITSOLVE
511  *
512  * @note sourcescip stage does not get changed
513  *
514  * @note targetscip stage does not get changed
515  *
516  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
517  */
518 extern
520  SCIP* sourcescip, /**< source SCIP data structure */
521  SCIP* targetscip, /**< target SCIP data structure */
522  SCIP_CONS* sourcecons, /**< source constraint of the source SCIP */
523  SCIP_CONS** targetcons, /**< pointer to store the created target constraint */
524  SCIP_CONSHDLR* sourceconshdlr, /**< source constraint handler for this constraint */
525  SCIP_HASHMAP* varmap, /**< a SCIP_HASHMAP mapping variables of the source SCIP to the corresponding
526  * variables of the target SCIP, or NULL */
527  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
528  * target constraints, or NULL */
529  const char* name, /**< name of constraint, or NULL if the name of the source constraint should be used */
530  SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP? */
531  SCIP_Bool separate, /**< should the constraint be separated during LP processing? */
532  SCIP_Bool enforce, /**< should the constraint be enforced during node processing? */
533  SCIP_Bool check, /**< should the constraint be checked for feasibility? */
534  SCIP_Bool propagate, /**< should the constraint be propagated during node processing? */
535  SCIP_Bool local, /**< is constraint only valid locally? */
536  SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)? */
537  SCIP_Bool dynamic, /**< is constraint subject to aging? */
538  SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup? */
539  SCIP_Bool stickingatnode, /**< should the constraint always be kept at the node where it was added, even
540  * if it may be moved to a more global node? */
541  SCIP_Bool global, /**< create a global or a local copy? */
542  SCIP_Bool* valid /**< pointer to store whether the copying was valid or not */
543  );
544 
545 /** copies constraints from the source-SCIP and adds these to the target-SCIP; for mapping the
546  * variables between the source and the target SCIP a hash map can be given; if the variable hash
547  * map is NULL or necessary variable mapping is missing, the required variables are created in the
548  * target-SCIP and added to the hash map, if not NULL; all variables which are created are added to
549  * the target-SCIP but not (user) captured; if the constraint hash map is not NULL the mapping
550  * between the constraints of the source and target-SCIP is stored
551  *
552  * @note the constraints are added to the target-SCIP but are not (user) captured in the target SCIP. (If you mix
553  * SCIPgetConsCopy() with SCIPcopyConss() you should pay attention to what you add explicitly and what is already
554  * added.) You can check whether a constraint is added by calling SCIPconsIsAdded().
555  *
556  * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
557  * @note Do not change the source SCIP environment during the copying process
558  *
559  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
560  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
561  *
562  * @pre This method can be called if sourcescip is in one of the following stages:
563  * - \ref SCIP_STAGE_PROBLEM
564  * - \ref SCIP_STAGE_TRANSFORMED
565  * - \ref SCIP_STAGE_INITPRESOLVE
566  * - \ref SCIP_STAGE_PRESOLVING
567  * - \ref SCIP_STAGE_EXITPRESOLVE
568  * - \ref SCIP_STAGE_PRESOLVED
569  * - \ref SCIP_STAGE_INITSOLVE
570  * - \ref SCIP_STAGE_SOLVING
571  * - \ref SCIP_STAGE_SOLVED
572  *
573  * @pre This method can be called if targetscip is in one of the following stages:
574  * - \ref SCIP_STAGE_PROBLEM
575  *
576  * @note sourcescip stage does not get changed
577  *
578  * @note targetscip stage does not get changed
579  *
580  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
581  */
582 extern
584  SCIP* sourcescip, /**< source SCIP data structure */
585  SCIP* targetscip, /**< target SCIP data structure */
586  SCIP_HASHMAP* varmap, /**< a SCIP_HASHMAP mapping variables of the source SCIP to the corresponding
587  * variables of the target SCIP, or NULL */
588  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
589  * target constraints, or NULL */
590  SCIP_Bool global, /**< create a global or a local copy? */
591  SCIP_Bool enablepricing, /**< should pricing be enabled in copied SCIP instance?
592  * If TRUE, the modifiable flag of constraints will be copied. */
593  SCIP_Bool* valid /**< pointer to store whether all constraints were validly copied */
594  );
595 
596 /** copies all original constraints from the source-SCIP and adds these to the target-SCIP; for mapping the
597  * variables between the source and the target SCIP a hash map can be given; if the variable hash
598  * map is NULL or necessary variable mapping is missing, the required variables are created in the
599  * target-SCIP and added to the hash map, if not NULL; all variables which are created are added to
600  * the target-SCIP but not (user) captured; if the constraint hash map is not NULL the mapping
601  * between the constraints of the source and target-SCIP is stored
602  *
603  * @note the constraints are added to the target-SCIP but are not (user) captured in the target SCIP. (If you mix
604  * SCIPgetConsCopy() with SCIPcopyConss() you should pay attention to what you add explicitly and what is already
605  * added.) You can check whether a constraint is added by calling SCIPconsIsAdded().
606  *
607  * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
608  * @note Do not change the source SCIP environment during the copying process
609  *
610  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
611  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
612  *
613  * @pre This method can be called if sourcescip is in one of the following stages:
614  * - \ref SCIP_STAGE_PROBLEM
615  * - \ref SCIP_STAGE_TRANSFORMED
616  * - \ref SCIP_STAGE_INITPRESOLVE
617  * - \ref SCIP_STAGE_PRESOLVING
618  * - \ref SCIP_STAGE_EXITPRESOLVE
619  * - \ref SCIP_STAGE_PRESOLVED
620  * - \ref SCIP_STAGE_INITSOLVE
621  * - \ref SCIP_STAGE_SOLVING
622  * - \ref SCIP_STAGE_SOLVED
623  *
624  * @pre This method can be called if targetscip is in one of the following stages:
625  * - \ref SCIP_STAGE_PROBLEM
626  *
627  * @note sourcescip stage does not get changed
628  *
629  * @note targetscip stage does not get changed
630  *
631  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
632  */
633 extern
635  SCIP* sourcescip, /**< source SCIP data structure */
636  SCIP* targetscip, /**< target SCIP data structure */
637  SCIP_HASHMAP* varmap, /**< a SCIP_HASHMAP mapping variables of the source SCIP to the corresponding
638  * variables of the target SCIP, or NULL */
639  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
640  * target constraints, or NULL */
641  SCIP_Bool enablepricing, /**< should pricing be enabled in copied SCIP instance?
642  * If TRUE, the modifiable flag of constraints will be copied. */
643  SCIP_Bool* valid /**< pointer to store whether all constraints were validly copied */
644  );
645 
646 /** convert all active cuts from cutpool to linear constraints
647  *
648  * @note Do not change the source SCIP environment during the copying process
649  *
650  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
651  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
652  *
653  * @pre This method can be called if SCIP is in one of the following stages:
654  * - \ref SCIP_STAGE_PROBLEM
655  * - \ref SCIP_STAGE_INITPRESOLVE
656  * - \ref SCIP_STAGE_PRESOLVING
657  * - \ref SCIP_STAGE_EXITPRESOLVE
658  * - \ref SCIP_STAGE_PRESOLVED
659  * - \ref SCIP_STAGE_SOLVING
660  * - \ref SCIP_STAGE_EXITSOLVE
661  *
662  * @note SCIP stage does not get changed
663  *
664  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
665  */
666 extern
668  SCIP* scip, /**< SCIP data structure */
669  SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables corresponding
670  * target variables, or NULL */
671  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
672  * target constraints, or NULL */
673  SCIP_Bool global, /**< create a global or a local copy? */
674  int* ncutsadded /**< pointer to store number of added cuts, or NULL */
675  );
676 
677 /** copies all active cuts from cutpool of sourcescip to linear constraints in targetscip
678  *
679  * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
680  * @note Do not change the source SCIP environment during the copying process
681  *
682  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
683  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
684  *
685  * @pre This method can be called if sourcescip is in one of the following stages:
686  * - \ref SCIP_STAGE_PROBLEM
687  * - \ref SCIP_STAGE_TRANSFORMED
688  * - \ref SCIP_STAGE_INITPRESOLVE
689  * - \ref SCIP_STAGE_PRESOLVING
690  * - \ref SCIP_STAGE_EXITPRESOLVE
691  * - \ref SCIP_STAGE_PRESOLVED
692  * - \ref SCIP_STAGE_SOLVING
693  * - \ref SCIP_STAGE_SOLVED
694  * - \ref SCIP_STAGE_EXITSOLVE
695  *
696  * @pre This method can be called if targetscip is in one of the following stages:
697  * - \ref SCIP_STAGE_PROBLEM
698  * - \ref SCIP_STAGE_INITPRESOLVE
699  * - \ref SCIP_STAGE_PRESOLVING
700  * - \ref SCIP_STAGE_EXITPRESOLVE
701  * - \ref SCIP_STAGE_PRESOLVED
702  * - \ref SCIP_STAGE_SOLVING
703  * - \ref SCIP_STAGE_EXITSOLVE
704  *
705  * @note sourcescip stage does not get changed
706  *
707  * @note targetscip stage does not get changed
708  *
709  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
710  */
711 extern
713  SCIP* sourcescip, /**< source SCIP data structure */
714  SCIP* targetscip, /**< target SCIP data structure */
715  SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables corresponding
716  * target variables, or NULL */
717  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
718  * target constraints, or NULL */
719  SCIP_Bool global, /**< create a global or a local copy? */
720  int* ncutsadded /**< pointer to store number of copied cuts, or NULL */
721  );
722 
723 /** copies all active conflicts from the conflict pool of sourcescip and adds them as linear constraints to targetscip
724  *
725  * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
726  * @note Do not change the source SCIP environment during the copying process
727  *
728  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
729  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
730  *
731  * @pre This method can be called if sourcescip is in one of the following stages:
732  * - \ref SCIP_STAGE_PROBLEM
733  * - \ref SCIP_STAGE_TRANSFORMED
734  * - \ref SCIP_STAGE_INITPRESOLVE
735  * - \ref SCIP_STAGE_PRESOLVING
736  * - \ref SCIP_STAGE_EXITPRESOLVE
737  * - \ref SCIP_STAGE_PRESOLVED
738  * - \ref SCIP_STAGE_SOLVING
739  * - \ref SCIP_STAGE_SOLVED
740  * - \ref SCIP_STAGE_EXITSOLVE
741  *
742  * @pre This method can be called if targetscip is in one of the following stages:
743  * - \ref SCIP_STAGE_PROBLEM
744  * - \ref SCIP_STAGE_INITPRESOLVE
745  * - \ref SCIP_STAGE_PRESOLVING
746  * - \ref SCIP_STAGE_EXITPRESOLVE
747  * - \ref SCIP_STAGE_PRESOLVED
748  * - \ref SCIP_STAGE_SOLVING
749  * - \ref SCIP_STAGE_EXITSOLVE
750  *
751  * @note sourcescip stage does not change
752  *
753  * @note targetscip stage does not change
754  *
755  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
756  */
757 extern
759  SCIP* sourcescip, /**< source SCIP data structure */
760  SCIP* targetscip, /**< target SCIP data structure */
761  SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables corresponding
762  * target variables, or NULL */
763  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
764  * target constraints, or NULL */
765  SCIP_Bool global, /**< create a global or a local copy? */
766  SCIP_Bool enablepricing, /**< should pricing be enabled in copied SCIP instance?
767  * If TRUE, the modifiable flag of constraints will be copied. */
768  SCIP_Bool* valid /**< pointer to store whether all constraints were validly copied */
769  );
770 
771 /** copies implications and cliques of sourcescip to targetscip
772  *
773  * This function should be called for a targetscip in transformed stage. It can save time in presolving of the
774  * targetscip, since implications and cliques are copied.
775  *
776  * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
777  * @note Do not change the source SCIP environment during the copying process
778  *
779  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
780  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
781  *
782  * @pre This method can be called if sourcescip is in one of the following stages:
783  * - \ref SCIP_STAGE_TRANSFORMED
784  * - \ref SCIP_STAGE_INITPRESOLVE
785  * - \ref SCIP_STAGE_PRESOLVING
786  * - \ref SCIP_STAGE_EXITPRESOLVE
787  * - \ref SCIP_STAGE_PRESOLVED
788  * - \ref SCIP_STAGE_SOLVING
789  * - \ref SCIP_STAGE_SOLVED
790  * - \ref SCIP_STAGE_EXITSOLVE
791  *
792  * @pre This method can be called if targetscip is in one of the following stages:
793  * - \ref SCIP_STAGE_TRANSFORMED
794  * - \ref SCIP_STAGE_INITPRESOLVE
795  * - \ref SCIP_STAGE_PRESOLVING
796  * - \ref SCIP_STAGE_EXITPRESOLVE
797  * - \ref SCIP_STAGE_PRESOLVED
798  * - \ref SCIP_STAGE_INITSOLVE
799  * - \ref SCIP_STAGE_SOLVING
800  *
801  * @note sourcescip stage does not get changed
802  *
803  * @note targetscip stage does not get changed
804  *
805  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
806  */
807 extern
809  SCIP* sourcescip, /**< source SCIP data structure */
810  SCIP* targetscip, /**< target SCIP data structure */
811  SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables corresponding
812  * target variables, or NULL */
813  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
814  * target constraints, or NULL */
815  SCIP_Bool global, /**< create a global or a local copy? */
816  SCIP_Bool* infeasible, /**< pointer to store whether an infeasibility was detected */
817  int* nbdchgs, /**< pointer to store the number of performed bound changes, or NULL */
818  int* ncopied /**< pointer to store number of copied implications and cliques, or NULL */
819  );
820 
821 /** copies parameter settings from sourcescip to targetscip
822  *
823  * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
824  * @note Do not change the source SCIP environment during the copying process
825  *
826  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
827  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
828  *
829  * @pre This method can be called if sourcescip is in one of the following stages:
830  * - \ref SCIP_STAGE_PROBLEM
831  * - \ref SCIP_STAGE_TRANSFORMED
832  * - \ref SCIP_STAGE_INITPRESOLVE
833  * - \ref SCIP_STAGE_PRESOLVING
834  * - \ref SCIP_STAGE_EXITPRESOLVE
835  * - \ref SCIP_STAGE_PRESOLVED
836  * - \ref SCIP_STAGE_INITSOLVE
837  * - \ref SCIP_STAGE_SOLVING
838  * - \ref SCIP_STAGE_SOLVED
839  *
840  * @pre This method can be called if targetscip is in one of the following stages:
841  * - \ref SCIP_STAGE_INIT
842  * - \ref SCIP_STAGE_PROBLEM
843  * - \ref SCIP_STAGE_FREE
844  *
845  * @note sourcescip stage does not get changed
846  *
847  * @note targetscip stage does not get changed
848  *
849  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
850  */
851 extern
853  SCIP* sourcescip, /**< source SCIP data structure */
854  SCIP* targetscip /**< target SCIP data structure */
855  );
856 
857 /** gets depth of current scip instance (increased by each copy call)
858  *
859  * @return Depth of subscip of SCIP is returned.
860  *
861  * @pre This method can be called if SCIP is in one of the following stages:
862  * - \ref SCIP_STAGE_PROBLEM
863  * - \ref SCIP_STAGE_TRANSFORMING
864  * - \ref SCIP_STAGE_TRANSFORMED
865  * - \ref SCIP_STAGE_INITPRESOLVE
866  * - \ref SCIP_STAGE_PRESOLVING
867  * - \ref SCIP_STAGE_EXITPRESOLVE
868  * - \ref SCIP_STAGE_PRESOLVED
869  * - \ref SCIP_STAGE_INITSOLVE
870  * - \ref SCIP_STAGE_SOLVING
871  * - \ref SCIP_STAGE_SOLVED
872  * - \ref SCIP_STAGE_EXITSOLVE
873  * - \ref SCIP_STAGE_FREETRANS
874  *
875  * @note SCIP stage does not get changed
876  *
877  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
878  */
879 extern
881  SCIP* scip /**< SCIP data structure */
882  );
883 
884 /** sets depth of scip instance
885  *
886  * @pre This method can be called if SCIP is in one of the following stages:
887  * - \ref SCIP_STAGE_PROBLEM
888  *
889  * @note SCIP stage does not get changed
890  *
891  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
892  */
893 extern
895  SCIP* scip, /**< SCIP data structure */
896  int newdepth /**< new subscip depth */
897  );
898 
899 /** copies source SCIP to target SCIP; the copying process is done in the following order:
900  * 1) copy the plugins
901  * 2) copy the settings
902  * 3) create problem data in target-SCIP and copy the problem data of the source-SCIP
903  * 4) copy all active variables
904  * 5) copy all constraints
905  *
906  * The source problem depends on the stage of the \p sourcescip - In SCIP_STAGE_PROBLEM, the original problem is copied,
907  * otherwise, the transformed problem is copied. For an explicit copy of the original problem, use SCIPcopyOrig().
908  *
909  * @note all variables and constraints which are created in the target-SCIP are not (user) captured
910  *
911  * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
912  * Also, 'passmessagehdlr' should be set to FALSE.
913  * @note Do not change the source SCIP environment during the copying process
914  *
915  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
916  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
917  *
918  * @pre This method can be called if sourcescip is in one of the following stages:
919  * - \ref SCIP_STAGE_PROBLEM
920  * - \ref SCIP_STAGE_TRANSFORMED
921  * - \ref SCIP_STAGE_INITPRESOLVE
922  * - \ref SCIP_STAGE_PRESOLVING
923  * - \ref SCIP_STAGE_EXITPRESOLVE
924  * - \ref SCIP_STAGE_PRESOLVED
925  * - \ref SCIP_STAGE_INITSOLVE
926  * - \ref SCIP_STAGE_SOLVING
927  * - \ref SCIP_STAGE_SOLVED
928  *
929  * @pre This method can be called if targetscip is in one of the following stages:
930  * - \ref SCIP_STAGE_INIT
931  * - \ref SCIP_STAGE_FREE
932  *
933  * @note sourcescip stage does not get changed
934  *
935  * @note targetscip stage does not get changed
936  *
937  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
938  */
939 extern
941  SCIP* sourcescip, /**< source SCIP data structure */
942  SCIP* targetscip, /**< target SCIP data structure */
943  SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables corresponding
944  * target variables, or NULL */
945  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
946  * target constraints, or NULL */
947  const char* suffix, /**< optional suffix for problem name inside the target SCIP */
948  SCIP_Bool global, /**< create a global or a local copy? */
949  SCIP_Bool enablepricing, /**< should pricing be enabled in copied SCIP instance? If TRUE, pricer
950  * plugins will be copied and activated, and the modifiable flag of
951  * constraints will be respected. If FALSE, valid will be set to FALSE, when
952  * there are pricers present */
953  SCIP_Bool passmessagehdlr, /**< should the message handler be passed */
954  SCIP_Bool* valid /**< pointer to store whether the copying was valid, or NULL */
955  );
956 
957 /** copies source SCIP to target SCIP but compresses constraints
958  *
959  * constraint compression is performed by removing fixed variables immediately
960  * during constraint creation if the involved constraint handlers support
961  * compression
962  *
963  * the copying process is done in the following order:
964  * 1) copy the plugins
965  * 2) copy the settings
966  * 3) create problem data in target-SCIP and copy the problem data of the source-SCIP
967  * 4) copy all active variables
968  * a) fix all variable copies specified by \p fixedvars, \p fixedvals, and \p nfixedvars
969  * b) enable constraint compression
970  * 5) copy all constraints
971  *
972  * The source problem depends on the stage of the \p sourcescip - In SCIP_STAGE_PROBLEM, the original problem is copied,
973  * otherwise, the transformed problem is copied. For an explicit copy of the original problem, use SCIPcopyOrigConsCompression().
974  *
975  * @note: in case that a combination of local bounds and explicit fixing values should be used,
976  * the fixing value of a variable is preferred if local bounds and fixing value disagree.
977  *
978  * @note all variables and constraints which are created in the target-SCIP are not (user) captured
979  *
980  * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
981  * Also, 'passmessagehdlr' should be set to FALSE.
982  * @note Do not change the source SCIP environment during the copying process
983  *
984  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
985  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
986  *
987  * @pre This method can be called if sourcescip is in one of the following stages:
988  * - \ref SCIP_STAGE_PROBLEM
989  * - \ref SCIP_STAGE_TRANSFORMED
990  * - \ref SCIP_STAGE_INITPRESOLVE
991  * - \ref SCIP_STAGE_PRESOLVING
992  * - \ref SCIP_STAGE_EXITPRESOLVE
993  * - \ref SCIP_STAGE_PRESOLVED
994  * - \ref SCIP_STAGE_INITSOLVE
995  * - \ref SCIP_STAGE_SOLVING
996  * - \ref SCIP_STAGE_SOLVED
997  *
998  * @pre This method can be called if targetscip is in one of the following stages:
999  * - \ref SCIP_STAGE_INIT
1000  * - \ref SCIP_STAGE_FREE
1001  *
1002  * @note sourcescip stage does not get changed
1003  *
1004  * @note targetscip stage does not get changed
1005  *
1006  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
1007  */
1008 extern
1010  SCIP* sourcescip, /**< source SCIP data structure */
1011  SCIP* targetscip, /**< target SCIP data structure */
1012  SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables corresponding
1013  * target variables, or NULL */
1014  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
1015  * target constraints, or NULL */
1016  const char* suffix, /**< optional suffix for problem name inside the target SCIP */
1017  SCIP_VAR** fixedvars, /**< source variables whose copies should be fixed in the target SCIP environment, or NULL */
1018  SCIP_Real* fixedvals, /**< array of fixing values for target SCIP variables, or NULL */
1019  int nfixedvars, /**< number of source variables whose copies should be fixed in the target SCIP environment, or NULL */
1020  SCIP_Bool global, /**< create a global or a local copy? */
1021  SCIP_Bool enablepricing, /**< should pricing be enabled in copied SCIP instance? If TRUE, pricer
1022  * plugins will be copied and activated, and the modifiable flag of
1023  * constraints will be respected. If FALSE, valid will be set to FALSE, when
1024  * there are pricers present */
1025  SCIP_Bool passmessagehdlr, /**< should the message handler be passed */
1026  SCIP_Bool* valid /**< pointer to store whether the copying was valid, or NULL */
1027  );
1028 
1029 /** copies source SCIP original problem to target SCIP; the copying process is done in the following order:
1030  * 1) copy the plugins
1031  * 2) copy the settings
1032  * 3) create problem data in target-SCIP and copy the original problem data of the source-SCIP
1033  * 4) copy all original variables
1034  * 5) copy all original constraints
1035  *
1036  * @note all variables and constraints which are created in the target-SCIP are not (user) captured
1037  *
1038  * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
1039  * Also, 'passmessagehdlr' should be set to FALSE.
1040  * @note Do not change the source SCIP environment during the copying process
1041  *
1042  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1043  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1044  *
1045  * @pre This method can be called if sourcescip is in one of the following stages:
1046  * - \ref SCIP_STAGE_PROBLEM
1047  * - \ref SCIP_STAGE_TRANSFORMED
1048  * - \ref SCIP_STAGE_INITPRESOLVE
1049  * - \ref SCIP_STAGE_PRESOLVING
1050  * - \ref SCIP_STAGE_EXITPRESOLVE
1051  * - \ref SCIP_STAGE_PRESOLVED
1052  * - \ref SCIP_STAGE_INITSOLVE
1053  * - \ref SCIP_STAGE_SOLVING
1054  * - \ref SCIP_STAGE_SOLVED
1055  *
1056  * @pre This method can be called if targetscip is in one of the following stages:
1057  * - \ref SCIP_STAGE_INIT
1058  * - \ref SCIP_STAGE_FREE
1059  *
1060  * @note sourcescip stage does not get changed
1061  *
1062  * @note targetscip stage does not get changed
1063  *
1064  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
1065  */
1066 extern
1068  SCIP* sourcescip, /**< source SCIP data structure */
1069  SCIP* targetscip, /**< target SCIP data structure */
1070  SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables corresponding
1071  * target variables, or NULL */
1072  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
1073  * target constraints, or NULL */
1074  const char* suffix, /**< suffix which will be added to the names of the target SCIP, might be empty */
1075  SCIP_Bool enablepricing, /**< should pricing be enabled in copied SCIP instance? If TRUE, pricer
1076  * plugins will be copied and activated, and the modifiable flag of
1077  * constraints will be respected. If FALSE, valid will be set to FALSE, when
1078  * there are pricers present */
1079  SCIP_Bool passmessagehdlr, /**< should the message handler be passed */
1080  SCIP_Bool* valid /**< pointer to store whether the copying was valid, or NULL */
1081  );
1082 
1083 /** copies source SCIP original problem to target SCIP but compresses constraints
1084  *
1085  * constraint compression is performed by removing fixed variables immediately
1086  * during constraint creation if the involved constraint handlers support
1087  * compression
1088  *
1089  * the copying process is done in the following order:
1090  * 1) copy the plugins
1091  * 2) copy the settings
1092  * 3) create problem data in target-SCIP and copy the problem data of the source-SCIP
1093  * 4) copy all original variables
1094  * a) fix all variable copies specified by \p fixedvars, \p fixedvals, and \p nfixedvars
1095  * b) enable constraint compression
1096  * 5) copy all constraints
1097  *
1098  * @note all variables and constraints which are created in the target-SCIP are not (user) captured
1099  *
1100  * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
1101  * Also, 'passmessagehdlr' should be set to FALSE.
1102  * @note Do not change the source SCIP environment during the copying process
1103  *
1104  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1105  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
1106  *
1107  * @pre This method can be called if sourcescip is in one of the following stages:
1108  * - \ref SCIP_STAGE_PROBLEM
1109  * - \ref SCIP_STAGE_TRANSFORMED
1110  * - \ref SCIP_STAGE_INITPRESOLVE
1111  * - \ref SCIP_STAGE_PRESOLVING
1112  * - \ref SCIP_STAGE_EXITPRESOLVE
1113  * - \ref SCIP_STAGE_PRESOLVED
1114  * - \ref SCIP_STAGE_INITSOLVE
1115  * - \ref SCIP_STAGE_SOLVING
1116  * - \ref SCIP_STAGE_SOLVED
1117  *
1118  * @pre This method can be called if targetscip is in one of the following stages:
1119  * - \ref SCIP_STAGE_INIT
1120  * - \ref SCIP_STAGE_FREE
1121  *
1122  * @note sourcescip stage does not get changed
1123  *
1124  * @note targetscip stage does not get changed
1125  *
1126  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
1127  */
1128 extern
1130  SCIP* sourcescip, /**< source SCIP data structure */
1131  SCIP* targetscip, /**< target SCIP data structure */
1132  SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables corresponding
1133  * target variables, or NULL */
1134  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
1135  * target constraints, or NULL */
1136  const char* suffix, /**< optional suffix for problem name inside the target SCIP */
1137  SCIP_VAR** fixedvars, /**< source variables whose copies should be fixed in the target SCIP environment, or NULL */
1138  SCIP_Real* fixedvals, /**< array of fixing values for target SCIP variables, or NULL */
1139  int nfixedvars, /**< number of source variables whose copies should be fixed in the target SCIP environment, or NULL */
1140  SCIP_Bool enablepricing, /**< should pricing be enabled in copied SCIP instance? If TRUE, pricer
1141  * plugins will be copied and activated, and the modifiable flag of
1142  * constraints will be respected. If FALSE, valid will be set to FALSE, when
1143  * there are pricers present */
1144  SCIP_Bool passmessagehdlr, /**< should the message handler be passed */
1145  SCIP_Bool* valid /**< pointer to store whether the copying was valid, or NULL */
1146  );
1147 
1148 /** checks if there is enough time and memory left for copying the sourcescip into a sub-SCIP and solve the sub-SCIP
1149  *
1150  * This is the case if the time and memory limit that would be passed to the sub-SCIP are larger than 0.0
1151  *
1152  * @pre This method can be called if sourcescip is in one of the following stages:
1153  * - \ref SCIP_STAGE_PROBLEM
1154  * - \ref SCIP_STAGE_TRANSFORMED
1155  * - \ref SCIP_STAGE_INITPRESOLVE
1156  * - \ref SCIP_STAGE_PRESOLVING
1157  * - \ref SCIP_STAGE_EXITPRESOLVE
1158  * - \ref SCIP_STAGE_PRESOLVED
1159  * - \ref SCIP_STAGE_INITSOLVE
1160  * - \ref SCIP_STAGE_SOLVING
1161  * - \ref SCIP_STAGE_SOLVED
1162  *
1163  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
1164  */
1165 extern
1167  SCIP* sourcescip, /**< source SCIP data structure */
1168  SCIP_Bool* success /**< pointer to store whether there is time and memory left to copy the
1169  * problem and run the sub-SCIP */
1170  );
1171 
1172 /** copies limits from source SCIP to target SCIP
1173  *
1174  * @note time and memory limit are reduced by the amount already spent in the source SCIP before installing the limit
1175  * in the target SCIP
1176  * @note all other limits are disabled and need to be enabled afterwards, if needed
1177  *
1178  * @pre This method can be called if sourcescip is in one of the following stages:
1179  * - \ref SCIP_STAGE_PROBLEM
1180  * - \ref SCIP_STAGE_TRANSFORMED
1181  * - \ref SCIP_STAGE_INITPRESOLVE
1182  * - \ref SCIP_STAGE_PRESOLVING
1183  * - \ref SCIP_STAGE_EXITPRESOLVE
1184  * - \ref SCIP_STAGE_PRESOLVED
1185  * - \ref SCIP_STAGE_INITSOLVE
1186  * - \ref SCIP_STAGE_SOLVING
1187  * - \ref SCIP_STAGE_SOLVED
1188  *
1189  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
1190  */
1191 extern
1193  SCIP* sourcescip, /**< source SCIP data structure */
1194  SCIP* targetscip /**< target SCIP data structure */
1195  );
1196 
1197 
1198 /**@} */
1199 
1200 #ifdef __cplusplus
1201 }
1202 #endif
1203 
1204 #endif
SCIP_RETCODE SCIPcopyOrig(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, const char *suffix, SCIP_Bool enablepricing, SCIP_Bool passmessagehdlr, SCIP_Bool *valid)
Definition: scip_copy.c:2780
internal methods for branch and bound tree
SCIP_RETCODE SCIPcopyOrigProb(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, const char *name)
Definition: scip_copy.c:610
type definitions for miscellaneous datastructures
SCIP_RETCODE SCIPcopyPlugins(SCIP *sourcescip, SCIP *targetscip, SCIP_Bool copyreaders, SCIP_Bool copypricers, SCIP_Bool copyconshdlrs, SCIP_Bool copyconflicthdlrs, SCIP_Bool copypresolvers, SCIP_Bool copyrelaxators, SCIP_Bool copyseparators, SCIP_Bool copypropagators, SCIP_Bool copyheuristics, SCIP_Bool copyeventhdlrs, SCIP_Bool copynodeselectors, SCIP_Bool copybranchrules, SCIP_Bool copydisplays, SCIP_Bool copydialogs, SCIP_Bool copytables, SCIP_Bool copynlpis, SCIP_Bool passmessagehdlr, SCIP_Bool *valid)
Definition: scip_copy.c:316
SCIP_RETCODE SCIPconvertCutsToConss(SCIP *scip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global, int *ncutsadded)
Definition: scip_copy.c:1819
void SCIPsetSubscipDepth(SCIP *scip, int newdepth)
Definition: scip_copy.c:2375
SCIP_RETCODE SCIPcopyLimits(SCIP *sourcescip, SCIP *targetscip)
Definition: scip_copy.c:3012
int SCIPgetSubscipDepth(SCIP *scip)
Definition: scip_copy.c:2354
SCIP_RETCODE SCIPcopyConsCompression(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, const char *suffix, SCIP_VAR **fixedvars, SCIP_Real *fixedvals, int nfixedvars, SCIP_Bool global, SCIP_Bool enablepricing, SCIP_Bool passmessagehdlr, SCIP_Bool *valid)
Definition: scip_copy.c:2704
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
type definitions for return codes for SCIP methods
SCIP_RETCODE SCIPcopyBenders(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_Bool *valid)
Definition: scip_copy.c:393
SCIP_RETCODE SCIPcopyParamSettings(SCIP *sourcescip, SCIP *targetscip)
Definition: scip_copy.c:2313
SCIP_RETCODE SCIPcopyOrigConss(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool enablepricing, SCIP_Bool *valid)
Definition: scip_copy.c:1686
SCIP_RETCODE SCIPenableConsCompression(SCIP *scip)
Definition: scip_copy.c:648
SCIP_RETCODE SCIPcopyOrigConsCompression(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, const char *suffix, SCIP_VAR **fixedvars, SCIP_Real *fixedvals, int nfixedvars, SCIP_Bool enablepricing, SCIP_Bool passmessagehdlr, SCIP_Bool *valid)
Definition: scip_copy.c:2862
type definitions for SCIP&#39;s main datastructure
SCIP_RETCODE SCIPcopyVars(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_VAR **fixedvars, SCIP_Real *fixedvals, int nfixedvars, SCIP_Bool global)
Definition: scip_copy.c:1158
SCIP_RETCODE SCIPcopyCuts(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global, int *ncutsadded)
Definition: scip_copy.c:1879
SCIP_RETCODE SCIPmergeVariableStatistics(SCIP *sourcescip, SCIP *targetscip, SCIP_VAR **sourcevars, SCIP_VAR **targetvars, int nvars)
Definition: scip_copy.c:1245
internal miscellaneous methods
SCIP_RETCODE SCIPcopyOrigVars(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_VAR **fixedvars, SCIP_Real *fixedvals, int nfixedvars)
Definition: scip_copy.c:1215
internal methods for global SCIP settings
SCIP main data structure.
type definitions for problem variables
SCIP_RETCODE SCIPcopyImplicationsCliques(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global, SCIP_Bool *infeasible, int *nbdchgs, int *ncopied)
Definition: scip_copy.c:2129
SCIP_RETCODE SCIPcopyConflicts(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global, SCIP_Bool enablepricing, SCIP_Bool *valid)
Definition: scip_copy.c:1971
SCIP_RETCODE SCIPgetConsCopy(SCIP *sourcescip, SCIP *targetscip, SCIP_CONS *sourcecons, SCIP_CONS **targetcons, SCIP_CONSHDLR *sourceconshdlr, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, const char *name, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode, SCIP_Bool global, SCIP_Bool *valid)
Definition: scip_copy.c:1350
internal methods for problem variables
#define SCIP_Bool
Definition: def.h:69
SCIP_RETCODE SCIPcopyConss(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global, SCIP_Bool enablepricing, SCIP_Bool *valid)
Definition: scip_copy.c:1486
methods for debugging
datastructures for problem statistics
SCIP_RETCODE SCIPcopyProb(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global, const char *name)
Definition: scip_copy.c:557
SCIP_RETCODE SCIPgetVarCopy(SCIP *sourcescip, SCIP *targetscip, SCIP_VAR *sourcevar, SCIP_VAR **targetvar, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global, SCIP_Bool *success)
Definition: scip_copy.c:737
internal methods for main solving loop and node processing
SCIP_Bool SCIPisConsCompressionEnabled(SCIP *scip)
Definition: scip_copy.c:687
SCIP_RETCODE SCIPcopy(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, const char *suffix, SCIP_Bool global, SCIP_Bool enablepricing, SCIP_Bool passmessagehdlr, SCIP_Bool *valid)
Definition: scip_copy.c:2615
#define SCIP_Real
Definition: def.h:157
internal methods for constraints and constraint handlers
SCIP_RETCODE SCIPcheckCopyLimits(SCIP *sourcescip, SCIP_Bool *success)
Definition: scip_copy.c:2976
common defines and data types used in all packages of SCIP
type definitions for constraints and constraint handlers