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
119 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
120 * @note the 'threadsafe' parameter must be set to TRUE if you are absolutely certain that the source and target
121 * SCIP instances will be solved in parallel. The usual case is to set this to FALSE, since thread safety
124 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
142 * @post After calling this method targetscip reaches one of the following stages depending on if and when the solution
163 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
165 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
192 * @post After calling this method targetscip reaches one of the following stages depending on if and when the solution
206 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
214 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
216 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
234 * @post After calling this method targetscip reaches one of the following stages depending on if and when the solution
248 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
258 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
299 /** returns copy of the source variable; if there already is a copy of the source variable in the variable hash map,
300 * it is just returned as target variable; otherwise, if the variables it not marked as relaxation-only, a new variable
301 * will be created and added to the target SCIP; this created variable is added to the variable hash map and returned as target variable;
304 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
306 * @note if a new variable was created, this variable will be added to the target-SCIP, but it is not captured
308 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
342 SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables to the corresponding
344 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
350 /** Copies all active (thus unfixed) variables from source-SCIP, except those that are marked as relaxation only,
359 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
362 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
389 SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables to the corresponding
391 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
393 SCIP_VAR** fixedvars, /**< source variables whose copies should be fixed in the target SCIP environment, or NULL */
395 int nfixedvars, /**< number of source variables whose copies should be fixed in the target SCIP environment, or NULL */
399 /** copies all original variables from source-SCIP and adds these variable to the target-SCIP; the mapping between these
400 * variables are stored in the variable hashmap, target-SCIP has to be in problem creation stage, fixed and aggregated
405 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
408 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
435 SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables to the corresponding
437 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
439 SCIP_VAR** fixedvars, /**< source variables whose copies should be fixed in the target SCIP environment, or NULL */
441 int nfixedvars /**< number of source variables whose copies should be fixed in the target SCIP environment, or NULL */
444 /** merges the histories of variables from a source SCIP into a target SCIP. The two data structures should point to
447 * @note the notion of source and target is inverted here; \p sourcescip usually denotes a copied SCIP instance, whereas
464 * @note the notion of source and target is inverted here; \p sourcescip usually denotes a copied SCIP instance, whereas
476 * Variables that are relaxation-only in the master SCIP are set to 0 or the bound closest to 0. Such variables
479 * @note This method allocates a new solution of the main \p scip that needs to be freed by the user.
487 SCIP_VAR** subvars, /**< the variables from the subproblem in the same order as the main \p scip */
491 /** checks the solutions from the subscip and adds the first one that is found feasible to the master SCIP
493 * Variables that are relaxation-only in the master SCIP are set to 0 or the bound closest to 0. Such variables
501 SCIP_VAR** subvars, /**< the variables from the subproblem in the same order as the main \p scip */
503 int* solindex /**< pointer to store solution index of stored solution, or NULL if not of interest */
506 /** returns copy of the source constraint; if there already is a copy of the source constraint in the constraint hash
507 * map, it is just returned as target constraint; elsewise a new constraint will be created; this created constraint is
508 * added to the constraint hash map and returned as target constraint; the variable map is used to map the variables of
511 * @warning If a constraint is marked to be checked for feasibility but not to be enforced, a LP or pseudo solution may
512 * be declared feasible even if it violates this particular constraint. This constellation should only be
513 * used, if no LP or pseudo solution can violate the constraint -- e.g. if a local constraint is redundant due
516 * @note The constraint is not added to the target SCIP. You can check whether a constraint is added by calling
517 * SCIPconsIsAdded(). (If you mix SCIPgetConsCopy() with SCIPcopyConss() you should pay attention to what you add
520 * @note The constraint is always captured, either during the creation of the copy or after finding the copy of the
523 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
526 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
563 SCIP_HASHMAP* varmap, /**< a SCIP_HASHMAP mapping variables of the source SCIP to the corresponding
565 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
567 const char* name, /**< name of constraint, or NULL if the name of the source constraint should be used */
576 SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup? */
577 SCIP_Bool stickingatnode, /**< should the constraint always be kept at the node where it was added, even
584 * variables between the source and the target SCIP a hash map can be given; if the variable hash
585 * map is NULL or necessary variable mapping is missing, the required variables are created in the
586 * target-SCIP and added to the hash map, if not NULL; all variables which are created are added to
590 * *valid is set to TRUE iff all constraints that are marked as checked or enforced were copied successfully.
593 * @note the constraints are added to the target-SCIP but are not (user) captured in the target SCIP. (If you mix
594 * SCIPgetConsCopy() with SCIPcopyConss() you should pay attention to what you add explicitly and what is already
597 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
600 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
627 SCIP_HASHMAP* varmap, /**< a SCIP_HASHMAP mapping variables of the source SCIP to the corresponding
629 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
634 SCIP_Bool* valid /**< pointer to store whether all checked or enforced constraints were validly copied */
637 /** copies all original constraints from the source-SCIP and adds these to the target-SCIP; for mapping the
638 * variables between the source and the target SCIP a hash map can be given; if the variable hash
639 * map is NULL or necessary variable mapping is missing, the required variables are created in the
640 * target-SCIP and added to the hash map, if not NULL; all variables which are created are added to
644 * @note the constraints are added to the target-SCIP but are not (user) captured in the target SCIP. (If you mix
645 * SCIPgetConsCopy() with SCIPcopyConss() you should pay attention to what you add explicitly and what is already
648 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
651 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
678 SCIP_HASHMAP* varmap, /**< a SCIP_HASHMAP mapping variables of the source SCIP to the corresponding
680 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
691 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
712 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
722 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
725 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
760 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
766 /** copies all active conflicts from the conflict pool of sourcescip and adds them as linear constraints to targetscip
768 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
771 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
806 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
816 * This function should be called for a targetscip in transformed stage. It can save time in presolving of the
819 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
822 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
856 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
866 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
869 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
949 * The source problem depends on the stage of the \p sourcescip - In SCIP_STAGE_PROBLEM, the original problem is copied,
950 * otherwise, the transformed problem is copied. For an explicit copy of the original problem, use SCIPcopyOrig().
952 * @note all variables and constraints which are created in the target-SCIP are not (user) captured
954 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
956 * @note the 'threadsafe' parameter should only be set to TRUE if you are absolutely certain that the source and target
957 * SCIP instances will be solved in parallel. The usual case is to set this to FALSE, since thread safety
961 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
991 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
995 SCIP_Bool enablepricing, /**< should pricing be enabled in copied SCIP instance? If TRUE, pricer
1020 * The source problem depends on the stage of the \p sourcescip - In SCIP_STAGE_PROBLEM, the original problem is copied,
1021 * otherwise, the transformed problem is copied. For an explicit copy of the original problem, use SCIPcopyOrigConsCompression().
1026 * @note all variables and constraints which are created in the target-SCIP are not (user) captured
1028 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
1030 * @note the 'threadsafe' parameter should only be set to TRUE if you are absolutely certain that the source and target
1031 * SCIP instances will be solved in parallel. The usual case is to set this to FALSE, since thread safety
1035 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1065 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
1068 SCIP_VAR** fixedvars, /**< source variables whose copies should be fixed in the target SCIP environment, or NULL */
1070 int nfixedvars, /**< number of source variables whose copies should be fixed in the target SCIP environment, or NULL */
1072 SCIP_Bool enablepricing, /**< should pricing be enabled in copied SCIP instance? If TRUE, pricer
1082 /** copies source SCIP original problem to target SCIP; the copying process is done in the following order:
1089 * @note all variables and constraints which are created in the target-SCIP are not (user) captured
1091 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
1093 * @note the 'threadsafe' parameter should only be set to TRUE if you are absolutely certain that the source and target
1094 * SCIP instances will be solved in parallel. The usual case is to set this to FALSE, since thread safety
1098 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1128 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
1130 const char* suffix, /**< suffix which will be added to the names of the target SCIP, might be empty */
1131 SCIP_Bool enablepricing, /**< should pricing be enabled in copied SCIP instance? If TRUE, pricer
1156 * @note all variables and constraints which are created in the target-SCIP are not (user) captured
1158 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
1160 * @note the 'threadsafe' parameter should only be set to TRUE if you are absolutely certain that the source and target
1161 * SCIP instances will be solved in parallel. The usual case is to set this to FALSE, since thread safety
1165 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1195 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
1198 SCIP_VAR** fixedvars, /**< source variables whose copies should be fixed in the target SCIP environment, or NULL */
1200 int nfixedvars, /**< number of source variables whose copies should be fixed in the target SCIP environment, or NULL */
1201 SCIP_Bool enablepricing, /**< should pricing be enabled in copied SCIP instance? If TRUE, pricer
1211 /** checks if there is enough time and memory left for copying the sourcescip into a sub-SCIP and solve the sub-SCIP
1213 * This is the case if the time and memory limit that would be passed to the sub-SCIP are larger than 0.0
1237 * @note time and memory limit are reduced by the amount already spent in the source SCIP before installing the limit
1241 * @see SCIPsetCommonSubscipParams() to set further working limits and other parameters commonly used for auxiliary problems
1265 * @note memory and time limits are not affected, and must be set using SCIPcopyLimits() instead
SCIP_RETCODE SCIPcopyOrigProb(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, const char *name)
Definition: scip_copy.c:571
type definitions for miscellaneous datastructures
Definition: struct_scip.h:59
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:2857
Definition: struct_var.h:198
SCIP_RETCODE SCIPconvertCutsToConss(SCIP *scip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global, int *ncutsadded)
Definition: scip_copy.c:2054
SCIP_RETCODE SCIPcopyLimits(SCIP *sourcescip, SCIP *targetscip)
Definition: scip_copy.c:3278
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:3032
SCIP_RETCODE SCIPtranslateSubSol(SCIP *scip, SCIP *subscip, SCIP_SOL *subsol, SCIP_HEUR *heur, SCIP_VAR **subvars, SCIP_SOL **newsol)
Definition: scip_copy.c:1399
SCIP_RETCODE SCIPtranslateSubSols(SCIP *scip, SCIP *subscip, SCIP_HEUR *heur, SCIP_VAR **subvars, SCIP_Bool *success, int *solindex)
Definition: scip_copy.c:1439
type definitions for return codes for SCIP methods
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 copydisplays, SCIP_Bool copydialogs, SCIP_Bool copytables, SCIP_Bool copyexprhdlrs, SCIP_Bool copynlpis, SCIP_Bool passmessagehdlr, SCIP_Bool *valid)
Definition: scip_copy.c:266
SCIP_RETCODE SCIPcopyParamSettings(SCIP *sourcescip, SCIP *targetscip)
Definition: scip_copy.c:2550
SCIP_RETCODE SCIPcopyBenders(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_Bool threadsafe, SCIP_Bool *valid)
Definition: scip_copy.c:348
Definition: struct_sol.h:64
SCIP_RETCODE SCIPcopyOrigConss(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool enablepricing, SCIP_Bool *valid)
Definition: scip_copy.c:1921
SCIP_RETCODE SCIPenableConsCompression(SCIP *scip)
Definition: scip_copy.c:612
Definition: struct_misc.h:128
Definition: struct_cons.h:37
Definition: struct_cons.h:117
type definitions for SCIP'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:1169
SCIP_RETCODE SCIPcopyCuts(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global, int *ncutsadded)
Definition: scip_copy.c:2116
SCIP_RETCODE SCIPmergeVariableStatistics(SCIP *sourcescip, SCIP *targetscip, SCIP_VAR **sourcevars, SCIP_VAR **targetvars, int nvars)
Definition: scip_copy.c:1256
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:1226
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:2366
Definition: struct_heur.h:88
SCIP_RETCODE SCIPsetCommonSubscipParams(SCIP *sourcescip, SCIP *subscip, SCIP_Longint nsubnodes, SCIP_Longint nstallnodes, int bestsollimit)
Definition: scip_copy.c:3319
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:2208
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:1577
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:2951
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 SCIPcopyProb(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global, const char *name)
Definition: scip_copy.c:518
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:3119
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:702
SCIP_Bool SCIPisConsCompressionEnabled(SCIP *scip)
Definition: scip_copy.c:651
SCIP_RETCODE SCIPcheckCopyLimits(SCIP *sourcescip, SCIP_Bool *success)
Definition: scip_copy.c:3235
void SCIPmergeNLPIStatistics(SCIP *sourcescip, SCIP *targetscip, SCIP_Bool reset)
Definition: scip_copy.c:1321
common defines and data types used in all packages of SCIP
Definition: objbenders.h:33
type definitions for constraints and constraint handlers