Scippy

    SCIP

    Solving Constraint Integer Programs

    type_prob.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 type_prob.h
    26 * @ingroup TYPEDEFINITIONS
    27 * @brief type definitions for storing and manipulating the main problem
    28 * @author Tobias Achterberg
    29 */
    30
    31/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
    32
    33#ifndef __SCIP_TYPE_PROB_H__
    34#define __SCIP_TYPE_PROB_H__
    35
    36#include "scip/def.h"
    37#include "scip/type_retcode.h"
    38#include "scip/type_scip.h"
    39
    40#ifdef __cplusplus
    41extern "C" {
    42#endif
    43
    44/** objective sense: minimization or maximization */
    46{
    47 SCIP_OBJSENSE_MAXIMIZE = -1, /**< maximization of objective function */
    48 SCIP_OBJSENSE_MINIMIZE = +1 /**< minimization of objective function (the default) */
    49};
    51
    52typedef struct SCIP_Prob SCIP_PROB; /**< main problem to solve */
    53typedef struct SCIP_ProbData SCIP_PROBDATA; /**< user problem data set by the reader */
    54
    55
    56/** frees user data of original problem (called when the original problem is freed)
    57 *
    58 * This method should free the user data of the original problem.
    59 *
    60 * input:
    61 * - scip : SCIP main data structure
    62 * - probdata : pointer to the user problem data to free
    63 */
    64#define SCIP_DECL_PROBDELORIG(x) SCIP_RETCODE x (SCIP* scip, SCIP_PROBDATA** probdata)
    65
    66/** creates user data of transformed problem by transforming the original user problem data
    67 * (called after problem was transformed)
    68 *
    69 * Because the original problem and the user data of the original problem should not be
    70 * modified during the solving process, a transformed problem is created as a copy of
    71 * the original problem. If the user problem data is never modified during the solving
    72 * process anyways, it is enough to simple copy the user data's pointer. This is the
    73 * default implementation, which is used when a NULL is given as PROBTRANS method.
    74 * If the user data may be modified during the solving process (e.g. during preprocessing),
    75 * the PROBTRANS method must be given and has to copy the user problem data to a different
    76 * memory location.
    77 *
    78 * input:
    79 * - scip : SCIP main data structure
    80 * - sourcedata : source problem data to transform
    81 * - targetdata : pointer to store created transformed problem data
    82 */
    83#define SCIP_DECL_PROBTRANS(x) SCIP_RETCODE x (SCIP* scip, SCIP_PROBDATA* sourcedata, SCIP_PROBDATA** targetdata)
    84
    85/** frees user data of transformed problem (called when the transformed problem is freed)
    86 *
    87 * This method has to be implemented, if the PROBTRANS method is not a simple pointer
    88 * copy operation like in the default PROBTRANS implementation. It should free the
    89 * user data of the transformed problem, that was created in the PROBTRANS method.
    90 *
    91 * input:
    92 * - scip : SCIP main data structure
    93 * - probdata : pointer to the user problem data to free
    94 */
    95#define SCIP_DECL_PROBDELTRANS(x) SCIP_RETCODE x (SCIP* scip, SCIP_PROBDATA** probdata)
    96
    97/** solving process initialization method of transformed data (called before the branch and bound process begins)
    98 *
    99 * This method is called before the branch and bound process begins and can be used to initialize user problem
    100 * data that depends for example on the number of active problem variables, because these are now fixed.
    101 *
    102 * input:
    103 * - scip : SCIP main data structure
    104 * - probdata : user problem data
    105 */
    106#define SCIP_DECL_PROBINITSOL(x) SCIP_RETCODE x (SCIP* scip, SCIP_PROBDATA* probdata)
    107
    108/** solving process deinitialization method of transformed data (called before the branch and bound data is freed)
    109 *
    110 * This method is called before the branch and bound data is freed and should be used to free all data that
    111 * was allocated in the solving process initialization method. The user has to make sure, that all LP rows associated
    112 * to the transformed user problem data are released.
    113 *
    114 * input:
    115 * - scip : SCIP main data structure
    116 * - probdata : user problem data
    117 * - restart : was this exit solve call triggered by a restart?
    118 */
    119#define SCIP_DECL_PROBEXITSOL(x) SCIP_RETCODE x (SCIP* scip, SCIP_PROBDATA* probdata, SCIP_Bool restart)
    120
    121/** copies user data of source SCIP for the target SCIP
    122 *
    123 * This method should copy the problem data of the source SCIP and create a target problem data for (target)
    124 * SCIP. Implementing this callback is optional. If the copying process was successful the target SCIP gets this
    125 * problem data assigned. In case the result pointer is set to SCIP_DIDNOTRUN the target SCIP will have no problem data
    126 * at all.
    127 *
    128 * The variable map and the constraint map can be used via the function SCIPgetVarCopy() and SCIPgetConsCopy(),
    129 * respectively, to get for certain variables and constraints of the source SCIP the counter parts in the target
    130 * SCIP. You should be very carefully in using these two methods since they could lead to an infinite loop due to
    131 * recursion.
    132 *
    133 * input:
    134 * - scip : target SCIP data structure
    135 * - sourcescip : source SCIP main data structure
    136 * - sourcedata : source user problem data
    137 * - varmap, : a hashmap which stores the mapping of source variables to corresponding target variables
    138 * - consmap, : a hashmap which stores the mapping of source constraints to corresponding target constraints
    139 * - targetdata : pointer to the target user problem data to create
    140 * - original : copy original or transformed problem?
    141 * - global : create a global or a local copy?
    142 *
    143 * output:
    144 * - result : pointer to store the result of the call
    145 *
    146 * possible return values for *result:
    147 * - SCIP_DIDNOTRUN : the copying process was not performed
    148 * - SCIP_SUCCESS : the copying process was successfully performed
    149 */
    150#define SCIP_DECL_PROBCOPY(x) SCIP_RETCODE x (SCIP* scip, SCIP* sourcescip, SCIP_PROBDATA* sourcedata, \
    151 SCIP_HASHMAP* varmap, SCIP_HASHMAP* consmap, SCIP_PROBDATA** targetdata, SCIP_Bool original, \
    152 SCIP_Bool global, SCIP_RESULT* result)
    153
    154#ifdef __cplusplus
    155}
    156#endif
    157
    158#endif
    common defines and data types used in all packages of SCIP
    struct SCIP_ProbData SCIP_PROBDATA
    Definition: type_prob.h:53
    SCIP_Objsense
    Definition: type_prob.h:46
    @ SCIP_OBJSENSE_MAXIMIZE
    Definition: type_prob.h:47
    @ SCIP_OBJSENSE_MINIMIZE
    Definition: type_prob.h:48
    enum SCIP_Objsense SCIP_OBJSENSE
    Definition: type_prob.h:50
    type definitions for return codes for SCIP methods
    type definitions for SCIP's main datastructure