Detailed Description
problem data for cycle clustering problem
This file implements the problem data for the cycle clustering problem.
The problem data contains original transition matrix, the scaling parameter that appears in the objective function, and all variables that appear in the problem.
Definition in file probdata_cyc.c.
#include "probdata_cyc.h"
#include "scip/cons_nonlinear.h"
#include "scip/cons_linear.h"
#include "scip/cons_logicor.h"
#include "scip/var.h"
#include <assert.h>
Go to the source code of this file.
Function Documentation
◆ isPartition()
Check if the clustering has exactly one state in every cluster.
- Parameters
-
scip SCIP data structure solclustering matrix with the clustering nbins the number of bins ncluster the number of clusters
Definition at line 57 of file probdata_cyc.c.
References FALSE, SCIP_Real, SCIPisEQ(), SCIPisIntegral(), SCIPisZero(), and TRUE.
Referenced by createSwitchSolution(), runCyckerlin(), SCIP_DECL_HEUREXEC(), and switchNext().
◆ assignVars()
SCIP_RETCODE assignVars | ( | SCIP * | scip, |
SCIP_SOL * | sol, | ||
SCIP_Real ** | clustering, | ||
int | nbins, | ||
int | ncluster | ||
) |
Assign the variables in scip according to the found clustering.
- Parameters
-
scip SCIP data structure sol the SCIP solution clustering the matrix with the clusterassignment nbins the number of bins ncluster the number of cluster
Definition at line 88 of file probdata_cyc.c.
References NULL, phi(), SCIP_CALL, SCIP_OKAY, SCIP_VARSTATUS_MULTAGGR, SCIPcycGetBinvars(), SCIPcycGetEdgevars(), SCIPisEQ(), SCIPisGE(), SCIPisIntegral(), SCIPisLE(), SCIPsetSolVal(), SCIPvarGetLbGlobal(), SCIPvarGetStatus(), SCIPvarGetTransVar(), SCIPvarGetUbGlobal(), and SCIPvarIsTransformed().
Referenced by createSwitchSolution(), SCIP_DECL_HEUREXEC(), and SCIPcycAddIncompleteSol().
◆ phi()
int phi | ( | int | k, |
int | ncluster | ||
) |
function that returns the successive cluster along the cycle
- Parameters
-
k the cluster ncluster the number of clusters
Definition at line 181 of file probdata_cyc.c.
Referenced by assignVars(), createProbQP(), createProbSimplified(), and SCIPcycPrintSolutionValues().
◆ phiinv()
int phiinv | ( | int | k, |
int | ncluster | ||
) |
function that returns the predecessor-cluster along the cycle
- Parameters
-
k the cluster ncluster the number of clusters
Definition at line 193 of file probdata_cyc.c.
Referenced by createProbSimplified(), and getTempObj().
◆ createVariables()
|
static |
creates all the variables for the problem. The constraints are added later, depending on the model that is used
- Parameters
-
scip SCIP data Structure probdata the problem data
Definition at line 209 of file probdata_cyc.c.
References NULL, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OBJSENSE_MAXIMIZE, SCIP_OKAY, SCIP_VARTYPE_BINARY, SCIPaddVar(), SCIPallocBlockMemoryArray, SCIPallocClearBlockMemoryArray, SCIPcreateVarBasic(), SCIPdigraphAddArc(), SCIPisZero(), SCIPsetObjsense(), and SCIPsnprintf().
Referenced by SCIPcreateProbCyc().
◆ createProbSimplifiedTest()
|
static |
create the problem without variable amount of clusters, use simpler non-facet-defining inequalities
- Parameters
-
scip SCIP Data Structure probdata the problem data
Definition at line 278 of file probdata_cyc.c.
References FALSE, NULL, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIPaddCoefLinear(), SCIPaddCoefLogicor(), SCIPaddCoefSetppc(), SCIPaddCons(), SCIPchgVarObj(), SCIPcreateConsBasicLinear(), SCIPcreateConsBasicLogicor(), SCIPcreateConsLinear(), SCIPcreateConsSetpart(), SCIPgetRealParam(), SCIPinfinity(), SCIPinfoMessage(), SCIPreleaseCons(), SCIPsnprintf(), and TRUE.
Referenced by SCIPcreateProbCyc().
◆ createProbSimplified()
|
static |
create the problem without variable amount of clusters, using three edge-variables for each pair of states. This is the tested default version.
- Parameters
-
scip SCIP Data Structure probdata The problem data
Definition at line 420 of file probdata_cyc.c.
References FALSE, NULL, phi(), phiinv(), SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIP_VERBLEVEL_NORMAL, SCIPaddCoefLinear(), SCIPaddCoefLogicor(), SCIPaddCoefSetppc(), SCIPaddCons(), SCIPaddOrigObjoffset(), SCIPchgVarObj(), SCIPcreateConsBasicLinear(), SCIPcreateConsBasicLogicor(), SCIPcreateConsLinear(), SCIPcreateConsSetpart(), SCIPgetRealParam(), SCIPinfinity(), SCIPisZero(), SCIPreleaseCons(), SCIPsnprintf(), SCIPverbMessage(), and TRUE.
Referenced by SCIPcreateProbCyc().
◆ createProbQP()
|
static |
create the problem without variable amount of clusters, using quadratic formulations. This is inferior to the simplified variant. Only useful for comparing relaxations.
- Parameters
-
scip SCIP Data Structure probdata The problem data
Definition at line 636 of file probdata_cyc.c.
References FALSE, NULL, phi(), SCIP_CALL, SCIP_Longint, SCIP_MAXSTRLEN, SCIP_OBJSENSE_MAXIMIZE, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_BINARY, SCIP_VARTYPE_CONTINUOUS, SCIPaddCoefLogicor(), SCIPaddCoefSetppc(), SCIPaddCons(), SCIPaddVar(), SCIPallocBlockMemoryArray, SCIPallocBufferArray, SCIPallocClearBlockMemoryArray, SCIPcreateConsBasicLogicor(), SCIPcreateConsQuadraticNonlinear(), SCIPcreateConsSetpart(), SCIPcreateVarBasic(), SCIPfreeBlockMemoryArray, SCIPfreeBufferArray, SCIPgetRealParam(), SCIPinfinity(), SCIPreleaseCons(), SCIPreleaseVar(), SCIPsetObjsense(), SCIPsnprintf(), and TRUE.
Referenced by SCIPcreateProbCyc().
◆ createProbOnlyEdge()
|
static |
create the problem with variable amount of clusters. Very large number of constraints not viable for large scale problems.
- Parameters
-
scip SCIP Data Structure probdata The problem data
Definition at line 820 of file probdata_cyc.c.
References FALSE, MAX, MIN, NULL, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIP_VERBLEVEL_NORMAL, SCIPaddCoefLinear(), SCIPaddCons(), SCIPchgVarObj(), SCIPcreateConsLinear(), SCIPgetRealParam(), SCIPinfinity(), SCIPreleaseCons(), SCIPsnprintf(), SCIPverbMessage(), and TRUE.
Referenced by SCIPcreateProbCyc().
◆ SCIP_DECL_PROBTRANS()
|
static |
Scip callback to transform the problem
Definition at line 954 of file probdata_cyc.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemory, SCIPallocBlockMemoryArray, SCIPallocClearBlockMemoryArray, SCIPcopyDigraph(), and SCIPtransformVar().
◆ SCIP_DECL_PROBDELORIG()
|
static |
delete-callback method of scip
Definition at line 1039 of file probdata_cyc.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPdigraphFree(), SCIPdigraphFreeComponents(), SCIPfreeBlockMemory, SCIPfreeBlockMemoryArray, and SCIPreleaseVar().
◆ SCIP_DECL_PROBDELTRANS()
|
static |
scip-callback to delete the transformed problem
Definition at line 1108 of file probdata_cyc.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPdigraphFree(), SCIPdigraphFreeComponents(), SCIPfreeBlockMemory, SCIPfreeBlockMemoryArray, and SCIPreleaseVar().
◆ SCIP_DECL_PROBCOPY()
|
static |
callback method of scip for copying the probdata
Definition at line 1177 of file probdata_cyc.c.
References FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_SUCCESS, SCIPallocBlockMemory, SCIPallocBlockMemoryArray, SCIPallocClearBlockMemoryArray, SCIPcaptureVar(), SCIPcopyDigraph(), SCIPgetTransformedVar(), SCIPgetVarCopy(), and SCIPvarIsActive().
◆ SCIPcreateProbCyc()
SCIP_RETCODE SCIPcreateProbCyc | ( | SCIP * | scip, |
const char * | name, | ||
int | nbins, | ||
int | ncluster, | ||
SCIP_Real ** | cmatrix | ||
) |
Create the probdata for an cyc-clustering problem
add callback methods to scip
- Parameters
-
scip SCIP data structure name problem name nbins number of bins ncluster number of cluster cmatrix The transition matrix
Definition at line 1303 of file probdata_cyc.c.
References createProbOnlyEdge(), createProbQP(), createProbSimplified(), createProbSimplifiedTest(), createVariables(), NULL, SCIP_CALL, SCIP_OKAY, SCIP_VERBLEVEL_NORMAL, SCIPABORT, SCIPallocBlockMemory, SCIPallocBlockMemoryArray, SCIPcreateDigraph(), SCIPcreateProbBasic(), SCIPgetCharParam(), SCIPsetProbCopy(), SCIPsetProbData(), SCIPsetProbDelorig(), SCIPsetProbDeltrans(), SCIPsetProbTrans(), and SCIPverbMessage().
Referenced by readCyc(), and SCIPapplyRedSize().
◆ SCIPcycGetCmatrix()
Getter methods for the various parts of the probdata Returns the transition matrix
- Parameters
-
scip SCIP data structure
Definition at line 1382 of file probdata_cyc.c.
References NULL, and SCIPgetProbData().
Referenced by runCyckerlin(), SCIP_DECL_HEUREXEC(), and SCIPapplyRedSize().
◆ SCIPcycGetNBins()
int SCIPcycGetNBins | ( | SCIP * | scip | ) |
Returns the number of states
- Parameters
-
scip SCIP data structure
Definition at line 1398 of file probdata_cyc.c.
References NULL, and SCIPgetProbData().
Referenced by getBranchCands(), getSolutionValues(), runCyckerlin(), SCIP_DECL_BRANCHEXECLP(), SCIP_DECL_HEUREXEC(), SCIP_DECL_SEPAEXECLP(), SCIPapplyRedSize(), SCIPcycAddIncompleteSol(), and switchNext().
◆ SCIPcycGetNCluster()
int SCIPcycGetNCluster | ( | SCIP * | scip | ) |
Returns the number of clusters
- Parameters
-
scip SCIP data structure
Definition at line 1414 of file probdata_cyc.c.
References NULL, and SCIPgetProbData().
Referenced by addPathCuts(), addSubtourCuts(), branchOnBin(), getBranchCands(), getSolutionValues(), runCyckerlin(), SCIP_DECL_BRANCHEXECLP(), SCIP_DECL_HEUREXEC(), SCIP_DECL_SEPAEXECLP(), SCIPapplyRedSize(), SCIPcycAddIncompleteSol(), and switchNext().
◆ SCIPcycGetBinvars()
Returns the state-variable-matrix
- Parameters
-
scip SCIP data structure
Definition at line 1430 of file probdata_cyc.c.
References NULL, and SCIPgetProbData().
Referenced by assignVars(), branchOnBin(), getBranchCands(), getSolutionValues(), SCIP_DECL_BRANCHEXECLP(), SCIP_DECL_HEUREXEC(), and SCIPcycAddIncompleteSol().
◆ SCIPcycGetScale()
Returns the scaling parameter
- Parameters
-
scip SCIP data structure
Definition at line 1447 of file probdata_cyc.c.
References NULL, and SCIPgetProbData().
Referenced by assignNextBin(), createSwitchSolution(), getTempObj(), SCIP_DECL_HEUREXEC(), SCIPapplyRedSize(), and switchNext().
◆ SCIPcycGetEdgevars()
Returns the edge variables
- Parameters
-
scip SCIP data structure
Definition at line 1463 of file probdata_cyc.c.
References NULL, and SCIPgetProbData().
Referenced by addPathCuts(), addSubtourCuts(), addTourCuts(), assignVars(), createPartitionCut(), and SCIP_DECL_SEPAEXECLP().
◆ getEdgevar()
return one specific edge variable
- Parameters
-
edgevars edgevar data structure state1 first state state2 second state direction direction, 0 = incluster, 1 = forward
Definition at line 1480 of file probdata_cyc.c.
References NULL.
Referenced by addPathCuts(), addSubtourCuts(), addTourCuts(), createPartitionCut(), and SCIP_DECL_SEPAEXECLP().
◆ edgesExist()
check for an array of states, if all possible edge-combinations exist
- Parameters
-
edgevars edgevar data structure states state array nstates size of state array
Definition at line 1496 of file probdata_cyc.c.
References FALSE, NULL, and TRUE.
Referenced by SCIP_DECL_SEPAEXECLP().
◆ SCIPcycGetEdgeGraph()
SCIP_DIGRAPH * SCIPcycGetEdgeGraph | ( | SCIP * | scip | ) |
Returns the edge-graph
- Parameters
-
scip SCIP data structure
Definition at line 1528 of file probdata_cyc.c.
References NULL, and SCIPgetProbData().
Referenced by SCIP_DECL_SEPAEXECLP().
◆ SCIPcycPrintSolutionValues()
SCIP_RETCODE SCIPcycPrintSolutionValues | ( | SCIP * | scip, |
SCIP_SOL * | sol | ||
) |
print the model-values like coherence in the clusters and transition-probabilities between clusters that are not evident from the scip-solution
- Parameters
-
scip SCIP data structure sol The solution containg the values
Definition at line 1548 of file probdata_cyc.c.
References NULL, phi(), SCIP_OKAY, SCIP_Real, SCIP_VERBLEVEL_NORMAL, SCIPgetProbData(), SCIPgetSolVal(), and SCIPverbMessage().