Scippy

SCIP

Solving Constraint Integer Programs

probdata_cyc.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-2024 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 probdata_cyc.h
26  * @brief problem data for cycle clustering problem
27  * @author Leon Eifler
28  *
29  * This file implements the problem data for the cycle clustering problem.
30  *
31  * The problem data contains original transition matrix, the scaling parameter that appears in the objective function,
32  * and all variables that appear in the problem.
33  */
34 
35 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
36 
37 #ifndef __SCIP_PROBDATA_CYC__
38 #define __SCIP_PROBDATA_CYC__
39 
40 #include "scip/scip.h"
41 #include "tclique/tclique.h"
42 #include "scip/cons_setppc.h"
43 #include "scip/type_cons.h"
44 #include "scip/def.h"
45 
46 /** free memory allocated for an nxn matrix */
48  SCIP_Real** matrix, /**< the matrix to be freed */
49  int nbins /**< the size*/
50  );
51 
52 /** gets the minmal non-zero value in a n x n matrix */
54  SCIP* scip, /**< SCIP data structure*/
55  SCIP_Real** matrix, /**< the matrix*/
56  int size /**< the matrix-size*/
57  );
58 
59 /** getter methods for the probdata */
61  SCIP* scip /**< SCIP data structure*/
62  );
63 
64 /** returns the number of states */
65 int SCIPcycGetNBins(
66  SCIP* scip /**< SCIP data structure*/
67  );
68 
69 /** returns the number of clusters */
71  SCIP* scip /**< SCIP data structure*/
72  );
73 
74 /** returns the state-variable-matrix */
76  SCIP* scip /**< SCIP data structure*/
77  );
78 
79 /** returns the edge variables */
81  SCIP* scip /**< SCIP data structure*/
82  );
83 
84 /** Return one specific edge variable */
86  SCIP_VAR**** edgevars, /**< edgevar data structure*/
87  int state1, /**< first state */
88  int state2, /**< second state */
89  int direction /**< direction, 0 = incluster, 1 = forward */
90  );
91 
92 /** check for an array of states, if all possible edge-combinations exist */
94  SCIP_VAR**** edgevars, /**< edgevar data structure */
95  int* states, /**< state array */
96  int nstates /**< size of state array */
97  );
98 
99 
100 /** returns the edge-graph */
102  SCIP* scip /**< SCIP data structure */
103  );
104 
105 /** returns the number of scaling parameter */
107  SCIP* scip /**< SCIP data structure */
108  );
109 
110 /** print all the relevant solution data */
112  SCIP* scip, /**< SCIP data structure*/
113  SCIP_SOL* sol /**< the solution containing the values*/
114  );
115 
116 /** create the probdata for a cycle clustering problem */
118  SCIP* scip, /**< SCIP data structure */
119  const char* name, /**< problem name */
120  int nbins, /**< number of bins */
121  int ncluster, /**< number of cluster */
122  SCIP_Real** cmatrix /**< the transition matrix */
123  );
124 
125 /** function that returns the successive cluster along the cycle */
126 int phi(
127  int k, /**< the cluster */
128  int ncluster /**< the number of clusters*/
129  );
130 
131 /** function that returns the previous cluster along the cycle */
132 int phiinv(
133  int k, /**< the cluster */
134  int ncluster /**< the number of clusters*/
135  );
136 
137 /** assign the variables in scip according to the found clustering. */
139  SCIP* scip, /**< SCIP data structure */
140  SCIP_SOL* sol, /**< the SCIP solution */
141  SCIP_Real** clustering, /**< the matrix with the clusterassignment */
142  int nbins, /**< the number of bins */
143  int ncluster /**< the number of cluster */
144  );
145 
146 /** check if the clustering has exactly one state in every cluster. */
148  SCIP* scip, /**< SCIP data structure */
149  SCIP_Real** solclustering, /**< matrix with the clustering */
150  int nbins, /**< the number of bins */
151  int ncluster /**< the number of clusters */
152  );
153 
154 #endif
SCIP_RETCODE SCIPcreateProbCyc(SCIP *scip, const char *name, int nbins, int ncluster, SCIP_Real **cmatrix)
SCIP_RETCODE assignVars(SCIP *scip, SCIP_SOL *sol, SCIP_Real **clustering, int nbins, int ncluster)
Definition: probdata_cyc.c:88
SCIP_VAR * getEdgevar(SCIP_VAR ****edgevars, int state1, int state2, int direction)
SCIP_Real SCIPcycGetScale(SCIP *scip)
SCIP_VAR **** SCIPcycGetEdgevars(SCIP *scip)
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63
tclique user interface
SCIP_RETCODE freeMatrix(SCIP_Real **matrix, int nbins)
Constraint handler for the set partitioning / packing / covering constraints .
int SCIPcycGetNBins(SCIP *scip)
int phi(int k, int ncluster)
Definition: probdata_cyc.c:181
SCIP_Bool edgesExist(SCIP_VAR ****edgevars, int *states, int nstates)
#define SCIP_Bool
Definition: def.h:91
int phiinv(int k, int ncluster)
Definition: probdata_cyc.c:193
SCIP_Real getMinNonZero(SCIP *scip, SCIP_Real **matrix, int size)
int SCIPcycGetNCluster(SCIP *scip)
SCIP_DIGRAPH * SCIPcycGetEdgeGraph(SCIP *scip)
#define SCIP_Real
Definition: def.h:173
SCIP_VAR *** SCIPcycGetBinvars(SCIP *scip)
SCIP_RETCODE SCIPcycPrintSolutionValues(SCIP *scip, SCIP_SOL *sol)
common defines and data types used in all packages of SCIP
SCIP_Bool isPartition(SCIP *scip, SCIP_Real **solclustering, int nbins, int ncluster)
Definition: probdata_cyc.c:57
SCIP_Real ** SCIPcycGetCmatrix(SCIP *scip)
SCIP callable library.
type definitions for constraints and constraint handlers