1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /*                                                                           */
3 /*                  This file is part of the program and library             */
4 /*         SCIP --- Solving Constraint Integer Programs                      */
5 /*                                                                           */
6 /*    Copyright (C) 2002-2021 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   scip_expr.h
17  * @ingroup PUBLICCOREAPI
18  * @brief  public methods for expression handlers
19  * @author Tobias Achterberg
20  * @author Timo Berthold
21  * @author Thorsten Koch
22  * @author Alexander Martin
23  * @author Marc Pfetsch
24  * @author Kati Wolter
25  * @author Gregor Hendel
26  * @author Leona Gottwald
27  */
28 
29 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
30 
31 #ifndef __SCIP_SCIP_EXPR_H__
32 #define __SCIP_SCIP_EXPR_H__
33 
34 
35 #include "nlpi/type_expr.h"
36 #include "scip/def.h"
37 #include "scip/type_retcode.h"
38 #include "scip/type_scip.h"
39 #include "scip/type_sol.h"
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 /**@addtogroup PublicExpressionTreeMethods
46  *
47  * @{
48  */
49 
50 /** replaces array of variables in expression tree by corresponding transformed variables
51  *
52  *  @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
53  *          SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
54  *
55  *  @pre This method can be called if @p scip is in one of the following stages:
56  *       - \ref SCIP_STAGE_TRANSFORMING
57  *       - \ref SCIP_STAGE_TRANSFORMED
58  *       - \ref SCIP_STAGE_INITPRESOLVE
59  *       - \ref SCIP_STAGE_PRESOLVING
60  *       - \ref SCIP_STAGE_EXITPRESOLVE
61  *       - \ref SCIP_STAGE_PRESOLVED
62  *       - \ref SCIP_STAGE_INITSOLVE
63  *       - \ref SCIP_STAGE_SOLVING
64  *       - \ref SCIP_STAGE_SOLVED
65  *       - \ref SCIP_STAGE_EXITSOLVE
66  *       - \ref SCIP_STAGE_FREETRANS
67  *
68  *  See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
69  */
70 SCIP_EXPORT
71 SCIP_RETCODE SCIPgetExprtreeTransformedVars(
72    SCIP*                 scip,               /**< SCIP data structure */
73    SCIP_EXPRTREE*        tree                /**< expression tree */
74    );
75 
76 /** evaluates an expression tree for a primal solution or LP solution
77  *
78  *  @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
79  *          SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
80  *
81  *  @pre This method can be called if @p scip is in one of the following stages:
82  *       - \ref SCIP_STAGE_PROBLEM
83  *       - \ref SCIP_STAGE_TRANSFORMING
84  *       - \ref SCIP_STAGE_TRANSFORMED
85  *       - \ref SCIP_STAGE_INITPRESOLVE
86  *       - \ref SCIP_STAGE_PRESOLVING
87  *       - \ref SCIP_STAGE_EXITPRESOLVE
88  *       - \ref SCIP_STAGE_PRESOLVED
89  *       - \ref SCIP_STAGE_INITSOLVE
90  *       - \ref SCIP_STAGE_SOLVING
91  *       - \ref SCIP_STAGE_SOLVED
92  *       - \ref SCIP_STAGE_EXITSOLVE
93  *       - \ref SCIP_STAGE_FREETRANS
94  *
95  *  See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
96  */
97 SCIP_EXPORT
98 SCIP_RETCODE SCIPevalExprtreeSol(
99    SCIP*                 scip,               /**< SCIP data structure */
100    SCIP_EXPRTREE*        tree,               /**< expression tree */
101    SCIP_SOL*             sol,                /**< a solution, or NULL for current LP solution */
102    SCIP_Real*            val                 /**< buffer to store value */
103    );
104 
105 /** evaluates an expression tree w.r.t. current global bounds
106  *
107  *  @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
108  *          SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
109  *
110  *  @pre This method can be called if @p scip is in one of the following stages:
111  *       - \ref SCIP_STAGE_PROBLEM
112  *       - \ref SCIP_STAGE_TRANSFORMING
113  *       - \ref SCIP_STAGE_TRANSFORMED
114  *       - \ref SCIP_STAGE_INITPRESOLVE
115  *       - \ref SCIP_STAGE_PRESOLVING
116  *       - \ref SCIP_STAGE_EXITPRESOLVE
117  *       - \ref SCIP_STAGE_PRESOLVED
118  *       - \ref SCIP_STAGE_INITSOLVE
119  *       - \ref SCIP_STAGE_SOLVING
120  *       - \ref SCIP_STAGE_SOLVED
121  *       - \ref SCIP_STAGE_EXITSOLVE
122  *       - \ref SCIP_STAGE_FREETRANS
123  *
124  *  See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
125  */
126 SCIP_EXPORT
127 SCIP_RETCODE SCIPevalExprtreeGlobalBounds(
128    SCIP*                 scip,               /**< SCIP data structure */
129    SCIP_EXPRTREE*        tree,               /**< expression tree */
130    SCIP_Real             infinity,           /**< value to use for infinity */
131    SCIP_INTERVAL*        val                 /**< buffer to store result */
132    );
133 
134 /** evaluates an expression tree w.r.t. current local bounds
135  *
136  *  @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
137  *          SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
138  *
139  *  @pre This method can be called if @p scip is in one of the following stages:
140  *       - \ref SCIP_STAGE_PROBLEM
141  *       - \ref SCIP_STAGE_TRANSFORMING
142  *       - \ref SCIP_STAGE_TRANSFORMED
143  *       - \ref SCIP_STAGE_INITPRESOLVE
144  *       - \ref SCIP_STAGE_PRESOLVING
145  *       - \ref SCIP_STAGE_EXITPRESOLVE
146  *       - \ref SCIP_STAGE_PRESOLVED
147  *       - \ref SCIP_STAGE_INITSOLVE
148  *       - \ref SCIP_STAGE_SOLVING
149  *       - \ref SCIP_STAGE_SOLVED
150  *       - \ref SCIP_STAGE_EXITSOLVE
151  *       - \ref SCIP_STAGE_FREETRANS
152  *
153  *  See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
154  */
155 SCIP_EXPORT
156 SCIP_RETCODE SCIPevalExprtreeLocalBounds(
157    SCIP*                 scip,               /**< SCIP data structure */
158    SCIP_EXPRTREE*        tree,               /**< expression tree */
159    SCIP_Real             infinity,           /**< value to use for infinity */
160    SCIP_INTERVAL*        val                 /**< buffer to store result */
161    );
162 
163 /**@} */
164 
165 #ifdef __cplusplus
166 }
167 #endif
168 
169 #endif
170