scip_copy.h
Go to the documentation of this file.
38/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
60/** copies plugins from sourcescip to targetscip; in case that a constraint handler which does not need constraints
61 * cannot be copied, valid will return FALSE. All plugins can declare that, if their copy process failed, the
65 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
70 * @note This method does not copy Benders' plugins. To this end, the method SCIPcopyBenders() must be called
73 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
91 * @post After calling this method targetscip reaches one of the following stages depending on if and when the solution
129 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
130 * @note the 'threadsafe' parameter must be set to TRUE if you are absolutely certain that the source and target
131 * SCIP instances will be solved in parallel. The usual case is to set this to FALSE, since thread safety
134 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
152 * @post After calling this method targetscip reaches one of the following stages depending on if and when the solution
173 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
175 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
202 * @post After calling this method targetscip reaches one of the following stages depending on if and when the solution
216 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
224 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
226 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
244 * @post After calling this method targetscip reaches one of the following stages depending on if and when the solution
258 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
268 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
309/** returns copy of the source variable; if there already is a copy of the source variable in the variable hash map,
310 * it is just returned as target variable; otherwise, if the variables it not marked as relaxation-only, a new variable
311 * will be created and added to the target SCIP; this created variable is added to the variable hash map and returned as target variable;
314 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
316 * @note if a new variable was created, this variable will be added to the target-SCIP, but it is not captured
318 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
352 SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables to the corresponding
354 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
360/** Copies all active (thus unfixed) variables from source-SCIP, except those that are marked as relaxation only,
369 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
372 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
399 SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables to the corresponding
401 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
403 SCIP_VAR** fixedvars, /**< source variables whose copies should be fixed in the target SCIP environment, or NULL */
405 int nfixedvars, /**< number of source variables whose copies should be fixed in the target SCIP environment, or NULL */
409/** copies all original variables from source-SCIP and adds these variable to the target-SCIP; the mapping between these
410 * variables are stored in the variable hashmap, target-SCIP has to be in problem creation stage, fixed and aggregated
415 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
418 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
445 SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables to the corresponding
447 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
449 SCIP_VAR** fixedvars, /**< source variables whose copies should be fixed in the target SCIP environment, or NULL */
451 int nfixedvars /**< number of source variables whose copies should be fixed in the target SCIP environment, or NULL */
454/** merges the histories of variables from a source SCIP into a target SCIP. The two data structures should point to
457 * @note the notion of source and target is inverted here; \p sourcescip usually denotes a copied SCIP instance, whereas
474 * @note the notion of source and target is inverted here; \p sourcescip usually denotes a copied SCIP instance, whereas
486 * Variables that are relaxation-only in the master SCIP are set to 0 or the bound closest to 0. Such variables
489 * @note This method allocates a new solution of the main scip that needs to be freed by the user.
497 SCIP_VAR** subvars, /**< the variables from the subproblem in the same order as the main scip */
501/** checks the solutions from the subscip and adds the first one that is found feasible to the master SCIP
503 * Variables that are relaxation-only in the master SCIP are set to 0 or the bound closest to 0. Such variables
511 SCIP_VAR** subvars, /**< the variables from the subproblem in the same order as the main scip */
513 int* solindex /**< pointer to store solution index of stored solution, or NULL if not of interest */
516/** returns copy of the source constraint; if there already is a copy of the source constraint in the constraint hash
517 * map, it is just returned as target constraint; elsewise a new constraint will be created; this created constraint is
518 * added to the constraint hash map and returned as target constraint; the variable map is used to map the variables of
521 * @warning If a constraint is marked to be checked for feasibility but not to be enforced, a LP or pseudo solution may
522 * be declared feasible even if it violates this particular constraint. This constellation should only be
523 * used, if no LP or pseudo solution can violate the constraint -- e.g. if a local constraint is redundant due
526 * @note The constraint is not added to the target SCIP. You can check whether a constraint is added by calling
527 * SCIPconsIsAdded(). (If you mix SCIPgetConsCopy() with SCIPcopyConss() you should pay attention to what you add
530 * @note The constraint is always captured, either during the creation of the copy or after finding the copy of the
533 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
536 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
573 SCIP_HASHMAP* varmap, /**< a SCIP_HASHMAP mapping variables of the source SCIP to the corresponding
575 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
577 const char* name, /**< name of constraint, or NULL if the name of the source constraint should be used */
586 SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup? */
587 SCIP_Bool stickingatnode, /**< should the constraint always be kept at the node where it was added, even
594 * variables between the source and the target SCIP a hash map can be given; if the variable hash
595 * map is NULL or necessary variable mapping is missing, the required variables are created in the
596 * target-SCIP and added to the hash map, if not NULL; all variables which are created are added to
600 * *valid is set to TRUE iff all constraints that are marked as checked or enforced were copied successfully.
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
607 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
610 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
637 SCIP_HASHMAP* varmap, /**< a SCIP_HASHMAP mapping variables of the source SCIP to the corresponding
639 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
644 SCIP_Bool* valid /**< pointer to store whether all checked or enforced constraints were validly copied */
647/** copies all original constraints from the source-SCIP and adds these to the target-SCIP; for mapping the
648 * variables between the source and the target SCIP a hash map can be given; if the variable hash
649 * map is NULL or necessary variable mapping is missing, the required variables are created in the
650 * target-SCIP and added to the hash map, if not NULL; all variables which are created are added to
654 * @note the constraints are added to the target-SCIP but are not (user) captured in the target SCIP. (If you mix
655 * SCIPgetConsCopy() with SCIPcopyConss() you should pay attention to what you add explicitly and what is already
658 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
661 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
688 SCIP_HASHMAP* varmap, /**< a SCIP_HASHMAP mapping variables of the source SCIP to the corresponding
690 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
701 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
722 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
732 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
735 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
770 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
776/** copies all active conflicts from the conflict pool of sourcescip and adds them as linear constraints to targetscip
778 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
781 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
816 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
826 * This function should be called for a targetscip in transformed stage. It can save time in presolving of the
829 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
832 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
866 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
876 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
879 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
959 * The source problem depends on the stage of the \p sourcescip - In SCIP_STAGE_PROBLEM, the original problem is copied,
960 * otherwise, the transformed problem is copied. For an explicit copy of the original problem, use SCIPcopyOrig().
962 * @note all variables and constraints which are created in the target-SCIP are not (user) captured
964 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
966 * @note the 'threadsafe' parameter should only be set to TRUE if you are absolutely certain that the source and target
967 * SCIP instances will be solved in parallel. The usual case is to set this to FALSE, since thread safety
973 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1003 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
1007 SCIP_Bool enablepricing, /**< should pricing be enabled in copied SCIP instance? If TRUE, pricer
1032 * The source problem depends on the stage of the \p sourcescip - In SCIP_STAGE_PROBLEM, the original problem is copied,
1033 * otherwise, the transformed problem is copied. For an explicit copy of the original problem, use SCIPcopyOrigConsCompression().
1038 * @note all variables and constraints which are created in the target-SCIP are not (user) captured
1040 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
1042 * @note the 'threadsafe' parameter should only be set to TRUE if you are absolutely certain that the source and target
1043 * SCIP instances will be solved in parallel. The usual case is to set this to FALSE, since thread safety
1049 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1079 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
1082 SCIP_VAR** fixedvars, /**< source variables whose copies should be fixed in the target SCIP environment, or NULL */
1084 int nfixedvars, /**< number of source variables whose copies should be fixed in the target SCIP environment, or NULL */
1086 SCIP_Bool enablepricing, /**< should pricing be enabled in copied SCIP instance? If TRUE, pricer
1096/** copies source SCIP original problem to target SCIP; the copying process is done in the following order:
1103 * @note all variables and constraints which are created in the target-SCIP are not (user) captured
1105 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
1107 * @note the 'threadsafe' parameter should only be set to TRUE if you are absolutely certain that the source and target
1108 * SCIP instances will be solved in parallel. The usual case is to set this to FALSE, since thread safety
1114 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1144 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
1146 const char* suffix, /**< suffix which will be added to the names of the target SCIP, might be empty */
1147 SCIP_Bool enablepricing, /**< should pricing be enabled in copied SCIP instance? If TRUE, pricer
1172 * @note all variables and constraints which are created in the target-SCIP are not (user) captured
1174 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
1176 * @note the 'threadsafe' parameter should only be set to TRUE if you are absolutely certain that the source and target
1177 * SCIP instances will be solved in parallel. The usual case is to set this to FALSE, since thread safety
1183 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1213 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
1216 SCIP_VAR** fixedvars, /**< source variables whose copies should be fixed in the target SCIP environment, or NULL */
1218 int nfixedvars, /**< number of source variables whose copies should be fixed in the target SCIP environment, or NULL */
1219 SCIP_Bool enablepricing, /**< should pricing be enabled in copied SCIP instance? If TRUE, pricer
1229/** checks if there is enough time and memory left for copying the sourcescip into a sub-SCIP and solve the sub-SCIP
1231 * This is the case if the time and memory limit that would be passed to the sub-SCIP are larger than 0.0
1255 * @note time and memory limit are reduced by the amount already spent in the source SCIP before installing the limit
1259 * @see SCIPsetCommonSubscipParams() to set further working limits and other parameters commonly used for auxiliary problems
1282 * @note memory and time limits are not affected, and must be set using SCIPcopyLimits() instead
common defines and data types used in all packages of SCIP
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 copycutselectors, SCIP_Bool copypropagators, SCIP_Bool copyheuristics, SCIP_Bool copyeventhdlrs, SCIP_Bool copynodeselectors, SCIP_Bool copybranchrules, SCIP_Bool copyiisfinders, SCIP_Bool copydisplays, SCIP_Bool copydialogs, SCIP_Bool copytables, SCIP_Bool copyexprhdlrs, SCIP_Bool copynlpis, SCIP_Bool passmessagehdlr, SCIP_Bool *valid)
Definition: scip_copy.c:276
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:2363
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:3044
void SCIPmergeNLPIStatistics(SCIP *sourcescip, SCIP *targetscip, SCIP_Bool reset)
Definition: scip_copy.c:1319
SCIP_RETCODE SCIPcopyBenders(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_Bool threadsafe, SCIP_Bool *valid)
Definition: scip_copy.c:359
SCIP_RETCODE SCIPtranslateSubSols(SCIP *scip, SCIP *subscip, SCIP_HEUR *heur, SCIP_VAR **subvars, SCIP_Bool *success, int *solindex)
Definition: scip_copy.c:1437
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:1224
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:1167
SCIP_RETCODE SCIPsetCommonSubscipParams(SCIP *sourcescip, SCIP *subscip, SCIP_Longint nsubnodes, SCIP_Longint nstallnodes, int bestsollimit)
Definition: scip_copy.c:3335
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:2865
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:3133
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:2961
SCIP_RETCODE SCIPcopyOrigConss(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool enablepricing, SCIP_Bool *valid)
Definition: scip_copy.c:1918
SCIP_RETCODE SCIPcheckCopyLimits(SCIP *sourcescip, SCIP_Bool *success)
Definition: scip_copy.c:3249
SCIP_RETCODE SCIPmergeVariableStatistics(SCIP *sourcescip, SCIP *targetscip, SCIP_VAR **sourcevars, SCIP_VAR **targetvars, int nvars)
Definition: scip_copy.c:1254
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:1580
SCIP_RETCODE SCIPcopyCuts(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global, int *ncutsadded)
Definition: scip_copy.c:2113
SCIP_RETCODE SCIPconvertCutsToConss(SCIP *scip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global, int *ncutsadded)
Definition: scip_copy.c:2051
SCIP_RETCODE SCIPenableConsCompression(SCIP *scip)
Definition: scip_copy.c:623
SCIP_RETCODE SCIPcopyProb(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global, const char *name)
Definition: scip_copy.c:529
SCIP_RETCODE SCIPtranslateSubSol(SCIP *scip, SCIP *subscip, SCIP_SOL *subsol, SCIP_HEUR *heur, SCIP_VAR **subvars, SCIP_SOL **newsol)
Definition: scip_copy.c:1397
SCIP_Bool SCIPisConsCompressionEnabled(SCIP *scip)
Definition: scip_copy.c:662
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:1716
SCIP_RETCODE SCIPcopyParamSettings(SCIP *sourcescip, SCIP *targetscip)
Definition: scip_copy.c:2547
SCIP_RETCODE SCIPcopyLimits(SCIP *sourcescip, SCIP *targetscip)
Definition: scip_copy.c:3292
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:713
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:2205
SCIP_RETCODE SCIPcopyOrigProb(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, const char *name)
Definition: scip_copy.c:582
Definition: multiprecision.hpp:66
static SCIP_RETCODE separate(SCIP *scip, SCIP_SEPA *sepa, SCIP_SOL *sol, SCIP_RESULT *result)
Main separation function.
Definition: sepa_flower.c:1221
Definition: struct_cons.h:47
Definition: struct_cons.h:128
Definition: struct_misc.h:139
Definition: struct_heur.h:98
Definition: struct_sol.h:74
Definition: struct_var.h:262
Definition: struct_scip.h:72
type definitions for constraints and constraint handlers
type definitions for miscellaneous datastructures
type definitions for return codes for SCIP methods
type definitions for SCIP's main datastructure
type definitions for problem variables