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_quadratic.h
26   	 * @ingroup CONSHDLRS
27   	 * @brief  some API functions of removed constraint handler for quadratic constraints \f$\textrm{lhs} \leq \sum_{i,j} a_{i,j} x_ix_j + \sum_i b_i x_i \leq \textrm{rhs}\f$
28   	 * @author Stefan Vigerske
29   	 *
30   	 */
31   	
32   	/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
33   	
34   	#ifndef __SCIP_CONS_QUADRATIC_H__
35   	#define __SCIP_CONS_QUADRATIC_H__
36   	
37   	#include "scip/def.h"
38   	#include "scip/type_cons.h"
39   	#include "scip/type_retcode.h"
40   	#include "scip/type_scip.h"
41   	#include "scip/type_var.h"
42   	#include "scip/type_nlp.h"
43   	
44   	#ifdef __cplusplus
45   	extern "C" {
46   	#endif
47   	
48   	/**@addtogroup CONSHDLRS
49   	 *
50   	 * @{
51   	 *
52   	 * @name Quadratic Constraints (deprecated)
53   	 *
54   	 * @{
55   	 */
56   	
57   	/** Creates and captures a quadratic nonlinear constraint.
58   	 *
59   	 *  The constraint should be given in the form
60   	 *  \f[
61   	 *  \ell \leq \sum_{i=1}^n b_i x_i + \sum_{j=1}^m a_j y_j z_j \leq u,
62   	 *  \f]
63   	 *  where \f$x_i = y_j = z_k\f$ is possible.
64   	 *
65   	 *  @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
66   	 *
67   	 *  @deprecated Use SCIPcreateConsQuadraticNonlinear() instead.
68   	 */
69   	SCIP_EXPORT
70   	SCIP_DEPRECATED
71   	SCIP_RETCODE SCIPcreateConsQuadratic(
72   	   SCIP*                 scip,               /**< SCIP data structure */
73   	   SCIP_CONS**           cons,               /**< pointer to hold the created constraint */
74   	   const char*           name,               /**< name of constraint */
75   	   int                   nlinvars,           /**< number of linear terms (n) */
76   	   SCIP_VAR**            linvars,            /**< variables in linear part (x_i) or NULL if nlinvars == 0 */
77   	   SCIP_Real*            lincoefs,           /**< coefficients of variables in linear part (b_i) or NULL if nlinvars == 0 */
78   	   int                   nquadterms,         /**< number of quadratic terms (m) */
79   	   SCIP_VAR**            quadvars1,          /**< array with first variables in quadratic terms (y_j) or NULL if nquadterms == 0 */
80   	   SCIP_VAR**            quadvars2,          /**< array with second variables in quadratic terms (z_j) or NULL if nquadterms == 0 */
81   	   SCIP_Real*            quadcoeffs,         /**< array with coefficients of quadratic terms (a_j) or NULL if nquadterms == 0 */
82   	   SCIP_Real             lhs,                /**< left hand side of quadratic equation (l) */
83   	   SCIP_Real             rhs,                /**< right hand side of quadratic equation (u) */
84   	   SCIP_Bool             initial,            /**< should the LP relaxation of constraint be in the initial LP?
85   	                                              *   Usually set to TRUE. Set to FALSE for 'lazy constraints'. */
86   	   SCIP_Bool             separate,           /**< should the constraint be separated during LP processing?
87   	                                              *   Usually set to TRUE. */
88   	   SCIP_Bool             enforce,            /**< should the constraint be enforced during node processing?
89   	                                              *   TRUE for model constraints, FALSE for additional, redundant constraints. */
90   	   SCIP_Bool             check,              /**< should the constraint be checked for feasibility?
91   	                                              *   TRUE for model constraints, FALSE for additional, redundant constraints. */
92   	   SCIP_Bool             propagate,          /**< should the constraint be propagated during node processing?
93   	                                              *   Usually set to TRUE. */
94   	   SCIP_Bool             local,              /**< is constraint only valid locally?
95   	                                              *   Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */
96   	   SCIP_Bool             modifiable,         /**< is constraint modifiable (subject to column generation)?
97   	                                              *   Usually set to FALSE. In column generation applications, set to TRUE if pricing
98   	                                              *   adds coefficients to this constraint. */
99   	   SCIP_Bool             dynamic,            /**< is constraint subject to aging?
100  	                                              *   Usually set to FALSE. Set to TRUE for own cuts which
101  	                                              *   are separated as constraints. */
102  	   SCIP_Bool             removable           /**< should the relaxation be removed from the LP due to aging or cleanup?
103  	                                              *   Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */
104  	   );
105  	
106  	/** creates and captures a quadratic nonlinear constraint
107  	 *  in its most basic variant, i.e., with all constraint flags set to their default values, which can be set
108  	 *  afterwards using SCIPsetConsFLAGNAME()
109  	 *
110  	 *  The constraint should be given in the form
111  	 *  \f[
112  	 *  \ell \leq \sum_{i=1}^n b_i x_i + \sum_{j=1}^m a_j y_jz_j \leq u,
113  	 *  \f]
114  	 *  where \f$x_i = y_j = z_k\f$ is possible.
115  	 *
116  	 *  @see SCIPcreateConsQuadratic() for the default constraint flag configuration
117  	 *
118  	 *  @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
119  	 *
120  	 *  @deprecated Use SCIPcreateConsBasicQuadraticNonlinear instead.
121  	 */
122  	SCIP_EXPORT
123  	SCIP_DEPRECATED
124  	SCIP_RETCODE SCIPcreateConsBasicQuadratic(
125  	   SCIP*                 scip,               /**< SCIP data structure */
126  	   SCIP_CONS**           cons,               /**< pointer to hold the created constraint */
127  	   const char*           name,               /**< name of constraint */
128  	   int                   nlinvars,           /**< number of linear terms (n) */
129  	   SCIP_VAR**            linvars,            /**< array with variables in linear part (x_i) */
130  	   SCIP_Real*            lincoefs,           /**< array with coefficients of variables in linear part (b_i) */
131  	   int                   nquadterms,         /**< number of quadratic terms (m) */
132  	   SCIP_VAR**            quadvars1,          /**< array with first variables in quadratic terms (y_j) */
133  	   SCIP_VAR**            quadvars2,          /**< array with second variables in quadratic terms (z_j) */
134  	   SCIP_Real*            quadcoefs,          /**< array with coefficients of quadratic terms (a_j) */
135  	   SCIP_Real             lhs,                /**< left hand side of quadratic equation (ell) */
136  	   SCIP_Real             rhs                 /**< right hand side of quadratic equation (u) */
137  	   );
138  	
139  	/** Adds a constant to the constraint function, that is, subtracts a constant from both sides
140  	 *
141  	 * @deprecated Use SCIPchgLhsNonlinear() and SCIPchgRhsNonlinear() instead.
142  	 */
143  	SCIP_EXPORT
144  	SCIP_DEPRECATED
145  	void SCIPaddConstantQuadratic(
146  	   SCIP*                 scip,               /**< SCIP data structure */
147  	   SCIP_CONS*            cons,               /**< constraint */
148  	   SCIP_Real             constant            /**< constant to subtract from both sides */
149  	   );
150  	
151  	/** Adds a linear variable with coefficient to a quadratic constraint.
152  	 *
153  	 * @deprecated Use SCIPaddLinearVarNonlinear() instead.
154  	 */
155  	SCIP_EXPORT
156  	SCIP_DEPRECATED
157  	SCIP_RETCODE SCIPaddLinearVarQuadratic(
158  	   SCIP*                 scip,               /**< SCIP data structure */
159  	   SCIP_CONS*            cons,               /**< constraint */
160  	   SCIP_VAR*             var,                /**< variable */
161  	   SCIP_Real             coef                /**< coefficient of variable */
162  	   );
163  	
164  	/** Adds a quadratic variable with linear and square coefficient to a quadratic constraint.
165  	 *
166  	 * @deprecated Use SCIPaddLinearVarNonlinear() and SCIPaddExprNonlinear() instead.
167  	 */
168  	SCIP_EXPORT
169  	SCIP_DEPRECATED
170  	SCIP_RETCODE SCIPaddQuadVarQuadratic(
171  	   SCIP*                 scip,               /**< SCIP data structure */
172  	   SCIP_CONS*            cons,               /**< constraint */
173  	   SCIP_VAR*             var,                /**< variable */
174  	   SCIP_Real             lincoef,            /**< linear coefficient of variable */
175  	   SCIP_Real             sqrcoef             /**< square coefficient of variable */
176  	   );
177  	
178  	/** Adds a linear coefficient for a quadratic variable.
179  	 *
180  	 * Variable will be added with square coefficient 0.0 if not existing yet.
181  	 *
182  	 * @deprecated Use SCIPaddLinearVarNonlinear() instead.
183  	 */
184  	SCIP_EXPORT
185  	SCIP_DEPRECATED
186  	SCIP_RETCODE SCIPaddQuadVarLinearCoefQuadratic(
187  	   SCIP*                 scip,               /**< SCIP data structure */
188  	   SCIP_CONS*            cons,               /**< constraint */
189  	   SCIP_VAR*             var,                /**< variable */
190  	   SCIP_Real             coef                /**< value to add to linear coefficient of variable */
191  	   );
192  	
193  	/** Adds a square coefficient for a quadratic variable.
194  	 *
195  	 * Variable will be added with linear coefficient 0.0 if not existing yet.
196  	 *
197  	 * @deprecated Use SCIPaddExprNonlinear() instead.
198  	 */
199  	SCIP_EXPORT
200  	SCIP_DEPRECATED
201  	SCIP_RETCODE SCIPaddSquareCoefQuadratic(
202  	   SCIP*                 scip,               /**< SCIP data structure */
203  	   SCIP_CONS*            cons,               /**< constraint */
204  	   SCIP_VAR*             var,                /**< variable */
205  	   SCIP_Real             coef                /**< value to add to square coefficient of variable */
206  	   );
207  	
208  	/** Adds a bilinear term to a quadratic constraint.
209  	 *
210  	 * Variables will be added with linear and square coefficient 0.0 if not existing yet.
211  	 * If variables are equal, only the square coefficient of the variable is updated.
212  	 *
213  	 * @deprecated Use SCIPaddExprNonlinear() instead.
214  	 */
215  	SCIP_EXPORT
216  	SCIP_DEPRECATED
217  	SCIP_RETCODE SCIPaddBilinTermQuadratic(
218  	   SCIP*                 scip,               /**< SCIP data structure */
219  	   SCIP_CONS*            cons,               /**< constraint */
220  	   SCIP_VAR*             var1,               /**< first variable */
221  	   SCIP_VAR*             var2,               /**< second variable */
222  	   SCIP_Real             coef                /**< coefficient of bilinear term */
223  	   );
224  	
225  	/** Gets the quadratic constraint as a nonlinear row representation.
226  	 *
227  	 * @deprecated Use SCIPgetNlRowNonlinear() instead.
228  	 */
229  	SCIP_EXPORT
230  	SCIP_DEPRECATED
231  	SCIP_RETCODE SCIPgetNlRowQuadratic(
232  	   SCIP*                 scip,               /**< SCIP data structure */
233  	   SCIP_CONS*            cons,               /**< constraint */
234  	   SCIP_NLROW**          nlrow               /**< pointer to store nonlinear row */
235  	   );
236  	
237  	/** sets the left hand side of a quadratic constraint
238  	 *
239  	 *  @note This method may only be called during problem creation stage for an original constraint.
240  	 *
241  	 *  @deprecated Use SCIPchgLhsNonlinear() instead.
242  	 */
243  	SCIP_EXPORT
244  	SCIP_DEPRECATED
245  	SCIP_RETCODE SCIPchgLhsQuadratic(
246  	   SCIP*                 scip,               /**< SCIP data structure */
247  	   SCIP_CONS*            cons,               /**< constraint data */
248  	   SCIP_Real             lhs                 /**< new left hand side */
249  	   );
250  	
251  	/** sets the right hand side of a quadratic constraint
252  	 *
253  	 *  @note This method may only be called during problem creation stage for an original constraint.
254  	 *
255  	 *  @deprecated Use SCIPchgRhsNonlinear() instead.
256  	 */
257  	SCIP_EXPORT
258  	SCIP_DEPRECATED
259  	SCIP_RETCODE SCIPchgRhsQuadratic(
260  	   SCIP*                 scip,               /**< SCIP data structure */
261  	   SCIP_CONS*            cons,               /**< constraint data */
262  	   SCIP_Real             rhs                 /**< new right hand side */
263  	   );
264  	
265  	/** @} */
266  	/** @} */
267  	
268  	#ifdef __cplusplus
269  	}
270  	#endif
271  	
272  	#endif
273