Scippy

    SCIP

    Solving Constraint Integer Programs

    pub_misc_linear.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 pub_misc_linear.h
    26 * @ingroup PUBLICCOREAPI
    27 * @brief internal miscellaneous methods for linear constraints
    28 * @author Jakob Witzig
    29 */
    30
    31/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
    32
    33#ifndef __SCIP_MISC_LINEAR_H__
    34#define __SCIP_MISC_LINEAR_H__
    35
    36
    37#include "scip/def.h"
    38#include "scip/type_retcode.h"
    39#include "scip/type_cons.h"
    40#include "scip/type_lp.h"
    41#include "scip/type_var.h"
    42
    43#ifdef __cplusplus
    44extern "C" {
    45#endif
    46
    47/** returns the right-hand side of an arbitrary SCIP constraint that can be represented as a single linear constraint
    48 *
    49 * @note The success pointer indicates if the individual contraint handler was able to return the involved values
    50 */
    51SCIP_EXPORT
    53 SCIP* scip, /**< SCIP data structure */
    54 SCIP_CONS* cons, /**< constraint for which right-hand side is queried */
    55 SCIP_Bool* success /**< pointer to store whether a valid right-hand side was returned */
    56 );
    57
    58/** returns the left-hand side of an arbitrary SCIP constraint that can be represented as a single linear constraint
    59 *
    60 * @note The success pointer indicates if the individual contraint handler was able to return the involved values
    61 */
    62SCIP_EXPORT
    64 SCIP* scip, /**< SCIP data structure */
    65 SCIP_CONS* cons, /**< constraint to get left hand side for */
    66 SCIP_Bool* success /**< pointer to store whether a valid left-hand side was returned */
    67 );
    68
    69/** returns exact the right-hand side of an arbitrary SCIP constraint that can be represented as a single linear constraint
    70 *
    71 * @note The success pointer indicates if the individual contraint handler was able to return the involved values
    72 */
    73SCIP_EXPORT
    75 SCIP* scip, /**< SCIP data structure */
    76 SCIP_CONS* cons, /**< constraint for which right-hand side is queried */
    77 SCIP_Bool* success /**< pointer to store whether a valid right-hand side was returned */
    78 );
    79
    80/** returns the exact left-hand side of an arbitrary SCIP constraint that can be represented as a single linear constraint
    81 *
    82 * @note The success pointer indicates if the individual contraint handler was able to return the involved values
    83 */
    84SCIP_EXPORT
    86 SCIP* scip, /**< SCIP data structure */
    87 SCIP_CONS* cons, /**< constraint to get left-hand side for */
    88 SCIP_Bool* success /**< pointer to store whether a valid left-hand side was returned */
    89 );
    90
    91/** returns the value array of an arbitrary SCIP constraint that can be represented as a single linear constraint
    92 *
    93 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    94 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    95 *
    96 * @note The success pointer indicates if the individual contraint handler was able to return the involved values
    97 */
    98SCIP_EXPORT
    100 SCIP* scip, /**< SCIP data structure */
    101 SCIP_CONS* cons, /**< constraint for which the coefficients are wanted */
    102 SCIP_Real* vals, /**< array to store the coefficients of the constraint */
    103 int varssize, /**< available slots in vals array needed to check if the array is large enough */
    104 SCIP_Bool* success /**< pointer to store whether the coefficients are successfully copied */
    105 );
    106
    107/** returns the exact value array of an arbitrary SCIP constraint that can be represented as a single linear constraint
    108 *
    109 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    110 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    111 *
    112 * @note The success pointer indicates if the individual contraint handler was able to return the involved values
    113 */
    114SCIP_EXPORT
    116 SCIP* scip, /**< SCIP data structure */
    117 SCIP_CONS* cons, /**< constraint for which the coefficients are wanted */
    118 SCIP_RATIONAL** vals, /**< array to store the coefficients of the constraint */
    119 int varssize, /**< available slots in vals array needed to check if the array is large enough */
    120 SCIP_Bool* success /**< pointer to store whether the coefficients are successfully copied */
    121 );
    122
    123/** returns the dual farkas solution of an arbitrary SCIP constraint that can be represented as a single linear constraint
    124 *
    125 * @note The success pointer indicates if the individual contraint handler was able to return the dual farkas solution
    126 */
    127SCIP_EXPORT
    129 SCIP* scip, /**< SCIP data structure */
    130 SCIP_CONS* cons, /**< constraint to get left hand side for */
    131 SCIP_Real* dualfarkas, /**< pointer to store the dual farkas solution */
    132 SCIP_Bool* success /**< pointer to store whether the dual farkas solution is successfully returned */
    133 );
    134
    135/** returns the dual solution of an arbitrary SCIP constraint that can be represented as a single linear constraint
    136 *
    137 * @note The success pointer indicates if the individual contraint handler was able to return the dual solution
    138 */
    139SCIP_EXPORT
    141 SCIP* scip, /**< SCIP data structure */
    142 SCIP_CONS* cons, /**< constraint to get left hand side for */
    143 SCIP_Real* dualsol, /**< pointer to store the dual solution */
    144 SCIP_Bool* success /**< pointer to store whether the dual solution is successfully returned */
    145 );
    146
    147/** returns the row of an arbitrary SCIP constraint that can be represented as a single linear constraint
    148 * or NULL of no row is available
    149 */
    150SCIP_EXPORT
    152 SCIP* scip, /**< SCIP data structure */
    153 SCIP_CONS* cons /**< constraint to get left hand side for */
    154 );
    155
    156/** creates and returns the row of an arbitrary SCIP constraint that can be represented as a single linear constraint */
    157SCIP_EXPORT
    159 SCIP* scip, /**< SCIP data structure */
    160 SCIP_CONS* cons, /**< constraint for which row is queried */
    161 SCIP_ROW** row /**< pointer to store the created row */
    162 );
    163
    164/** adds the given variable to the input constraint.
    165 * If the constraint is setppc or logicor the value is ignored. If the constraint is knapsack, then the value is
    166 * converted to an int. A warning is passed if the SCIP_Real is not an integer.
    167 * TODO: Allow val to be a pointer.
    168 */
    169SCIP_EXPORT
    171 SCIP* scip, /**< SCIP data structure */
    172 SCIP_CONS* cons, /**< constraint for which row is queried */
    173 SCIP_VAR* var, /**< variable of the constraint entry */
    174 SCIP_Real val /**< the coefficient of the constraint entry */
    175 );
    176
    177#ifdef __cplusplus
    178}
    179#endif
    180
    181#endif
    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_RATIONAL * SCIPconsGetRhsExact(SCIP *scip, SCIP_CONS *cons, SCIP_Bool *success)
    Definition: misc_linear.c:176
    SCIP_Real SCIPconsGetLhs(SCIP *scip, SCIP_CONS *cons, SCIP_Bool *success)
    Definition: misc_linear.c:112
    void SCIPconsGetDualfarkas(SCIP *scip, SCIP_CONS *cons, SCIP_Real *dualfarkas, SCIP_Bool *success)
    Definition: misc_linear.c:438
    SCIP_RETCODE SCIPgetConsValsExact(SCIP *scip, SCIP_CONS *cons, SCIP_RATIONAL **vals, int varssize, SCIP_Bool *success)
    Definition: misc_linear.c:378
    SCIP_RETCODE SCIPconsAddCoef(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real val)
    Definition: misc_linear.c:675
    SCIP_RETCODE SCIPgetConsVals(SCIP *scip, SCIP_CONS *cons, SCIP_Real *vals, int varssize, SCIP_Bool *success)
    Definition: misc_linear.c:253
    SCIP_RATIONAL * SCIPconsGetLhsExact(SCIP *scip, SCIP_CONS *cons, SCIP_Bool *success)
    Definition: misc_linear.c:213
    SCIP_Real SCIPconsGetRhs(SCIP *scip, SCIP_CONS *cons, SCIP_Bool *success)
    Definition: misc_linear.c:48
    void SCIPconsGetDualsol(SCIP *scip, SCIP_CONS *cons, SCIP_Real *dualsol, SCIP_Bool *success)
    Definition: misc_linear.c:494
    SCIP_RETCODE SCIPconsCreateRow(SCIP *scip, SCIP_CONS *cons, SCIP_ROW **row)
    Definition: misc_linear.c:599
    SCIP_ROW * SCIPconsGetRow(SCIP *scip, SCIP_CONS *cons)
    Definition: misc_linear.c:549
    type definitions for constraints and constraint handlers
    type definitions for LP management
    type definitions for return codes for SCIP methods
    enum SCIP_Retcode SCIP_RETCODE
    Definition: type_retcode.h:63
    type definitions for problem variables