All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
type_cons.h File Reference Detailed Descriptiontype definitions for constraints and constraint handlers This file defines the interface for constraint handlers implemented in C.
Definition in file type_cons.h. #include "scip/def.h" #include "scip/type_retcode.h" #include "scip/type_result.h" #include "scip/type_var.h" #include "scip/type_sol.h" #include "scip/type_scip.h" #include "scip/type_timing.h" Go to the source code of this file.
Macro Definition Documentation
copy method for constraint handler plugins (called when SCIP copies plugins) If the copy process was a one to one the valid pointer can set to TRUE. Otherwise, you have to set this pointer to FALSE. In case all problem defining objects (constraint handlers and variable pricers) return a valid TRUE for all their copying calls, SCIP assumes that it is a overall one to one copy of the original instance. In this case any reductions made in the copied SCIP instance can be transfer to the original SCIP instance. If the valid pointer is set to TRUE and it was not one to one copy, it might happen that optimal solutions are cut off. input:
Definition at line 65 of file type_cons.h.
destructor of constraint handler to free constraint handler data (called when SCIP is exiting) input:
Definition at line 73 of file type_cons.h.
initialization method of constraint handler (called after problem was transformed) input:
Definition at line 83 of file type_cons.h.
deinitialization method of constraint handler (called before transformed problem is freed) input:
Definition at line 93 of file type_cons.h.
presolving initialization method of constraint handler (called when presolving is about to begin) This method is called when the presolving process is about to begin, even if presolving is turned off. The constraint handler may use this call to initialize its data structures. Necessary modifications that have to be performed even if presolving is turned off should be done here or in the presolving deinitialization call (SCIP_DECL_CONSEXITPRE()).
input:
Definition at line 113 of file type_cons.h.
presolving deinitialization method of constraint handler (called after presolving has been finished) This method is called after the presolving has been finished, even if presolving is turned off. The constraint handler may use this call e.g. to clean up or modify its data structures. Necessary modifications that have to be performed even if presolving is turned off should be done here or in the presolving initialization call (SCIP_DECL_CONSINITPRE()). Besides necessary modifications and clean up, no time consuming operations should be performed, especially if the problem has already been solved. Use the method SCIPgetStatus(), which in this case returns SCIP_STATUS_OPTIMAL, SCIP_STATUS_INFEASIBLE, SCIP_STATUS_UNBOUNDED, or SCIP_STATUS_INFORUNBD.
input:
Definition at line 137 of file type_cons.h.
solving process initialization method of constraint handler (called when branch and bound process is about to begin) This method is called when the presolving was finished and the branch and bound process is about to begin. The constraint handler may use this call to initialize its branch and bound specific data. Besides necessary modifications and clean up, no time consuming operations should be performed, especially if the problem has already been solved. Use the method SCIPgetStatus(), which in this case returns SCIP_STATUS_OPTIMAL, SCIP_STATUS_INFEASIBLE, SCIP_STATUS_UNBOUNDED, or SCIP_STATUS_INFORUNBD.
input:
Definition at line 158 of file type_cons.h.
solving process deinitialization method of constraint handler (called before branch and bound process data is freed) This method is called before the branch and bound process is freed. The constraint handler should use this call to clean up its branch and bound data, in particular to release all LP rows that he has created or captured. input:
Definition at line 173 of file type_cons.h.
frees specific constraint data
input:
Definition at line 186 of file type_cons.h.
transforms constraint data into data belonging to the transformed problem input:
Definition at line 196 of file type_cons.h.
LP initialization method of constraint handler (called before the initial LP relaxation at a node is solved) Puts the LP relaxations of all "initial" constraints into the LP. The method should put a canonic LP relaxation of all given constraints to the LP with calls to SCIPaddCut(). input:
Definition at line 209 of file type_cons.h.
Value:
separation method of constraint handler for LP solution Separates all constraints of the constraint handler. The method is called in the LP solution loop, which means that a valid LP solution exists. The first nusefulconss constraints are the ones, that are identified to likely be violated. The separation method should process only the useful constraints in most runs, and only occasionally the remaining nconss - nusefulconss constraints. input:
possible return values for *result (if more than one applies, the first in the list should be used):
Definition at line 238 of file type_cons.h.
Value:
separation method of constraint handler for arbitrary primal solution Separates all constraints of the constraint handler. The method is called outside the LP solution loop (e.g., by a relaxator or a primal heuristic), which means that there is no valid LP solution. Instead, the method should produce cuts that separate the given solution. The first nusefulconss constraints are the ones, that are identified to likely be violated. The separation method should process only the useful constraints in most runs, and only occasionally the remaining nconss - nusefulconss constraints. input:
possible return values for *result (if more than one applies, the first in the list should be used):
Definition at line 270 of file type_cons.h.
Value:
SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, int nusefulconss, \
SCIP_Bool solinfeasible, SCIP_RESULT* result)
constraint enforcing method of constraint handler for LP solutions The method is called at the end of the node processing loop for a node where the LP was solved. The LP solution has to be checked for feasibility. If possible, an infeasibility should be resolved by branching, reducing a variable's domain to exclude the solution or separating the solution with a valid cutting plane. The enforcing methods of the active constraint handlers are called in decreasing order of their enforcing priorities until the first constraint handler returned with the value SCIP_CUTOFF, SCIP_SEPARATED, SCIP_REDUCEDDOM, SCIP_CONSADDED, or SCIP_BRANCHED. The integrality constraint handler has an enforcing priority of zero. A constraint handler which can (or wants) to enforce its constraints only for integral solutions should have a negative enforcing priority (e.g. the alldiff-constraint can only operate on integral solutions). A constraint handler which wants to incorporate its own branching strategy even on non-integral solutions must have an enforcing priority greater than zero (e.g. the SOS-constraint incorporates SOS-branching on non-integral solutions). The first nusefulconss constraints are the ones, that are identified to likely be violated. The enforcing method should process the useful constraints first. The other nconss - nusefulconss constraints should only be enforced, if no violation was found in the useful constraints. input:
possible return values for *result (if more than one applies, the first in the list should be used):
Definition at line 312 of file type_cons.h.
Value:
SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, int nusefulconss, \
constraint enforcing method of constraint handler for pseudo solutions The method is called at the end of the node processing loop for a node where the LP was not solved. The pseudo solution has to be checked for feasibility. If possible, an infeasibility should be resolved by branching, reducing a variable's domain to exclude the solution or adding an additional constraint. Separation is not possible, since the LP is not processed at the current node. All LP informations like LP solution, slack values, or reduced costs are invalid and must not be accessed. Like in the enforcing method for LP solutions, the enforcing methods of the active constraint handlers are called in decreasing order of their enforcing priorities until the first constraint handler returned with the value SCIP_CUTOFF, SCIP_REDUCEDDOM, SCIP_CONSADDED, SCIP_BRANCHED, or SCIP_SOLVELP. The first nusefulconss constraints are the ones, that are identified to likely be violated. The enforcing method should process the useful constraints first. The other nconss - nusefulconss constraints should only be enforced, if no violation was found in the useful constraints. If the pseudo solution's objective value is lower than the lower bound of the node, it cannot be feasible and the enforcing method may skip it's check and set *result to SCIP_DIDNOTRUN. However, it can also process its constraints and return any other possible result code. input:
possible return values for *result (if more than one applies, the first in the list should be used):
Definition at line 355 of file type_cons.h.
Value:
SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, SCIP_SOL* sol, \
feasibility check method of constraint handler for integral solutions The given solution has to be checked for feasibility. The check methods of the active constraint handlers are called in decreasing order of their check priorities until the first constraint handler returned with the result SCIP_INFEASIBLE. The integrality constraint handler has a check priority of zero. A constraint handler which can (or wants) to check its constraints only for integral solutions should have a negative check priority (e.g. the alldiff-constraint can only operate on integral solutions). A constraint handler which wants to check feasibility even on non-integral solutions must have a check priority greater than zero (e.g. if the check is much faster than testing all variables for integrality). In some cases, integrality conditions or rows of the current LP don't have to be checked, because their feasibility is already checked or implicitly given. In these cases, 'checkintegrality' or 'checklprows' is FALSE. input:
possible return values for *result:
Definition at line 390 of file type_cons.h.
Value:
SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, int nusefulconss, int nmarkedconss, \
SCIP_PROPTIMING proptiming, SCIP_RESULT* result)
domain propagation method of constraint handler The first nusefulconss constraints are the ones, that are identified to likely be violated. The propagation method should process only the useful constraints in most runs, and only occasionally the remaining nconss - nusefulconss constraints. input:
possible return values for *result:
Definition at line 416 of file type_cons.h.
Value:
int nnewfixedvars, int nnewaggrvars, int nnewchgvartypes, int nnewchgbds, int nnewholes, \
int nnewdelconss, int nnewaddconss, int nnewupgdconss, int nnewchgcoefs, int nnewchgsides, \
int* nfixedvars, int* naggrvars, int* nchgvartypes, int* nchgbds, int* naddholes, \
int* ndelconss, int* naddconss, int* nupgdconss, int* nchgcoefs, int* nchgsides, SCIP_RESULT* result)
presolving method of constraint handler The presolver should go through the variables and constraints and tighten the domains or constraints. Each tightening should increase the given total number of changes. input:
input/output:
output:
possible return values for *result:
Definition at line 470 of file type_cons.h.
Value:
SCIP_VAR* infervar, int inferinfo, SCIP_BOUNDTYPE boundtype, SCIP_BDCHGIDX* bdchgidx, SCIP_Real relaxedbd, \
SCIP_RESULT* result)
propagation conflict resolving method of constraint handler This method is called during conflict analysis. If the constraint handler wants to support conflict analysis, it should call SCIPinferVarLbCons() or SCIPinferVarUbCons() in domain propagation instead of SCIPchgVarLb() or SCIPchgVarUb() in order to deduce bound changes on variables. In the SCIPinferVarLbCons() and SCIPinferVarUbCons() calls, the handler provides the constraint, that deduced the variable's bound change, and an integer value "inferinfo" that can be arbitrarily chosen. The propagation conflict resolving method can then be implemented, to provide a "reasons" for the bound changes, i.e. the bounds of variables at the time of the propagation, that forced the constraint to set the conflict variable's bound to its current value. It can use the "inferinfo" tag to identify its own propagation rule and thus identify the "reason" bounds. The bounds that form the reason of the assignment must then be provided by calls to SCIPaddConflictLb(), SCIPaddConflictUb(), SCIPaddConflictBd(), SCIPaddConflictRelaxedLb(), SCIPaddConflictRelaxedUb(), SCIPaddConflictRelaxedBd(), and/or SCIPaddConflictBinvar() in the propagation conflict resolving method. For example, the logicor constraint c = "x or y or z" fixes variable z to TRUE (i.e. changes the lower bound of z to 1.0), if both, x and y, are assigned to FALSE (i.e. if the upper bounds of these variables are 0.0). It uses SCIPinferVarLbCons(scip, z, 1.0, c, 0) to apply this assignment (an inference information tag is not needed by the constraint handler and is set to 0). In the conflict analysis, the constraint handler may be asked to resolve the lower bound change on z with constraint c, that was applied at a time given by a bound change index "bdchgidx". With a call to SCIPvarGetLbAtIndex(z, bdchgidx, TRUE), the handler can find out, that the lower bound of variable z was set to 1.0 at the given point of time, and should call SCIPaddConflictUb(scip, x, bdchgidx) and SCIPaddConflictUb(scip, y, bdchgidx) to tell SCIP, that the upper bounds of x and y at this point of time were the reason for the deduction of the lower bound of z. input:
output:
possible return values for *result:
Definition at line 521 of file type_cons.h.
variable rounding lock method of constraint handler This method is called, after a constraint is added or removed from the transformed problem. It should update the rounding locks of all associated variables with calls to SCIPaddVarLocks(), depending on the way, the variable is involved in the constraint:
Consider the linear constraint "3x -5y +2z <= 7" as an example. The variable rounding lock method of the linear constraint handler should call SCIPaddVarLocks(scip, x, nlocksneg, nlockspos), SCIPaddVarLocks(scip, y, nlockspos, nlocksneg) and SCIPaddVarLocks(scip, z, nlocksneg, nlockspos) to tell SCIP, that rounding up of x and z and rounding down of y can destroy the feasibility of the constraint, while rounding down of x and z and rounding up of y can destroy the feasibility of the constraint's negation "3x -5y +2z > 7". A linear constraint "2 <= 3x -5y +2z <= 7" should call SCIPaddVarLocks(scip, ..., nlockspos + nlocksneg, nlockspos + nlocksneg) on all variables, since rounding in both directions of each variable can destroy both the feasibility of the constraint and it's negation "3x -5y +2z < 2 or 3x -5y +2z > 7". If the constraint itself contains other constraints as sub constraints (e.g. the "or" constraint concatenation "c(x) or d(x)"), the rounding lock methods of these constraints should be called in a proper way.
Consider the or concatenation "c(x) or d(x)". The variable rounding lock method of the or constraint handler should call SCIPaddConsLocks(scip, c, nlockspos, nlocksneg) and SCIPaddConsLocks(scip, d, nlockspos, nlocksneg) to tell SCIP, that infeasibility of c and d can lead to infeasibility of "c(x) or d(x)". As a second example, consider the equivalence constraint "y <-> c(x)" with variable y and constraint c. The constraint demands, that y == 1 if and only if c(x) is satisfied. The variable lock method of the corresponding constraint handler should call SCIPaddVarLocks(scip, y, nlockspos + nlocksneg, nlockspos + nlocksneg) and SCIPaddConsLocks(scip, c, nlockspos + nlocksneg, nlockspos + nlocksneg), because any modification to the value of y or to the feasibility of c can alter the feasibility of the equivalence constraint. input:
Definition at line 582 of file type_cons.h.
constraint activation notification method of constraint handler WARNING! There may exist unprocessed events. For example, a variable's bound may have been already changed, but the corresponding bound change event was not yet processed. This method is always called after a constraint of the constraint handler was activated. The constraint handler may use this call to update his own (statistical) data. input:
Definition at line 597 of file type_cons.h.
constraint deactivation notification method of constraint handler WARNING! There may exist unprocessed events. For example, a variable's bound may have been already changed, but the corresponding bound change event was not yet processed. This method is always called before a constraint of the constraint handler is deactivated. The constraint handler may use this call to update his own (statistical) data. input:
Definition at line 612 of file type_cons.h.
constraint enabling notification method of constraint handler WARNING! There may exist unprocessed events. For example, a variable's bound may have been already changed, but the corresponding bound change event was not yet processed. This method is always called after a constraint of the constraint handler was enabled. The constraint handler may use this call to update his own (statistical) data. input:
Definition at line 627 of file type_cons.h.
constraint disabling notification method of constraint handler WARNING! There may exist unprocessed events. For example, a variable's bound may have been already changed, but the corresponding bound change event was not yet processed. This method is always called before a constraint of the constraint handler is disabled. The constraint handler may use this call to update his own (statistical) data. input:
Definition at line 642 of file type_cons.h.
variable deletion method of constraint handler This method is optinal and only of interest if you are using SCIP as a branch-and-price framework. That means, you are generating new variables during the search. If you are not doing that just define the function pointer to be NULL. If this method gets implemented you should iterate over all constraints of the constraint handler and delete all variables that were marked for deletion by SCIPdelVar(). input:
Definition at line 659 of file type_cons.h.
constraint display method of constraint handler The constraint handler can store a representation of the constraint into the given text file. Use the method SCIPinfoMessage() to push a string into the file stream.
input: - scip : SCIP main data structure - conshdlr : the constraint handler itself - cons : the constraint that should be displayed - file : the text file to store the information into Definition at line 673 of file type_cons.h.
Value:
SCIP* sourcescip, SCIP_CONSHDLR* sourceconshdlr, SCIP_CONS* sourcecons, SCIP_HASHMAP* varmap, SCIP_HASHMAP* consmap, \
constraint copying method of constraint handler The constraint handler can provide a copy method which copies a constraint from one SCIP data structure into a other SCIP data structure. If a copy of a constraint is created the constraint has to be captured (The capture is usually already done due to the creation of the constraint). If the copy process was a one to one the valid pointer can set to TRUE. Otherwise, you have to set this pointer to FALSE. In case all problem defining objects (constraint handlers and variable pricers) return a valid TRUE for all their copying calls, SCIP assumes that it is a overall one to one copy of the original instance. In this case any reductions made in the copied SCIP instance can be transfer to the original SCIP instance. If the valid pointer is set to TRUE and it was not one to one copy, it might happen that optimal solutions are cut off. To get a copy of a variable in the target SCIP you should use the function SCIPgetVarCopy(). input:
output:
Definition at line 714 of file type_cons.h.
Value:
const char* name, const char* str, \
constraint parsing method of constraint handler The constraint handler can provide a callback to parse the output created by the display method (SCIP_DECL_CONSPRINT) and to create a constraint out of it.
input:
Definition at line 749 of file type_cons.h.
Value:
constraint method of constraint handler which returns the variables (if possible) The constraint handler can (this callback is optional) provide this callback to return the variables which are involved in that particular constraint. If this is possible, the variables should be copyied into the variables array and the success pointers has to be set to TRUE. Otherwise the success has to be set FALSE or the callback should not be implemented. input:
output:
Definition at line 771 of file type_cons.h.
Value:
int* nvars, SCIP_Bool* success)
constraint method of constraint handler which returns the number of variables (if possible) The constraint handler can (this callback is optional) provide this callback to return the number variable which are involved in that particular constraint. If this is not possible, the success pointers has to be set to FALSE or the callback should not be implemented. input:
output:
Definition at line 789 of file type_cons.h. Typedef Documentation
constraint handler for a specific constraint type Definition at line 46 of file type_cons.h. constraint data structure Definition at line 47 of file type_cons.h.
constraint handler data Definition at line 48 of file type_cons.h.
locally defined constraint type specific data Definition at line 49 of file type_cons.h.
tracks additions and removals of the set of active constraints Definition at line 50 of file type_cons.h. |