Scippy

    SCIP

    Solving Constraint Integer Programs

    pattern.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 pattern.h
    26 * @brief pattern data for ringpacking problem
    27 * @author Benjamin Mueller
    28 */
    29
    30/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
    31
    32#ifndef __SCIP_PATTERN__
    33#define __SCIP_PATTERN__
    34
    35#include "scip/scip.h"
    36
    37/*
    38 * data structures
    39 */
    40
    42{
    43 SCIP_PACKABLE_NO = 0, /**< pattern is definitely packable */
    44 SCIP_PACKABLE_YES = 1, /**< pattern is definitely not packable */
    45 SCIP_PACKABLE_UNKNOWN = 2 /**< it is unknown whether pattern is packable */
    46};
    48
    50{
    51 SCIP_PATTERNTYPE_CIRCULAR = 0, /**< circular pattern */
    52 SCIP_PATTERNTYPE_RECTANGULAR = 1 /**< rectangular pattern */
    53};
    55
    57{
    58 BMS_BLKMEM* blkmem; /**< block memory */
    59 SCIP_PATTERNTYPE patterntype; /**< pattern type */
    60 SCIP_PACKABLE packable; /**< packable status */
    61 SCIP_Real* xs; /**< array containing the x-coordinate of each element */
    62 SCIP_Real* ys; /**< array containing the y-coordinate of each element */
    63 int* types; /**< array storing the type of each element */
    64 int size; /**< size of types, xs, and ys arrays */
    65 int nelems; /**< number of elements stored */
    66 int nlocks; /**< number of locks */
    67 int type; /**< type of the boundary circle */
    68};
    70
    71/** creates an empty circular pattern */
    73 SCIP* scip, /**< SCIP data structure */
    74 SCIP_PATTERN** pattern, /**< pointer to store pattern */
    75 int type /**< circle type (not needed for rectangular patterns) */
    76 );
    77
    78/** creates an empty rectangular pattern */
    80 SCIP* scip, /**< SCIP data structure */
    81 SCIP_PATTERN** pattern /**< pointer to store pattern */
    82 );
    83
    84/** captures a pattern */
    86 SCIP_PATTERN* pattern /**< pattern */
    87 );
    88
    89/* frees a pattern */
    91 SCIP* scip, /**< SCIP data structure */
    92 SCIP_PATTERN** pattern /**< pointer to free pattern */
    93 );
    94
    95/** copies a pattern */
    97 SCIP* scip, /**< SCIP data structure */
    98 SCIP_PATTERN* pattern, /**< pattern to copy */
    99 SCIP_PATTERN** copy /**< pointer to store the copy */
    100 );
    101
    102/** adds an element of a given type to a pattern; packable status does not change */
    104 SCIP_PATTERN* pattern, /**< pattern */
    105 int type, /**< element of a given type */
    106 SCIP_Real x, /**< x-coordinate (SCIP_INVALID: unknown) */
    107 SCIP_Real y /**< y-coordinate (SCIP_INVALID: unknown) */
    108 );
    109
    110/** removes the last k elements */
    112 SCIP_PATTERN* pattern, /**< pattern */
    113 int k /**< number of elements to remove */
    114 );
    115
    116/** returns the total number of elements of a given type in the pattern */
    118 SCIP_PATTERN* pattern /**< pattern */
    119 );
    120
    121/** returns the type of the i-th element */
    123 SCIP_PATTERN* pattern, /**< pattern */
    124 int i /**< i-th element */
    125 );
    126
    127/** returns the total number of elements of a given type */
    129 SCIP_PATTERN* pattern, /**< pattern */
    130 int type /**< type */
    131 );
    132
    133/** returns the x-coordinate of an element */
    135 SCIP_PATTERN* pattern, /**< pattern */
    136 int elem /**< index of the element */
    137 );
    138
    139/** returns the y-coordinate of an element */
    141 SCIP_PATTERN* pattern, /**< pattern */
    142 int elem /**< index of the element */
    143 );
    144
    145/** sets the (x,y) position of an element */
    147 SCIP_PATTERN* pattern, /**< pattern */
    148 int elem, /**< index of the element */
    149 SCIP_Real x, /**< x-coordinate */
    150 SCIP_Real y /**< y-coordinate */
    151 );
    152
    153/** returns the type of a pattern */
    155 SCIP_PATTERN* pattern /**< pattern */
    156 );
    157
    158/** returns the type of the boundary circle
    159 *
    160 * @note this function can only be called for circular patterns
    161 */
    163 SCIP_PATTERN *pattern /**< pattern */
    164);
    165
    166/** sets the type of the boundary circle
    167 *
    168 * @note this function can only be called for circular patterns
    169 */
    171 SCIP_PATTERN* pattern, /**< pattern */
    172 int type /**< type */
    173 );
    174
    175/** returns the packable status of a pattern */
    177 SCIP_PATTERN* pattern /**< pattern */
    178 );
    179
    180/** sets the packable status of a pattern */
    182 SCIP_PATTERN* pattern, /**< pattern */
    183 SCIP_PACKABLE packable /**< packable status */
    184 );
    185
    186#endif /* __SCIP_PATTERN__ */
    SCIP_VAR ** y
    Definition: circlepacking.c:64
    SCIP_VAR ** x
    Definition: circlepacking.c:63
    #define SCIP_Real
    Definition: def.h:156
    struct BMS_BlkMem BMS_BLKMEM
    Definition: memory.h:437
    SCIP_Real SCIPpatternGetElementPosY(SCIP_PATTERN *pattern, int elem)
    Definition: pattern.c:269
    enum SCIP_Patterntype SCIP_PATTERNTYPE
    Definition: pattern.h:54
    SCIP_RETCODE SCIPpatternAddElement(SCIP_PATTERN *pattern, int type, SCIP_Real x, SCIP_Real y)
    Definition: pattern.c:182
    void SCIPpatternSetPackableStatus(SCIP_PATTERN *pattern, SCIP_PACKABLE packable)
    Definition: pattern.c:345
    SCIP_Real SCIPpatternGetElementPosX(SCIP_PATTERN *pattern, int elem)
    Definition: pattern.c:257
    enum SCIP_Packable SCIP_PACKABLE
    Definition: pattern.h:47
    SCIP_RETCODE SCIPpatternCreateRectangular(SCIP *scip, SCIP_PATTERN **pattern)
    Definition: pattern.c:107
    SCIP_PATTERNTYPE SCIPpatternGetPatternType(SCIP_PATTERN *pattern)
    Definition: pattern.c:296
    int SCIPpatternCountElements(SCIP_PATTERN *pattern, int type)
    Definition: pattern.c:237
    void SCIPpatternSetElementPos(SCIP_PATTERN *pattern, int elem, SCIP_Real x, SCIP_Real y)
    Definition: pattern.c:281
    void SCIPpatternRemoveLastElements(SCIP_PATTERN *pattern, int k)
    Definition: pattern.c:203
    SCIP_RETCODE SCIPpatternCreateCircular(SCIP *scip, SCIP_PATTERN **pattern, int type)
    Definition: pattern.c:97
    SCIP_PACKABLE SCIPpatternGetPackableStatus(SCIP_PATTERN *pattern)
    Definition: pattern.c:335
    void SCIPpatternSetType(SCIP_PATTERN *pattern, int type)
    Definition: pattern.c:323
    int SCIPpatternGetElementType(SCIP_PATTERN *pattern, int i)
    Definition: pattern.c:225
    void SCIPpatternRelease(SCIP *scip, SCIP_PATTERN **pattern)
    Definition: pattern.c:126
    int SCIPpatternGetNElemens(SCIP_PATTERN *pattern)
    Definition: pattern.c:215
    SCIP_Patterntype
    Definition: pattern.h:50
    @ SCIP_PATTERNTYPE_RECTANGULAR
    Definition: pattern.h:52
    @ SCIP_PATTERNTYPE_CIRCULAR
    Definition: pattern.h:51
    SCIP_Packable
    Definition: pattern.h:42
    @ SCIP_PACKABLE_NO
    Definition: pattern.h:43
    @ SCIP_PACKABLE_YES
    Definition: pattern.h:44
    @ SCIP_PACKABLE_UNKNOWN
    Definition: pattern.h:45
    void SCIPpatternCapture(SCIP_PATTERN *pattern)
    Definition: pattern.c:116
    SCIP_RETCODE SCIPpatternCopy(SCIP *scip, SCIP_PATTERN *pattern, SCIP_PATTERN **copy)
    Definition: pattern.c:152
    int SCIPpatternGetCircleType(SCIP_PATTERN *pattern)
    Definition: pattern.c:309
    SCIP callable library.
    int nlocks
    Definition: pattern.h:66
    int type
    Definition: pattern.h:67
    int nelems
    Definition: pattern.h:65
    SCIP_Real * xs
    Definition: pattern.h:61
    SCIP_PATTERNTYPE patterntype
    Definition: pattern.h:59
    BMS_BLKMEM * blkmem
    Definition: pattern.h:58
    SCIP_Real * ys
    Definition: pattern.h:62
    SCIP_PACKABLE packable
    Definition: pattern.h:60
    int size
    Definition: pattern.h:64
    int * types
    Definition: pattern.h:63
    enum SCIP_Retcode SCIP_RETCODE
    Definition: type_retcode.h:63