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   pub_implics.h
26   	 * @ingroup PUBLICCOREAPI
27   	 * @brief  public methods for implications, variable bounds, and cliques
28   	 * @author Tobias Achterberg
29   	 */
30   	
31   	/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
32   	
33   	#ifndef __SCIP_PUB_IMPLICS_H__
34   	#define __SCIP_PUB_IMPLICS_H__
35   	
36   	
37   	#include "scip/def.h"
38   	#include "scip/type_var.h"
39   	#include "scip/type_implics.h"
40   	
41   	#ifdef NDEBUG
42   	#include "scip/struct_implics.h"
43   	#endif
44   	
45   	#ifdef __cplusplus
46   	extern "C" {
47   	#endif
48   	
49   	/*
50   	 * methods for cliques
51   	 */
52   	
53   	/** returns the position of the given variable/value pair in the clique; returns -1 if variable/value pair is not member
54   	 *  of the clique
55   	 */
56   	SCIP_EXPORT
57   	int SCIPcliqueSearchVar(
58   	   SCIP_CLIQUE*          clique,             /**< clique data structure */
59   	   SCIP_VAR*             var,                /**< variable to search for */
60   	   SCIP_Bool             value               /**< value of the variable in the clique */
61   	   );
62   	
63   	/** returns whether the given variable/value pair is member of the given clique */
64   	SCIP_EXPORT
65   	SCIP_Bool SCIPcliqueHasVar(
66   	   SCIP_CLIQUE*          clique,             /**< clique data structure */
67   	   SCIP_VAR*             var,                /**< variable to remove from the clique */
68   	   SCIP_Bool             value               /**< value of the variable in the clique */
69   	   );
70   	
71   	/** gets number of variables in the cliques */
72   	SCIP_EXPORT
73   	int SCIPcliqueGetNVars(
74   	   SCIP_CLIQUE*          clique              /**< clique data structure */
75   	   );
76   	
77   	/** gets array of active problem variables in the cliques */
78   	SCIP_EXPORT
79   	SCIP_VAR** SCIPcliqueGetVars(
80   	   SCIP_CLIQUE*          clique              /**< clique data structure */
81   	   );
82   	
83   	/** gets array of values of active problem variables in the cliques, i.e. whether the variable is fixed to FALSE or
84   	 *  to TRUE in the clique
85   	 */
86   	SCIP_EXPORT
87   	SCIP_Bool* SCIPcliqueGetValues(
88   	   SCIP_CLIQUE*          clique              /**< clique data structure */
89   	   );
90   	
91   	/** gets unique identifier of the clique */
92   	SCIP_EXPORT
93   	unsigned int SCIPcliqueGetId(
94   	   SCIP_CLIQUE*          clique              /**< clique data structure */
95   	   );
96   	
97   	/** gets index of the clique in the clique table */
98   	SCIP_EXPORT
99   	int SCIPcliqueGetIndex(
100  	   SCIP_CLIQUE*          clique              /**< clique data structure */
101  	   );
102  	
103  	/** returns whether the given clique is cleaned up */
104  	SCIP_EXPORT
105  	SCIP_Bool SCIPcliqueIsCleanedUp(
106  	   SCIP_CLIQUE*          clique              /**< clique data structure */
107  	   );
108  	
109  	/** return whether the given clique is an equation */
110  	SCIP_EXPORT
111  	SCIP_Bool SCIPcliqueIsEquation(
112  	   SCIP_CLIQUE*          clique              /**< clique data structure */
113  	   );
114  	
115  	
116  	#ifdef NDEBUG
117  	
118  	/* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
119  	 * speed up the algorithms.
120  	 */
121  	
122  	#define SCIPcliqueGetNVars(clique)                   ((clique)->nvars)
123  	#define SCIPcliqueGetVars(clique)                    ((clique)->vars)
124  	#define SCIPcliqueGetValues(clique)                  ((clique)->values)
125  	#define SCIPcliqueGetId(clique)                      ((clique)->id)
126  	#define SCIPcliqueGetIndex(clique)                      ((clique)->index)
127  	#define SCIPcliqueIsCleanedUp(clique)                ((clique)->startcleanup == -1)
128  	#define SCIPcliqueIsEquation(clique)                 ((SCIP_Bool)(clique)->equation)
129  	
130  	#endif
131  	
132  	#ifdef __cplusplus
133  	}
134  	#endif
135  	
136  	#endif
137