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   symmetry_orbitopal.c
26   	 * @ingroup OTHER_CFILES
27   	 * @brief  methods for handling orbitopal symmetries
28   	 * @author Jasper van Doornmalen
29   	 */
30   	
31   	/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
32   	
33   	#ifndef __SCIP_SYMMETRY_ORBITOPAL_H__
34   	#define __SCIP_SYMMETRY_ORBITOPAL_H__
35   	
36   	#include "scip/def.h"
37   	#include "scip/type_retcode.h"
38   	#include "scip/type_scip.h"
39   	#include "scip/type_var.h"
40   	#include "symmetry/type_symmetry.h"
41   	
42   	#ifdef __cplusplus
43   	extern "C" {
44   	#endif
45   	
46   	
47   	/** variants for orbitope column ordering */
48   	enum SCIP_ColumnOrdering
49   	{
50   	   SCIP_COLUMNORDERING_NONE        = 0,      /**< do not order the columns */
51   	   SCIP_COLUMNORDERING_FIRST       = 1,      /**< choose first possible column */
52   	   SCIP_COLUMNORDERING_LAST        = 2,      /**< choose last possible column */
53   	   SCIP_COLUMNORDERING_CENTRE      = 3,      /**< choose centremost possible column */
54   	   SCIP_COLUMNORDERING_MEDIAN      = 4       /**< choose median column */
55   	};
56   	typedef enum SCIP_ColumnOrdering SCIP_COLUMNORDERING; /**< variants for orbitope column ordering*/
57   	
58   	/** variants for orbitope row ordering */
59   	enum SCIP_RowOrdering
60   	{
61   	   SCIP_ROWORDERING_NONE           = 0,      /**< do not order the rows */
62   	   SCIP_ROWORDERING_BRANCHING      = 1       /**< choose rows based on branching variables */
63   	};
64   	typedef enum SCIP_RowOrdering SCIP_ROWORDERING; /**< variants for orbitope row ordering*/
65   	
66   	
67   	/** data for orbitopal reduction */
68   	struct SCIP_OrbitopalReductionData;
69   	typedef struct SCIP_OrbitopalReductionData SCIP_ORBITOPALREDDATA; /**< data for orbitopal reduction */
70   	
71   	
72   	/** gets the number of reductions */
73   	SCIP_EXPORT
74   	SCIP_RETCODE SCIPorbitopalReductionGetStatistics(
75   	   SCIP*                 scip,               /**< SCIP data structure */
76   	   SCIP_ORBITOPALREDDATA* orbireddata,       /**< orbitopal reduction data structure */
77   	   int*                  nred,               /**< total number of reductions applied */
78   	   int*                  ncutoff             /**< total number of cutoffs applied */
79   	   );
80   	
81   	
82   	/** prints orbitopal reduction data */
83   	SCIP_EXPORT
84   	SCIP_RETCODE SCIPorbitopalReductionPrintStatistics(
85   	   SCIP*                 scip,               /**< SCIP data structure */
86   	   SCIP_ORBITOPALREDDATA* orbireddata        /**< orbitopal reduction data structure */
87   	   );
88   	
89   	/** propagates orbitopal reduction */
90   	SCIP_EXPORT
91   	SCIP_RETCODE SCIPorbitopalReductionPropagate(
92   	   SCIP*                 scip,               /**< SCIP data structure */
93   	   SCIP_ORBITOPALREDDATA* orbireddata,       /**< orbitopal reduction data structure */
94   	   SCIP_Bool*            infeasible,         /**< pointer to store whether infeasibility is found */
95   	   int*                  nred,               /**< pointer to store the number of domain reductions */
96   	   SCIP_Bool*            didrun              /**< a global pointer maintaining if any symmetry propagator has run
97   	                                              *   only set this to TRUE when a reduction is found, never set to FALSE */
98   	   );
99   	
100  	
101  	/** adds orbitopal component to orbitopal symmetry handler */
102  	SCIP_EXPORT
103  	SCIP_RETCODE SCIPorbitopalReductionAddOrbitope(
104  	   SCIP*                 scip,               /**< SCIP data structure */
105  	   SCIP_ORBITOPALREDDATA* orbireddata,       /**< orbitopal reduction data structure */
106  	   SCIP_ROWORDERING      rowordering,        /**< specifies how rows of orbitope are ordered */
107  	   SCIP_COLUMNORDERING   colordering,        /**< specifies how columnss of orbitope are ordered */
108  	   SCIP_VAR**            vars,               /**< matrix of variables on which the symmetry acts */
109  	   int                   nrows,              /**< number of rows */
110  	   int                   ncols,              /**< number of columns */
111  	   SCIP_Bool*            success             /**< to store whether the component is successfully added */
112  	   );
113  	
114  	/** resets orbitopal reduction data structure (clears all orbitopes) */
115  	SCIP_EXPORT
116  	SCIP_RETCODE SCIPorbitopalReductionReset(
117  	   SCIP*                 scip,               /**< SCIP data structure */
118  	   SCIP_ORBITOPALREDDATA* orbireddata        /**< pointer to orbitopal reduction structure to populate */
119  	   );
120  	
121  	
122  	/** frees orbitopal reduction data */
123  	SCIP_EXPORT
124  	SCIP_RETCODE SCIPorbitopalReductionFree(
125  	   SCIP*                 scip,               /**< SCIP data structure */
126  	   SCIP_ORBITOPALREDDATA** orbireddata       /**< pointer to orbitopal reduction structure to populate */
127  	   );
128  	
129  	
130  	/** initializes structures needed for orbitopal reduction
131  	 *
132  	 *  This is only done exactly once.
133  	 */
134  	SCIP_EXPORT
135  	SCIP_RETCODE SCIPincludeOrbitopalReduction(
136  	   SCIP*                 scip,               /**< SCIP data structure */
137  	   SCIP_ORBITOPALREDDATA** orbireddata       /**< pointer to orbitopal reduction structure to populate */
138  	   );
139  	
140  	
141  	/** returns the default column ordering */
142  	SCIP_EXPORT
143  	SCIP_COLUMNORDERING SCIPorbitopalReductionGetDefaultColumnOrdering(
144  	   SCIP_ORBITOPALREDDATA* orbireddata        /**< pointer to orbitopal reduction structure to populate */
145  	   );
146  	
147  	#ifdef __cplusplus
148  	}
149  	#endif
150  	
151  	#endif
152