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
128 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
129 * @note the 'threadsafe' parameter must be set to TRUE if you are absolutely certain that the source and target
130 * SCIP instances will be solved in parallel. The usual case is to set this to FALSE, since thread safety
133 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
151 * @post After calling this method targetscip reaches one of the following stages depending on if and when the solution
172 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
174 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
201 * @post After calling this method targetscip reaches one of the following stages depending on if and when the solution
215 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
223 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
225 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
243 * @post After calling this method targetscip reaches one of the following stages depending on if and when the solution
257 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
267 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
308 /** returns copy of the source variable; if there already is a copy of the source variable in the variable hash map,
309 * it is just returned as target variable; otherwise, if the variables it not marked as relaxation-only, a new variable
310 * will be created and added to the target SCIP; this created variable is added to the variable hash map and returned as target variable;
313 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
315 * @note if a new variable was created, this variable will be added to the target-SCIP, but it is not captured
317 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
351 SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables to the corresponding
353 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
359 /** Copies all active (thus unfixed) variables from source-SCIP, except those that are marked as relaxation only,
368 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
371 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
398 SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables to the corresponding
400 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
402 SCIP_VAR** fixedvars, /**< source variables whose copies should be fixed in the target SCIP environment, or NULL */
404 int nfixedvars, /**< number of source variables whose copies should be fixed in the target SCIP environment, or NULL */
408 /** copies all original variables from source-SCIP and adds these variable to the target-SCIP; the mapping between these
409 * variables are stored in the variable hashmap, target-SCIP has to be in problem creation stage, fixed and aggregated
414 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
417 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
444 SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables to the corresponding
446 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
448 SCIP_VAR** fixedvars, /**< source variables whose copies should be fixed in the target SCIP environment, or NULL */
450 int nfixedvars /**< number of source variables whose copies should be fixed in the target SCIP environment, or NULL */
453 /** merges the histories of variables from a source SCIP into a target SCIP. The two data structures should point to
456 * @note the notion of source and target is inverted here; \p sourcescip usually denotes a copied SCIP instance, whereas
473 * @note the notion of source and target is inverted here; \p sourcescip usually denotes a copied SCIP instance, whereas
485 * Variables that are relaxation-only in the master SCIP are set to 0 or the bound closest to 0. Such variables
488 * @note This method allocates a new solution of the main scip that needs to be freed by the user.
496 SCIP_VAR** subvars, /**< the variables from the subproblem in the same order as the main scip */
500 /** checks the solutions from the subscip and adds the first one that is found feasible to the master SCIP
502 * Variables that are relaxation-only in the master SCIP are set to 0 or the bound closest to 0. Such variables
510 SCIP_VAR** subvars, /**< the variables from the subproblem in the same order as the main scip */
512 int* solindex /**< pointer to store solution index of stored solution, or NULL if not of interest */
515 /** returns copy of the source constraint; if there already is a copy of the source constraint in the constraint hash
516 * map, it is just returned as target constraint; elsewise a new constraint will be created; this created constraint is
517 * added to the constraint hash map and returned as target constraint; the variable map is used to map the variables of
520 * @warning If a constraint is marked to be checked for feasibility but not to be enforced, a LP or pseudo solution may
521 * be declared feasible even if it violates this particular constraint. This constellation should only be
522 * used, if no LP or pseudo solution can violate the constraint -- e.g. if a local constraint is redundant due
525 * @note The constraint is not added to the target SCIP. You can check whether a constraint is added by calling
526 * SCIPconsIsAdded(). (If you mix SCIPgetConsCopy() with SCIPcopyConss() you should pay attention to what you add
529 * @note The constraint is always captured, either during the creation of the copy or after finding the copy of the
532 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
535 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
572 SCIP_HASHMAP* varmap, /**< a SCIP_HASHMAP mapping variables of the source SCIP to the corresponding
574 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
576 const char* name, /**< name of constraint, or NULL if the name of the source constraint should be used */
585 SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup? */
586 SCIP_Bool stickingatnode, /**< should the constraint always be kept at the node where it was added, even
593 * variables between the source and the target SCIP a hash map can be given; if the variable hash
594 * map is NULL or necessary variable mapping is missing, the required variables are created in the
595 * target-SCIP and added to the hash map, if not NULL; all variables which are created are added to
599 * *valid is set to TRUE iff all constraints that are marked as checked or enforced were copied successfully.
602 * @note the constraints are added to the target-SCIP but are not (user) captured in the target SCIP. (If you mix
603 * SCIPgetConsCopy() with SCIPcopyConss() you should pay attention to what you add explicitly and what is already
606 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
609 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
636 SCIP_HASHMAP* varmap, /**< a SCIP_HASHMAP mapping variables of the source SCIP to the corresponding
638 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
643 SCIP_Bool* valid /**< pointer to store whether all checked or enforced constraints were validly copied */
646 /** copies all original constraints from the source-SCIP and adds these to the target-SCIP; for mapping the
647 * variables between the source and the target SCIP a hash map can be given; if the variable hash
648 * map is NULL or necessary variable mapping is missing, the required variables are created in the
649 * target-SCIP and added to the hash map, if not NULL; all variables which are created are added to
653 * @note the constraints are added to the target-SCIP but are not (user) captured in the target SCIP. (If you mix
654 * SCIPgetConsCopy() with SCIPcopyConss() you should pay attention to what you add explicitly and what is already
657 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
660 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
687 SCIP_HASHMAP* varmap, /**< a SCIP_HASHMAP mapping variables of the source SCIP to the corresponding
689 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
700 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
721 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
731 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
734 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
769 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
775 /** copies all active conflicts from the conflict pool of sourcescip and adds them as linear constraints to targetscip
777 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
780 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
815 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
825 * This function should be called for a targetscip in transformed stage. It can save time in presolving of the
828 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
831 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
865 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
875 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
878 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
958 * The source problem depends on the stage of the \p sourcescip - In SCIP_STAGE_PROBLEM, the original problem is copied,
959 * otherwise, the transformed problem is copied. For an explicit copy of the original problem, use SCIPcopyOrig().
961 * @note all variables and constraints which are created in the target-SCIP are not (user) captured
963 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
965 * @note the 'threadsafe' parameter should only be set to TRUE if you are absolutely certain that the source and target
966 * SCIP instances will be solved in parallel. The usual case is to set this to FALSE, since thread safety
970 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1000 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
1004 SCIP_Bool enablepricing, /**< should pricing be enabled in copied SCIP instance? If TRUE, pricer
1029 * The source problem depends on the stage of the \p sourcescip - In SCIP_STAGE_PROBLEM, the original problem is copied,
1030 * otherwise, the transformed problem is copied. For an explicit copy of the original problem, use SCIPcopyOrigConsCompression().
1035 * @note all variables and constraints which are created in the target-SCIP are not (user) captured
1037 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
1039 * @note the 'threadsafe' parameter should only be set to TRUE if you are absolutely certain that the source and target
1040 * SCIP instances will be solved in parallel. The usual case is to set this to FALSE, since thread safety
1044 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1074 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
1077 SCIP_VAR** fixedvars, /**< source variables whose copies should be fixed in the target SCIP environment, or NULL */
1079 int nfixedvars, /**< number of source variables whose copies should be fixed in the target SCIP environment, or NULL */
1081 SCIP_Bool enablepricing, /**< should pricing be enabled in copied SCIP instance? If TRUE, pricer
1091 /** copies source SCIP original problem to target SCIP; the copying process is done in the following order:
1098 * @note all variables and constraints which are created in the target-SCIP are not (user) captured
1100 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
1102 * @note the 'threadsafe' parameter should only be set to TRUE if you are absolutely certain that the source and target
1103 * SCIP instances will be solved in parallel. The usual case is to set this to FALSE, since thread safety
1107 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1137 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
1139 const char* suffix, /**< suffix which will be added to the names of the target SCIP, might be empty */
1140 SCIP_Bool enablepricing, /**< should pricing be enabled in copied SCIP instance? If TRUE, pricer
1165 * @note all variables and constraints which are created in the target-SCIP are not (user) captured
1167 * @note In a multi thread case, you need to lock the copying procedure from outside with a mutex.
1169 * @note the 'threadsafe' parameter should only be set to TRUE if you are absolutely certain that the source and target
1170 * SCIP instances will be solved in parallel. The usual case is to set this to FALSE, since thread safety
1174 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
1204 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
1207 SCIP_VAR** fixedvars, /**< source variables whose copies should be fixed in the target SCIP environment, or NULL */
1209 int nfixedvars, /**< number of source variables whose copies should be fixed in the target SCIP environment, or NULL */
1210 SCIP_Bool enablepricing, /**< should pricing be enabled in copied SCIP instance? If TRUE, pricer
1220 /** checks if there is enough time and memory left for copying the sourcescip into a sub-SCIP and solve the sub-SCIP
1222 * This is the case if the time and memory limit that would be passed to the sub-SCIP are larger than 0.0
1246 * @note time and memory limit are reduced by the amount already spent in the source SCIP before installing the limit
1250 * @see SCIPsetCommonSubscipParams() to set further working limits and other parameters commonly used for auxiliary problems
1274 * @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:580
type definitions for miscellaneous datastructures
Definition: struct_scip.h:69
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:2875
Definition: struct_var.h:207
SCIP_RETCODE SCIPconvertCutsToConss(SCIP *scip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global, int *ncutsadded)
Definition: scip_copy.c:2068
SCIP_RETCODE SCIPcopyLimits(SCIP *sourcescip, SCIP *targetscip)
Definition: scip_copy.c:3296
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:3050
SCIP_RETCODE SCIPtranslateSubSol(SCIP *scip, SCIP *subscip, SCIP_SOL *subsol, SCIP_HEUR *heur, SCIP_VAR **subvars, SCIP_SOL **newsol)
Definition: scip_copy.c:1408
SCIP_RETCODE SCIPtranslateSubSols(SCIP *scip, SCIP *subscip, SCIP_HEUR *heur, SCIP_VAR **subvars, SCIP_Bool *success, int *solindex)
Definition: scip_copy.c:1448
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:275
SCIP_RETCODE SCIPcopyParamSettings(SCIP *sourcescip, SCIP *targetscip)
Definition: scip_copy.c:2564
SCIP_RETCODE SCIPcopyBenders(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_Bool threadsafe, SCIP_Bool *valid)
Definition: scip_copy.c:357
Definition: struct_sol.h:73
SCIP_RETCODE SCIPcopyOrigConss(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool enablepricing, SCIP_Bool *valid)
Definition: scip_copy.c:1935
SCIP_RETCODE SCIPenableConsCompression(SCIP *scip)
Definition: scip_copy.c:621
Definition: struct_misc.h:137
Definition: struct_cons.h:46
Definition: struct_cons.h:126
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:1178
SCIP_RETCODE SCIPcopyCuts(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global, int *ncutsadded)
Definition: scip_copy.c:2130
SCIP_RETCODE SCIPmergeVariableStatistics(SCIP *sourcescip, SCIP *targetscip, SCIP_VAR **sourcevars, SCIP_VAR **targetvars, int nvars)
Definition: scip_copy.c:1265
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:1235
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:2380
Definition: struct_heur.h:97
SCIP_RETCODE SCIPsetCommonSubscipParams(SCIP *sourcescip, SCIP *subscip, SCIP_Longint nsubnodes, SCIP_Longint nstallnodes, int bestsollimit)
Definition: scip_copy.c:3339
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:2222
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:1591
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:2969
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:1730
SCIP_RETCODE SCIPcopyProb(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global, const char *name)
Definition: scip_copy.c:527
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:3137
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:711
SCIP_Bool SCIPisConsCompressionEnabled(SCIP *scip)
Definition: scip_copy.c:660
SCIP_RETCODE SCIPcheckCopyLimits(SCIP *sourcescip, SCIP_Bool *success)
Definition: scip_copy.c:3253
void SCIPmergeNLPIStatistics(SCIP *sourcescip, SCIP *targetscip, SCIP_Bool reset)
Definition: scip_copy.c:1330
common defines and data types used in all packages of SCIP
Definition: objbenders.h:43
type definitions for constraints and constraint handlers