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-2022 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 PUBLICCOREAPI
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  */
42 SCIP_EXPORT
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  */
53 SCIP_EXPORT
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  */
67 SCIP_EXPORT
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  */
80 SCIP_EXPORT
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  */
92 SCIP_EXPORT
94  SCIP* scip, /**< SCIP data structure */
95  SCIP_CONS* cons, /**< constraint to get left hand side for */
96  SCIP_Real* dualsol, /**< pointer to store the dual solution */
97  SCIP_Bool* success /**< pointer to store whether the dual solution is successfully returned */
98  );
99 
100 /** returns the row of an arbitrary SCIP constraint that can be represented as a single linear constraint
101  * or NULL of no row is awailable
102  */
103 SCIP_EXPORT
105  SCIP* scip, /**< SCIP data structure */
106  SCIP_CONS* cons /**< constraint to get left hand side for */
107  );
108 
109 /** adds the given variable to the input constraint.
110  * If the constraint is setppc or logicor the value is ignored. If the constraint is knapsack, then the value is
111  * converted to an int. A warning is passed if the SCIP_Real is not an integer.
112  * TODO: Allow val to be a pointer.
113  */
114 SCIP_EXPORT
116  SCIP* scip, /**< SCIP data structure */
117  SCIP_CONS* cons, /**< constraint for which row is queried */
118  SCIP_VAR* var, /**< variable of the constraint entry */
119  SCIP_Real val /**< the coefficient of the constraint entry */
120  );
121 
122 #ifdef __cplusplus
123 }
124 #endif
125 
126 #endif
SCIP_ROW * SCIPconsGetRow(SCIP *scip, SCIP_CONS *cons)
Definition: misc_linear.c:403
SCIP_Real SCIPconsGetRhs(SCIP *scip, SCIP_CONS *cons, SCIP_Bool *success)
Definition: misc_linear.c:39
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:447
type definitions for problem variables
void SCIPconsGetDualfarkas(SCIP *scip, SCIP_CONS *cons, SCIP_Real *dualfarkas, SCIP_Bool *success)
Definition: misc_linear.c:292
#define SCIP_Bool
Definition: def.h:84
SCIP_Real SCIPconsGetLhs(SCIP *scip, SCIP_CONS *cons, SCIP_Bool *success)
Definition: misc_linear.c:103
SCIP_RETCODE SCIPgetConsVals(SCIP *scip, SCIP_CONS *cons, SCIP_Real *vals, int varssize, SCIP_Bool *success)
Definition: misc_linear.c:170
#define SCIP_Real
Definition: def.h:177
common defines and data types used in all packages of SCIP
type definitions for constraints and constraint handlers