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-2018 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not visit scip.zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file probdata_cyc.h
17  * @brief problem data for cycle clustering problem
18  * @author Leon Eifler
19  *
20  * This file implements the problem data for the cycle clustering problem.
21  *
22  * The problem data contains original transition matrix, the scaling parameter that appears in the objective function,
23  * and all variables that appear in the problem.
24  */
25 
26 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
27 
28 #ifndef __SCIP_PROBDATA_CYC__
29 #define __SCIP_PROBDATA_CYC__
30 
31 #include "scip/scip.h"
32 #include "tclique/tclique.h"
33 #include "scip/cons_setppc.h"
34 #include "scip/type_cons.h"
35 #include "scip/def.h"
36 
37 /** free memory allocated for an nxn matrix */
38 extern
40  SCIP_Real** matrix, /**< the matrix to be freed */
41  int nbins /**< the size*/
42  );
43 
44 /** gets the minmal non-zero value in a n x n matrix */
45 extern
47  SCIP* scip, /**< SCIP data structure*/
48  SCIP_Real** matrix, /**< the matrix*/
49  int size /**< the matrix-size*/
50  );
51 
52 /** getter methods for the probdata */
53 extern
55  SCIP* scip /**< SCIP data structure*/
56  );
57 
58 /** returns the number of states */
59 extern
60 int SCIPcycGetNBins(
61  SCIP* scip /**< SCIP data structure*/
62  );
63 
64 /** returns the number of clusters */
65 extern
67  SCIP* scip /**< SCIP data structure*/
68  );
69 
70 /** returns the state-variable-matrix */
71 extern
73  SCIP* scip /**< SCIP data structure*/
74  );
75 
76 /** returns the edge variables */
77 extern
79  SCIP* scip /**< SCIP data structure*/
80  );
81 
82 /** Return one specific edge variable */
83 extern
85  SCIP_VAR**** edgevars, /**< edgevar data structure*/
86  int state1, /**< first state */
87  int state2, /**< second state */
88  int direction /**< direction, 0 = incluster, 1 = forward */
89  );
90 
91 /** check for an array of states, if all possible edge-combinations exist */
92 extern
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 */
101 extern
103  SCIP* scip /**< SCIP data structure */
104  );
105 
106 /** returns the number of scaling parameter */
107 extern
109  SCIP* scip /**< SCIP data structure */
110  );
111 
112 /** print all the relevant solution data */
113 extern
115  SCIP* scip, /**< SCIP data structure*/
116  SCIP_SOL* sol /**< the solution containing the values*/
117  );
118 
119 /** create the probdata for a cycle clustering problem */
120 extern
122  SCIP* scip, /**< SCIP data structure */
123  const char* name, /**< problem name */
124  int nbins, /**< number of bins */
125  int ncluster, /**< number of cluster */
126  SCIP_Real** cmatrix /**< the transition matrix */
127  );
128 
129 /** function that returns the successive cluster along the cycle */
130 extern
131 int phi(
132  int k, /**< the cluster */
133  int ncluster /**< the number of clusters*/
134  );
135 
136 /** function that returns the previous cluster along the cycle */
137 extern
138 int phiinv(
139  int k, /**< the cluster */
140  int ncluster /**< the number of clusters*/
141  );
142 
143 /** assign the variables in scip according to the found clustering. */
144 extern
146  SCIP* scip, /**< SCIP data structure */
147  SCIP_SOL* sol, /**< the SCIP solution */
148  SCIP_Real** clustering, /**< the matrix with the clusterassignment */
149  int nbins, /**< the number of bins */
150  int ncluster /**< the number of cluster */
151  );
152 
153 /** check if the clustering has exactly one state in every cluster. */
154 extern
156  SCIP* scip, /**< SCIP data structure */
157  SCIP_Real** solclustering, /**< matrix with the clustering */
158  int nbins, /**< the number of bins */
159  int ncluster /**< the number of clusters */
160  );
161 
162 #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:79
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:53
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:172
SCIP_Bool edgesExist(SCIP_VAR ****edgevars, int *states, int nstates)
#define SCIP_Bool
Definition: def.h:62
int phiinv(int k, int ncluster)
Definition: probdata_cyc.c:184
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:150
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:48
SCIP_Real ** SCIPcycGetCmatrix(SCIP *scip)
SCIP callable library.
type definitions for constraints and constraint handlers