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-2020 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not visit scipopt.org. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file pub_misc_linear.h
17  * @ingroup INTERNALAPI
18  * @brief internal miscellaneous methods for linear constraints
19  * @author Jakob Witzig
20  */
21 
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23 
24 #ifndef __SCIP_MISC_LINEAR_H__
25 #define __SCIP_MISC_LINEAR_H__
26 
27 
28 #include "scip/def.h"
29 #include "scip/type_retcode.h"
30 #include "scip/type_cons.h"
31 #include "scip/type_lp.h"
32 #include "scip/type_var.h"
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 /** returns the right-hand side of an arbitrary SCIP constraint that can be represented as a single linear constraint
39  *
40  * @note The success pointer indicates if the individual contraint handler was able to return the involved values
41  */
44  SCIP* scip, /**< SCIP data structure */
45  SCIP_CONS* cons, /**< constraint for which right-hand side is queried */
46  SCIP_Bool* success /**< pointer to store whether a valid right-hand side was returned */
47  );
48 
49 /** returns the left-hand side of an arbitrary SCIP constraint that can be represented as a single linear constraint
50  *
51  * @note The success pointer indicates if the individual contraint handler was able to return the involved values
52  */
55  SCIP* scip, /**< SCIP data structure */
56  SCIP_CONS* cons, /**< constraint to get left hand side for */
57  SCIP_Bool* success /**< pointer to store whether a valid left-hand side was returned */
58  );
59 
60 /** returns the value array of an arbitrary SCIP constraint that can be represented as a single linear constraint
61  *
62  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
63  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
64  *
65  * @note The success pointer indicates if the individual contraint handler was able to return the involved values
66  */
69  SCIP* scip, /**< SCIP data structure */
70  SCIP_CONS* cons, /**< constraint for which the coefficients are wanted */
71  SCIP_Real* vals, /**< array to store the coefficients of the constraint */
72  int varssize, /**< available slots in vals array needed to check if the array is large enough */
73  SCIP_Bool* success /**< pointer to store whether the coefficients are successfully copied */
74  );
75 
76 /** returns the dual farkas solution of an arbitrary SCIP constraint that can be represented as a single linear constraint
77  *
78  * @note The success pointer indicates if the individual contraint handler was able to return the dual farkas solution
79  */
82  SCIP* scip, /**< SCIP data structure */
83  SCIP_CONS* cons, /**< constraint to get left hand side for */
84  SCIP_Real* dualfarkas, /**< pointer to store the dual farkas solution */
85  SCIP_Bool* success /**< pointer to store whether the dual farkas solution is successfully returned */
86  );
87 
88 /** returns the dual solution of an arbitrary SCIP constraint that can be represented as a single linear constraint
89  *
90  * @note The success pointer indicates if the individual contraint handler was able to return the dual solution
91  */
93  SCIP* scip, /**< SCIP data structure */
94  SCIP_CONS* cons, /**< constraint to get left hand side for */
95  SCIP_Real* dualsol, /**< pointer to store the dual solution */
96  SCIP_Bool* success /**< pointer to store whether the dual solution is successfully returned */
97  );
98 
99 /** returns the row of an arbitrary SCIP constraint that can be represented as a single linear constraint
100  * or NULL of no row is awailable
101  */
104  SCIP* scip, /**< SCIP data structure */
105  SCIP_CONS* cons /**< constraint to get left hand side for */
106  );
107 
108 /** adds the given variable to the input constraint.
109  * If the constraint is setppc or logicor the value is ignored. If the constraint is knapsack, then the value is
110  * converted to an int. A warning is passed if the SCIP_Real is not an integer.
111  * TODO: Allow val to be a pointer.
112  */
114  SCIP* scip, /**< SCIP data structure */
115  SCIP_CONS* cons, /**< constraint for which row is queried */
116  SCIP_VAR* var, /**< variable of the constraint entry */
117  SCIP_Real val /**< the coefficient of the constraint entry */
118  );
119 
120 #ifdef __cplusplus
121 }
122 #endif
123 
124 #endif
#define SCIP_EXPORT
Definition: def.h:100
SCIP_EXPORT SCIP_ROW * SCIPconsGetRow(SCIP *scip, SCIP_CONS *cons)
Definition: misc_linear.c:403
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
type definitions for return codes for SCIP methods
void SCIPconsGetDualsol(SCIP *scip, SCIP_CONS *cons, SCIP_Real *dualsol, SCIP_Bool *success)
Definition: misc_linear.c:348
type definitions for LP management
SCIP_RETCODE SCIPconsAddCoef(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real val)
Definition: misc_linear.c:451
type definitions for problem variables
SCIP_EXPORT void SCIPconsGetDualfarkas(SCIP *scip, SCIP_CONS *cons, SCIP_Real *dualfarkas, SCIP_Bool *success)
Definition: misc_linear.c:292
#define SCIP_Bool
Definition: def.h:70
SCIP_EXPORT SCIP_Real SCIPconsGetLhs(SCIP *scip, SCIP_CONS *cons, SCIP_Bool *success)
Definition: misc_linear.c:103
#define SCIP_Real
Definition: def.h:163
SCIP_EXPORT SCIP_Real SCIPconsGetRhs(SCIP *scip, SCIP_CONS *cons, SCIP_Bool *success)
Definition: misc_linear.c:39
common defines and data types used in all packages of SCIP
SCIP_EXPORT SCIP_RETCODE SCIPgetConsVals(SCIP *scip, SCIP_CONS *cons, SCIP_Real *vals, int varssize, SCIP_Bool *success)
Definition: misc_linear.c:170
type definitions for constraints and constraint handlers