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-2020 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 scipopt.org. */
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 */
39  SCIP_Real** matrix, /**< the matrix to be freed */
40  int nbins /**< the size*/
41  );
42 
43 /** gets the minmal non-zero value in a n x n matrix */
45  SCIP* scip, /**< SCIP data structure*/
46  SCIP_Real** matrix, /**< the matrix*/
47  int size /**< the matrix-size*/
48  );
49 
50 /** getter methods for the probdata */
52  SCIP* scip /**< SCIP data structure*/
53  );
54 
55 /** returns the number of states */
56 int SCIPcycGetNBins(
57  SCIP* scip /**< SCIP data structure*/
58  );
59 
60 /** returns the number of clusters */
62  SCIP* scip /**< SCIP data structure*/
63  );
64 
65 /** returns the state-variable-matrix */
67  SCIP* scip /**< SCIP data structure*/
68  );
69 
70 /** returns the edge variables */
72  SCIP* scip /**< SCIP data structure*/
73  );
74 
75 /** Return one specific edge variable */
77  SCIP_VAR**** edgevars, /**< edgevar data structure*/
78  int state1, /**< first state */
79  int state2, /**< second state */
80  int direction /**< direction, 0 = incluster, 1 = forward */
81  );
82 
83 /** check for an array of states, if all possible edge-combinations exist */
85  SCIP_VAR**** edgevars, /**< edgevar data structure */
86  int* states, /**< state array */
87  int nstates /**< size of state array */
88  );
89 
90 
91 /** returns the edge-graph */
93  SCIP* scip /**< SCIP data structure */
94  );
95 
96 /** returns the number of scaling parameter */
98  SCIP* scip /**< SCIP data structure */
99  );
100 
101 /** print all the relevant solution data */
103  SCIP* scip, /**< SCIP data structure*/
104  SCIP_SOL* sol /**< the solution containing the values*/
105  );
106 
107 /** create the probdata for a cycle clustering problem */
109  SCIP* scip, /**< SCIP data structure */
110  const char* name, /**< problem name */
111  int nbins, /**< number of bins */
112  int ncluster, /**< number of cluster */
113  SCIP_Real** cmatrix /**< the transition matrix */
114  );
115 
116 /** function that returns the successive cluster along the cycle */
117 int phi(
118  int k, /**< the cluster */
119  int ncluster /**< the number of clusters*/
120  );
121 
122 /** function that returns the previous cluster along the cycle */
123 int phiinv(
124  int k, /**< the cluster */
125  int ncluster /**< the number of clusters*/
126  );
127 
128 /** assign the variables in scip according to the found clustering. */
130  SCIP* scip, /**< SCIP data structure */
131  SCIP_SOL* sol, /**< the SCIP solution */
132  SCIP_Real** clustering, /**< the matrix with the clusterassignment */
133  int nbins, /**< the number of bins */
134  int ncluster /**< the number of cluster */
135  );
136 
137 /** check if the clustering has exactly one state in every cluster. */
139  SCIP* scip, /**< SCIP data structure */
140  SCIP_Real** solclustering, /**< matrix with the clustering */
141  int nbins, /**< the number of bins */
142  int ncluster /**< the number of clusters */
143  );
144 
145 #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:54
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:70
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:163
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