scip_copy.h
Go to the documentation of this file.
29 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
51 /** copies plugins from sourcescip to targetscip; in case that a constraint handler which does not need constraints
52 * cannot be copied, valid will return FALSE. All plugins can declare that, if their copy process failed, the
56 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
61 * @note This method does not copy Benders' plugins. To this end, the method SCIPcopyBenders() must be called
64 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
82 * @post After calling this method targetscip reaches one of the following stages depending on if and when the solution
117 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
118 * @note the 'threadsafe' parameter must be set to TRUE if you are absolutely certain that the source and target
119 * SCIP instances will be solved in parallel. The usual case is to set this to FALSE, since thread safety
122 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
140 * @post After calling this method targetscip reaches one of the following stages depending on if and when the solution
161 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
163 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
190 * @post After calling this method targetscip reaches one of the following stages depending on if and when the solution
204 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
212 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
214 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
232 * @post After calling this method targetscip reaches one of the following stages depending on if and when the solution
246 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
256 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
297 /** returns copy of the source variable; if there already is a copy of the source variable in the variable hash map,
298 * it is just returned as target variable; otherwise, if the variables it not marked as relaxation-only, a new variable
299 * will be created and added to the target SCIP; this created variable is added to the variable hash map and returned as target variable;
302 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
304 * @note if a new variable was created, this variable will be added to the target-SCIP, but it is not captured
306 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
340 SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables to the corresponding
342 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
348 /** Copies all active (thus unfixed) variables from source-SCIP, except those that are marked as relaxation only,
357 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
360 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
387 SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables to the corresponding
389 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
391 SCIP_VAR** fixedvars, /**< source variables whose copies should be fixed in the target SCIP environment, or NULL */
393 int nfixedvars, /**< number of source variables whose copies should be fixed in the target SCIP environment, or NULL */
397 /** copies all original variables from source-SCIP and adds these variable to the target-SCIP; the mapping between these
398 * variables are stored in the variable hashmap, target-SCIP has to be in problem creation stage, fixed and aggregated
403 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
406 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
433 SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables to the corresponding
435 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
437 SCIP_VAR** fixedvars, /**< source variables whose copies should be fixed in the target SCIP environment, or NULL */
439 int nfixedvars /**< number of source variables whose copies should be fixed in the target SCIP environment, or NULL */
442 /** merges the histories of variables from a source SCIP into a target SCIP. The two data structures should point to
445 * @note the notion of source and target is inverted here; \p sourcescip usually denotes a copied SCIP instance, whereas
460 * Variables that are relaxation-only in the master SCIP are set to 0 or the bound closest to 0. Such variables
463 * @note This method allocates a new solution of the main \p scip that needs to be freed by the user.
471 SCIP_VAR** subvars, /**< the variables from the subproblem in the same order as the main \p scip */
475 /** checks the solutions from the subscip and adds the first one that is found feasible to the master SCIP
477 * Variables that are relaxation-only in the master SCIP are set to 0 or the bound closest to 0. Such variables
485 SCIP_VAR** subvars, /**< the variables from the subproblem in the same order as the main \p scip */
487 int* solindex /**< pointer to store solution index of stored solution, or NULL if not of interest */
490 /** returns copy of the source constraint; if there already is a copy of the source constraint in the constraint hash
491 * map, it is just returned as target constraint; elsewise a new constraint will be created; this created constraint is
492 * added to the constraint hash map and returned as target constraint; the variable map is used to map the variables of
495 * @warning If a constraint is marked to be checked for feasibility but not to be enforced, a LP or pseudo solution may
496 * be declared feasible even if it violates this particular constraint. This constellation should only be
497 * used, if no LP or pseudo solution can violate the constraint -- e.g. if a local constraint is redundant due
500 * @note The constraint is not added to the target SCIP. You can check whether a constraint is added by calling
501 * SCIPconsIsAdded(). (If you mix SCIPgetConsCopy() with SCIPcopyConss() you should pay attention to what you add
504 * @note The constraint is always captured, either during the creation of the copy or after finding the copy of the
507 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
510 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
547 SCIP_HASHMAP* varmap, /**< a SCIP_HASHMAP mapping variables of the source SCIP to the corresponding
549 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
551 const char* name, /**< name of constraint, or NULL if the name of the source constraint should be used */
560 SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup? */
561 SCIP_Bool stickingatnode, /**< should the constraint always be kept at the node where it was added, even
568 * variables between the source and the target SCIP a hash map can be given; if the variable hash
569 * map is NULL or necessary variable mapping is missing, the required variables are created in the
570 * target-SCIP and added to the hash map, if not NULL; all variables which are created are added to
574 * *valid is set to TRUE iff all constraints that are marked as checked or enforced were copied successfully.
577 * @note the constraints are added to the target-SCIP but are not (user) captured in the target SCIP. (If you mix
578 * SCIPgetConsCopy() with SCIPcopyConss() you should pay attention to what you add explicitly and what is already
581 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
584 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
611 SCIP_HASHMAP* varmap, /**< a SCIP_HASHMAP mapping variables of the source SCIP to the corresponding
613 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
618 SCIP_Bool* valid /**< pointer to store whether all checked or enforced constraints were validly copied */
621 /** copies all original constraints from the source-SCIP and adds these to the target-SCIP; for mapping the
622 * variables between the source and the target SCIP a hash map can be given; if the variable hash
623 * map is NULL or necessary variable mapping is missing, the required variables are created in the
624 * target-SCIP and added to the hash map, if not NULL; all variables which are created are added to
628 * @note the constraints are added to the target-SCIP but are not (user) captured in the target SCIP. (If you mix
629 * SCIPgetConsCopy() with SCIPcopyConss() you should pay attention to what you add explicitly and what is already
632 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
635 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
662 SCIP_HASHMAP* varmap, /**< a SCIP_HASHMAP mapping variables of the source SCIP to the corresponding
664 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
675 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
696 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
706 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
709 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
744 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
750 /** copies all active conflicts from the conflict pool of sourcescip and adds them as linear constraints to targetscip
752 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
755 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
790 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
800 * This function should be called for a targetscip in transformed stage. It can save time in presolving of the
803 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
806 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
840 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
850 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
853 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
933 * The source problem depends on the stage of the \p sourcescip - In SCIP_STAGE_PROBLEM, the original problem is copied,
934 * otherwise, the transformed problem is copied. For an explicit copy of the original problem, use SCIPcopyOrig().
936 * @note all variables and constraints which are created in the target-SCIP are not (user) captured
938 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
940 * @note the 'threadsafe' parameter should only be set to TRUE if you are absolutely certain that the source and target
941 * SCIP instances will be solved in parallel. The usual case is to set this to FALSE, since thread safety
945 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
975 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
979 SCIP_Bool enablepricing, /**< should pricing be enabled in copied SCIP instance? If TRUE, pricer
1004 * The source problem depends on the stage of the \p sourcescip - In SCIP_STAGE_PROBLEM, the original problem is copied,
1005 * otherwise, the transformed problem is copied. For an explicit copy of the original problem, use SCIPcopyOrigConsCompression().
1010 * @note all variables and constraints which are created in the target-SCIP are not (user) captured
1012 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
1014 * @note the 'threadsafe' parameter should only be set to TRUE if you are absolutely certain that the source and target
1015 * SCIP instances will be solved in parallel. The usual case is to set this to FALSE, since thread safety
1019 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1049 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
1052 SCIP_VAR** fixedvars, /**< source variables whose copies should be fixed in the target SCIP environment, or NULL */
1054 int nfixedvars, /**< number of source variables whose copies should be fixed in the target SCIP environment, or NULL */
1056 SCIP_Bool enablepricing, /**< should pricing be enabled in copied SCIP instance? If TRUE, pricer
1066 /** copies source SCIP original problem to target SCIP; the copying process is done in the following order:
1073 * @note all variables and constraints which are created in the target-SCIP are not (user) captured
1075 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
1077 * @note the 'threadsafe' parameter should only be set to TRUE if you are absolutely certain that the source and target
1078 * SCIP instances will be solved in parallel. The usual case is to set this to FALSE, since thread safety
1082 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1112 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
1114 const char* suffix, /**< suffix which will be added to the names of the target SCIP, might be empty */
1115 SCIP_Bool enablepricing, /**< should pricing be enabled in copied SCIP instance? If TRUE, pricer
1140 * @note all variables and constraints which are created in the target-SCIP are not (user) captured
1142 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
1144 * @note the 'threadsafe' parameter should only be set to TRUE if you are absolutely certain that the source and target
1145 * SCIP instances will be solved in parallel. The usual case is to set this to FALSE, since thread safety
1149 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1179 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
1182 SCIP_VAR** fixedvars, /**< source variables whose copies should be fixed in the target SCIP environment, or NULL */
1184 int nfixedvars, /**< number of source variables whose copies should be fixed in the target SCIP environment, or NULL */
1185 SCIP_Bool enablepricing, /**< should pricing be enabled in copied SCIP instance? If TRUE, pricer
1195 /** checks if there is enough time and memory left for copying the sourcescip into a sub-SCIP and solve the sub-SCIP
1197 * This is the case if the time and memory limit that would be passed to the sub-SCIP are larger than 0.0
1221 * @note time and memory limit are reduced by the amount already spent in the source SCIP before installing the limit
1225 * @see SCIPsetCommonSubscipParams() to set further working limits and other parameters commonly used for auxiliary problems
1249 * @note memory and time limits are not affected, and must be set using SCIPcopyLimits() instead
SCIP_EXPORT SCIP_RETCODE SCIPsetCommonSubscipParams(SCIP *sourcescip, SCIP *subscip, SCIP_Longint nsubnodes, SCIP_Longint nstallnodes, int bestsollimit)
Definition: scip_copy.c:3269
SCIP_EXPORT SCIP_RETCODE SCIPcopyBenders(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_Bool threadsafe, SCIP_Bool *valid)
Definition: scip_copy.c:345
SCIP_EXPORT 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:1673
type definitions for miscellaneous datastructures
Definition: struct_scip.h:59
SCIP_EXPORT SCIP_RETCODE SCIPtranslateSubSol(SCIP *scip, SCIP *subscip, SCIP_SOL *subsol, SCIP_HEUR *heur, SCIP_VAR **subvars, SCIP_SOL **newsol)
Definition: scip_copy.c:1356
SCIP_EXPORT SCIP_RETCODE SCIPcopyOrig(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, const char *suffix, SCIP_Bool enablepricing, SCIP_Bool threadsafe, SCIP_Bool passmessagehdlr, SCIP_Bool *valid)
Definition: scip_copy.c:2989
SCIP_EXPORT SCIP_RETCODE SCIPcopyOrigConss(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool enablepricing, SCIP_Bool *valid)
Definition: scip_copy.c:1878
Definition: struct_var.h:198
SCIP_EXPORT 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:1534
SCIP_EXPORT SCIP_RETCODE SCIPtranslateSubSols(SCIP *scip, SCIP *subscip, SCIP_HEUR *heur, SCIP_VAR **subvars, SCIP_Bool *success, int *solindex)
Definition: scip_copy.c:1396
SCIP_EXPORT 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 threadsafe, SCIP_Bool passmessagehdlr, SCIP_Bool *valid)
Definition: scip_copy.c:3076
SCIP_EXPORT SCIP_RETCODE SCIPcopy(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, const char *suffix, SCIP_Bool global, SCIP_Bool enablepricing, SCIP_Bool threadsafe, SCIP_Bool passmessagehdlr, SCIP_Bool *valid)
Definition: scip_copy.c:2814
type definitions for return codes for SCIP methods
SCIP_EXPORT SCIP_RETCODE SCIPcopyOrigProb(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, const char *name)
Definition: scip_copy.c:566
SCIP_EXPORT SCIP_RETCODE SCIPcheckCopyLimits(SCIP *sourcescip, SCIP_Bool *success)
Definition: scip_copy.c:3192
SCIP_EXPORT SCIP_RETCODE SCIPcopyProb(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global, const char *name)
Definition: scip_copy.c:513
Definition: struct_sol.h:64
SCIP_EXPORT 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:697
Definition: struct_misc.h:128
SCIP_EXPORT SCIP_RETCODE SCIPcopyParamSettings(SCIP *sourcescip, SCIP *targetscip)
Definition: scip_copy.c:2507
Definition: struct_cons.h:37
Definition: struct_cons.h:117
type definitions for SCIP's main datastructure
SCIP_EXPORT SCIP_RETCODE SCIPcopyCuts(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global, int *ncutsadded)
Definition: scip_copy.c:2073
SCIP_EXPORT SCIP_RETCODE SCIPmergeVariableStatistics(SCIP *sourcescip, SCIP *targetscip, SCIP_VAR **sourcevars, SCIP_VAR **targetvars, int nvars)
Definition: scip_copy.c:1251
SCIP_EXPORT SCIP_Bool SCIPisConsCompressionEnabled(SCIP *scip)
Definition: scip_copy.c:646
type definitions for problem variables
Definition: struct_heur.h:88
SCIP_EXPORT void SCIPsetSubscipDepth(SCIP *scip, int newdepth)
Definition: scip_copy.c:2569
SCIP_EXPORT 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 threadsafe, SCIP_Bool passmessagehdlr, SCIP_Bool *valid)
Definition: scip_copy.c:2908
SCIP_EXPORT SCIP_RETCODE SCIPcopyLimits(SCIP *sourcescip, SCIP *targetscip)
Definition: scip_copy.c:3228
SCIP_EXPORT 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:1164
SCIP_EXPORT SCIP_RETCODE SCIPenableConsCompression(SCIP *scip)
Definition: scip_copy.c:607
SCIP_EXPORT 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:2165
SCIP_EXPORT 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:1221
SCIP_EXPORT 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:265
SCIP_EXPORT 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:2323
common defines and data types used in all packages of SCIP
Definition: objbenders.h:33
SCIP_EXPORT SCIP_RETCODE SCIPconvertCutsToConss(SCIP *scip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global, int *ncutsadded)
Definition: scip_copy.c:2011
type definitions for constraints and constraint handlers