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-2025 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
    47/** edge type */
    49{
    50 INCLUSTER = 0, /**< edge inside a single cluster */
    51 CONSECUTIVE_CLUSTER = 1, /**< edge connecting two consecutive cluster */
    52 NON_CONSECUTIVE_CLUSTER = 2 /**< edge connecting two non-consecutive cluster */
    53};
    54typedef enum EdgeType EDGETYPE;
    55
    56
    57/** free memory allocated for an nxn matrix */
    59 SCIP_Real** matrix, /**< the matrix to be freed */
    60 int nbins /**< the size*/
    61 );
    62
    63/** gets the minmal non-zero value in a n x n matrix */
    65 SCIP* scip, /**< SCIP data structure*/
    66 SCIP_Real** matrix, /**< the matrix*/
    67 int size /**< the matrix-size*/
    68 );
    69
    70/** getter methods for the probdata */
    72 SCIP* scip /**< SCIP data structure*/
    73 );
    74
    75/** returns the number of states */
    77 SCIP* scip /**< SCIP data structure*/
    78 );
    79
    80/** returns the number of clusters */
    82 SCIP* scip /**< SCIP data structure*/
    83 );
    84
    85/** returns the state-variable-matrix */
    87 SCIP* scip /**< SCIP data structure*/
    88 );
    89
    90/** returns the edge variables */
    92 SCIP* scip /**< SCIP data structure*/
    93 );
    94
    95/** Return one specific edge variable */
    97 SCIP_VAR**** edgevars, /**< edgevar data structure*/
    98 int state1, /**< first state */
    99 int state2, /**< second state */
    100 EDGETYPE edgetype /**< position in clustering */
    101 );
    102
    103/** check for an array of states, if all possible edge-combinations exist */
    105 SCIP_VAR**** edgevars, /**< edgevar data structure */
    106 int* states, /**< state array */
    107 int nstates /**< size of state array */
    108 );
    109
    110
    111/** returns the edge-graph */
    113 SCIP* scip /**< SCIP data structure */
    114 );
    115
    116/** returns the number of scaling parameter */
    118 SCIP* scip /**< SCIP data structure */
    119 );
    120
    121/** print all the relevant solution data */
    123 SCIP* scip, /**< SCIP data structure*/
    124 SCIP_SOL* sol /**< the solution containing the values*/
    125 );
    126
    127/** create the probdata for a cycle clustering problem */
    129 SCIP* scip, /**< SCIP data structure */
    130 const char* name, /**< problem name */
    131 int nbins, /**< number of bins */
    132 int ncluster, /**< number of cluster */
    133 SCIP_Real** cmatrix /**< the transition matrix */
    134 );
    135
    136/** function that returns the successive cluster along the cycle */
    137int phi(
    138 int k, /**< the cluster */
    139 int ncluster /**< the number of clusters*/
    140 );
    141
    142/** function that returns the previous cluster along the cycle */
    143int phiinv(
    144 int k, /**< the cluster */
    145 int ncluster /**< the number of clusters*/
    146 );
    147
    148/** assign the variables in scip according to the found clustering. */
    150 SCIP* scip, /**< SCIP data structure */
    151 SCIP_SOL* sol, /**< the SCIP solution */
    152 SCIP_Real** clustering, /**< the matrix with the clusterassignment */
    153 int nbins, /**< the number of bins */
    154 int ncluster /**< the number of cluster */
    155 );
    156
    157/** check if the clustering has exactly one state in every cluster. */
    159 SCIP* scip, /**< SCIP data structure */
    160 SCIP_Real** solclustering, /**< matrix with the clustering */
    161 int nbins, /**< the number of bins */
    162 int ncluster /**< the number of clusters */
    163 );
    164
    165#endif
    Constraint handler for the set partitioning / packing / covering constraints .
    common defines and data types used in all packages of SCIP
    #define SCIP_Bool
    Definition: def.h:91
    #define SCIP_Real
    Definition: def.h:156
    SCIP_Bool edgesExist(SCIP_VAR ****edgevars, int *states, int nstates)
    SCIP_RETCODE assignVars(SCIP *scip, SCIP_SOL *sol, SCIP_Real **clustering, int nbins, int ncluster)
    Definition: probdata_cyc.c:88
    SCIP_RETCODE freeMatrix(SCIP_Real **matrix, int nbins)
    EdgeType
    Definition: probdata_cyc.h:49
    @ CONSECUTIVE_CLUSTER
    Definition: probdata_cyc.h:51
    @ INCLUSTER
    Definition: probdata_cyc.h:50
    @ NON_CONSECUTIVE_CLUSTER
    Definition: probdata_cyc.h:52
    SCIP_VAR **** SCIPcycGetEdgevars(SCIP *scip)
    SCIP_RETCODE SCIPcycPrintSolutionValues(SCIP *scip, SCIP_SOL *sol)
    enum EdgeType EDGETYPE
    Definition: probdata_cyc.h:54
    int SCIPcycGetNBins(SCIP *scip)
    int phiinv(int k, int ncluster)
    Definition: probdata_cyc.c:193
    SCIP_VAR * getEdgevar(SCIP_VAR ****edgevars, int state1, int state2, EDGETYPE edgetype)
    SCIP_Real SCIPcycGetScale(SCIP *scip)
    int SCIPcycGetNCluster(SCIP *scip)
    SCIP_VAR *** SCIPcycGetBinvars(SCIP *scip)
    SCIP_DIGRAPH * SCIPcycGetEdgeGraph(SCIP *scip)
    SCIP_Real ** SCIPcycGetCmatrix(SCIP *scip)
    SCIP_Bool isPartition(SCIP *scip, SCIP_Real **solclustering, int nbins, int ncluster)
    Definition: probdata_cyc.c:57
    SCIP_RETCODE SCIPcreateProbCyc(SCIP *scip, const char *name, int nbins, int ncluster, SCIP_Real **cmatrix)
    SCIP_Real getMinNonZero(SCIP *scip, SCIP_Real **matrix, int size)
    int phi(int k, int ncluster)
    Definition: probdata_cyc.c:181
    SCIP callable library.
    tclique user interface
    type definitions for constraints and constraint handlers
    enum SCIP_Retcode SCIP_RETCODE
    Definition: type_retcode.h:63