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_superindicator.h
26   	 * @ingroup CONSHDLRS
27   	 * @brief  constraint handler for indicator constraints over arbitrary constraint types
28   	 * @author Ambros Gleixner
29   	 * @author Frederic Pythoud
30   	 *
31   	 */
32   	
33   	/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
34   	
35   	#ifndef __SCIP_CONS_SUPERINDICATOR_H__
36   	#define __SCIP_CONS_SUPERINDICATOR_H__
37   	
38   	
39   	#include "scip/def.h"
40   	#include "scip/type_cons.h"
41   	#include "scip/type_dialog.h"
42   	#include "scip/type_retcode.h"
43   	#include "scip/type_scip.h"
44   	#include "scip/type_var.h"
45   	
46   	#ifdef __cplusplus
47   	extern "C" {
48   	#endif
49   	
50   	
51   	
52   	/*
53   	 *  constraint-specific interface methods
54   	 */
55   	
56   	/** creates the handler for superindicator constraints and includes it in SCIP
57   	 *
58   	 * @ingroup ConshdlrIncludes
59   	 * */
60   	SCIP_EXPORT
61   	SCIP_RETCODE SCIPincludeConshdlrSuperindicator(
62   	   SCIP*                 scip                /**< SCIP data structure */
63   	   );
64   	
65   	/**@addtogroup CONSHDLRS
66   	 *
67   	 * @{
68   	 *
69   	 * @name Superindicator Constraints
70   	 *
71   	 * @{
72   	 *
73   	 * Superindicator constraints are constraints of the form
74   	 * \f[
75   	 *    x_i = 1 \Rightarrow C(x)
76   	 * \f]
77   	 * where \f$ x_i \f$ is a binary variable and \f$ C(\dot) \f$ a constraint.  The superindicator constraint is satisfied
78   	 * if and only if x_i is zero or C is satisfied.
79   	 */
80   	
81   	/** creates and captures a superindicator constraint
82   	 *
83   	 *  @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
84   	 */
85   	SCIP_EXPORT
86   	SCIP_RETCODE SCIPcreateConsSuperindicator(
87   	   SCIP*                 scip,               /**< SCIP data structure */
88   	   SCIP_CONS**           cons,               /**< pointer to hold the created constraint */
89   	   const char*           name,               /**< name of constraint */
90   	   SCIP_VAR*             binvar,             /**< pointer to the indicator constraint  */
91   	   SCIP_CONS*            slackcons,          /**< constraint corresponding to the handled constraint */
92   	   SCIP_Bool             initial,            /**< should the LP relaxation of constraint be in the initial LP?
93   	                                              *   Usually set to TRUE. Set to FALSE for 'lazy constraints'. */
94   	   SCIP_Bool             separate,           /**< should the constraint be separated during LP processing?
95   	                                              *   Usually set to TRUE. */
96   	   SCIP_Bool             enforce,            /**< should the constraint be enforced during node processing?
97   	                                              *   TRUE for model constraints, FALSE for additional, redundant constraints. */
98   	   SCIP_Bool             check,              /**< should the constraint be checked for feasibility?
99   	                                              *   TRUE for model constraints, FALSE for additional, redundant constraints. */
100  	   SCIP_Bool             propagate,          /**< should the constraint be propagated during node processing?
101  	                                              *   Usually set to TRUE. */
102  	   SCIP_Bool             local,              /**< is constraint only valid locally?
103  	                                              *   Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */
104  	   SCIP_Bool             dynamic,            /**< is constraint subject to aging?
105  	                                              *   Usually set to FALSE. Set to TRUE for own cuts which
106  	                                              *   are separated as constraints. */
107  	   SCIP_Bool             removable,          /**< should the relaxation be removed from the LP due to aging or cleanup?
108  	                                              *   Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */
109  	   SCIP_Bool             stickingatnode      /**< should the constraint always be kept at the node where it was added, even
110  	                                              *   if it may be moved to a more global node?
111  	                                              *   Usually set to FALSE. Set to TRUE to for constraints that represent node data. */
112  	   );
113  	
114  	/** creates and captures a superindicator constraint
115  	 *  in its most basic version, i. e., all constraint flags are set to their basic value as explained for the
116  	 *  method SCIPcreateConsSuperindicator(); all flags can be set via SCIPsetConsFLAGNAME-methods in scip.h
117  	 *
118  	 *  @see SCIPcreateConsSuperindicator() for information about the basic constraint flag configuration
119  	 *
120  	 *  @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
121  	 */
122  	SCIP_EXPORT
123  	SCIP_RETCODE SCIPcreateConsBasicSuperindicator(
124  	   SCIP*                 scip,               /**< SCIP data structure */
125  	   SCIP_CONS**           cons,               /**< pointer to hold the created constraint */
126  	   const char*           name,               /**< name of constraint */
127  	   SCIP_VAR*             binvar,             /**< pointer to the indicator constraint  */
128  	   SCIP_CONS*            slackcons           /**< constraint corresponding to the handled constraint */
129  	   );
130  	
131  	/** gets binary variable corresponding to the superindicator constraint */
132  	SCIP_EXPORT
133  	SCIP_VAR* SCIPgetBinaryVarSuperindicator(
134  	   SCIP_CONS*            cons                /**< superindicator constraint */
135  	   );
136  	
137  	/** gets the slack constraint corresponding to the superindicator constraint */
138  	SCIP_EXPORT
139  	SCIP_CONS* SCIPgetSlackConsSuperindicator(
140  	   SCIP_CONS*            cons                /**< superindicator constraint */
141  	   );
142  	
143  	
144  	
145  	/*
146  	 *  constraint-dependent SCIP methods
147  	 */
148  	
149  	/** transforms the current problem into a MinUC problem (minimizing the number of unsatisfied constraints),
150  	 *  a CIP generalization of the MinULR (min. unsatisfied linear relations) problem
151  	 */
152  	SCIP_EXPORT
153  	SCIP_RETCODE SCIPtransformMinUC(
154  	   SCIP*                 scip,               /**< SCIP data structure */
155  	   SCIP_Bool*            success             /**< pointer to store whether all constraints could be transformed */
156  	   );
157  	
158  	
159  	
160  	/*
161  	 *  constraint-dependent dialog entries
162  	 */
163  	
164  	/** dialog execution method for the SCIPtransformMinUC() command */
165  	SCIP_EXPORT
166  	SCIP_DECL_DIALOGEXEC(SCIPdialogExecChangeMinUC);
167  	
168  	/** @} */
169  	
170  	/** @} */
171  	
172  	#ifdef __cplusplus
173  	}
174  	#endif
175  	
176  	#endif
177