Scippy

SCIP

Solving Constraint Integer Programs

cons_orbisack.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program and library */
4 /* SCIP --- Solving Constraint Integer Programs */
5 /* */
6 /* Copyright (c) 2002-2023 Zuse Institute Berlin (ZIB) */
7 /* */
8 /* Licensed under the Apache License, Version 2.0 (the "License"); */
9 /* you may not use this file except in compliance with the License. */
10 /* You may obtain a copy of the License at */
11 /* */
12 /* http://www.apache.org/licenses/LICENSE-2.0 */
13 /* */
14 /* Unless required by applicable law or agreed to in writing, software */
15 /* distributed under the License is distributed on an "AS IS" BASIS, */
16 /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17 /* See the License for the specific language governing permissions and */
18 /* limitations under the License. */
19 /* */
20 /* You should have received a copy of the Apache-2.0 license */
21 /* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
22 /* */
23 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24 
25 /**@file cons_orbisack.h
26  * @ingroup CONSHDLRS
27  * @brief constraint handler for orbisack constraints
28  * @author Christopher Hojny
29  *
30  * The constraint works on two vectors of variables, which are interpreted as columns of a matrix such that the first
31  * column is lexicographically not smaller than the second.
32  */
33 
34 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35 
36 #ifndef __SCIP_CONS_ORBISACK_H__
37 #define __SCIP_CONS_ORBISACK_H__
38 
39 #include "scip/def.h"
40 #include "scip/type_cons.h"
41 #include "scip/type_retcode.h"
42 #include "scip/type_scip.h"
43 #include "scip/type_sol.h"
44 #include "scip/type_var.h"
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
50 
51 /** creates the handler for orbisack constraints and includes it in SCIP
52  *
53  * @ingroup ConshdlrIncludes
54  */
55 SCIP_EXPORT
57  SCIP* scip /**< SCIP data structure */
58  );
59 
60 /**@addtogroup CONSHDLRS
61  *
62  * @{
63  *
64  * @name Orbisack Constraints
65  *
66  * @{
67  *
68  * This constraint handler can be used to handle symmetries in certain 0/1-programs. The principle
69  * structure is that some variables can be ordered in matrix form with two columns, such that
70  * permuting both columns does not change the validity and objective function value of a solution.
71  * That is, there exists a permutation symmetry of the program that permutes the variables of the
72  * first and second column row-wise.
73  *
74  * In more mathematical terms the structure has to be as follows: There are 0/1-variables
75  * \f$x_{ij}\f$, \f$i \in \{1, \dots, n\}\f$, \f$j \in \{1, 2\}\f$. Permuting columns of
76  * \f$x\f$ does not change the validity and objective function value of any feasible solution.
77  */
78 
79 
80 /** checks whether a given binary solution is feasible for the orbisack */
81 SCIP_EXPORT
83  SCIP* scip, /**< SCIP data structure */
84  SCIP_SOL* sol, /**< solution to check for feasibility */
85  SCIP_VAR** vars1, /**< variables of first column */
86  SCIP_VAR** vars2, /**< variables of second column */
87  int nrows, /**< number of rows */
88  SCIP_Bool printreason, /**< whether reason for infeasibility should be printed */
89  SCIP_Bool* feasible /**< memory address to store whether sol is feasible */
90  );
91 
92 /** creates and captures a orbisack constraint
93  *
94  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
95  */
96 SCIP_EXPORT
98  SCIP* scip, /**< SCIP data structure */
99  SCIP_CONS** cons, /**< pointer to hold the created constraint */
100  const char* name, /**< name of constraint */
101  SCIP_VAR*const* vars1, /**< first column matrix of variables on which the symmetry acts */
102  SCIP_VAR*const* vars2, /**< second column matrix of variables on which the symmetry acts */
103  int nrows, /**< number of rows in variable matrix */
104  SCIP_Bool ispporbisack, /**< whether the orbisack is a packing/partitioning orbisack */
105  SCIP_Bool isparttype, /**< whether the orbisack is a partitioning orbisack */
106  SCIP_Bool ismodelcons, /**< whether the orbisack is a model constraint */
107  SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP?
108  * Usually set to TRUE. Set to FALSE for 'lazy constraints'. */
109  SCIP_Bool separate, /**< should the constraint be separated during LP processing?
110  * Usually set to TRUE. */
111  SCIP_Bool enforce, /**< should the constraint be enforced during node processing?
112  * TRUE for model constraints, FALSE for additional, redundant constraints. */
113  SCIP_Bool check, /**< should the constraint be checked for feasibility?
114  * TRUE for model constraints, FALSE for additional, redundant constraints. */
115  SCIP_Bool propagate, /**< should the constraint be propagated during node processing?
116  * Usually set to TRUE. */
117  SCIP_Bool local, /**< is constraint only valid locally?
118  * Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */
119  SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)?
120  * Usually set to FALSE. In column generation applications, set to TRUE if pricing
121  * adds coefficients to this constraint. */
122  SCIP_Bool dynamic, /**< is constraint subject to aging?
123  * Usually set to FALSE. Set to TRUE for own cuts which
124  * are separated as constraints. */
125  SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup?
126  * Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */
127  SCIP_Bool stickingatnode /**< should the constraint always be kept at the node where it was added, even
128  * if it may be moved to a more global node?
129  * Usually set to FALSE. Set to TRUE to for constraints that represent node data. */
130  );
131 
132 /** creates and captures an orbisack constraint in its most basic variant
133  *
134  * All constraint flags set to their default values, which can be set afterwards using SCIPsetConsFLAGNAME() in scip.h.
135  *
136  * @see SCIPcreateConsOrbisack() for the default constraint flag configuration
137  *
138  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
139  */
140 SCIP_EXPORT
142  SCIP* scip, /**< SCIP data structure */
143  SCIP_CONS** cons, /**< pointer to hold the created constraint */
144  const char* name, /**< name of constraint */
145  SCIP_VAR** vars1, /**< first column of matrix of variables on which the symmetry acts */
146  SCIP_VAR** vars2, /**< second column of matrix of variables on which the symmetry acts */
147  int nrows, /**< number of rows in constraint matrix */
148  SCIP_Bool ispporbisack, /**< whether the orbisack is a packing/partitioning orbisack */
149  SCIP_Bool isparttype, /**< whether the orbisack is a partitioning orbisack */
150  SCIP_Bool ismodelcons /**< whether the orbisack is a model constraint */
151  );
152 
153 /** @} */
154 
155 /** @} */
156 
157 #ifdef __cplusplus
158 }
159 #endif
160 
161 #endif
SCIP_RETCODE SCIPcreateConsOrbisack(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR *const *vars1, SCIP_VAR *const *vars2, int nrows, SCIP_Bool ispporbisack, SCIP_Bool isparttype, SCIP_Bool ismodelcons, 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_RETCODE SCIPincludeConshdlrOrbisack(SCIP *scip)
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63
type definitions for return codes for SCIP methods
type definitions for SCIP&#39;s main datastructure
type definitions for problem variables
#define SCIP_Bool
Definition: def.h:93
type definitions for storing primal CIP solutions
SCIP_RETCODE SCIPcreateConsBasicOrbisack(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR **vars1, SCIP_VAR **vars2, int nrows, SCIP_Bool ispporbisack, SCIP_Bool isparttype, SCIP_Bool ismodelcons)
common defines and data types used in all packages of SCIP
SCIP_RETCODE SCIPcheckSolutionOrbisack(SCIP *scip, SCIP_SOL *sol, SCIP_VAR **vars1, SCIP_VAR **vars2, int nrows, SCIP_Bool printreason, SCIP_Bool *feasible)
type definitions for constraints and constraint handlers