Scippy

SCIP

Solving Constraint Integer Programs

exprinterpret_none.c
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-2014 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 email to scip@zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file exprinterpret_none.c
17  * @brief function definitions for nonexisting expression interpreter to resolve linking references
18  * @ingroup EXPRINTS
19  * @author Stefan Vigerske
20  */
21 
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23 
24 #include "scip/pub_message.h"
25 #include "nlpi/exprinterpret.h"
26 
27 struct SCIP_ExprInt
28 {
29  char dummy; /*lint !e830*/
30 };
31 
32 /** gets name and version of expression interpreter */
33 const char* SCIPexprintGetName(
34  void
35  )
36 {
37  return "NONE";
38 } /*lint !e715*/
39 
40 /** gets descriptive text of expression interpreter */
41 const char* SCIPexprintGetDesc(
42  void
43  )
44 {
45  return "dummy expression interpreter which solely purpose it is to resolve linking symbols";
46 } /*lint !e715*/
47 
48 /** gets capabilities of expression interpreter (using bitflags) */
50  void
51  )
52 {
54 } /*lint !e715*/
55 
56 /** creates an expression interpreter object */
58  BMS_BLKMEM* blkmem, /**< block memory data structure */
59  SCIP_EXPRINT** exprint /**< buffer to store pointer to expression interpreter */
60  )
61 {
62  SCIPdebugMessage("SCIPexprintCreate()\n");
63  SCIPdebugMessage("Note that there is no expression interpreter linked to the binary.\n");
64 
65  SCIP_ALLOC( BMSallocMemory(exprint) );
66 
67  return SCIP_OKAY;
68 } /*lint !e715*/
69 
70 /** frees an expression interpreter object */
72  SCIP_EXPRINT** exprint /**< expression interpreter that should be freed */
73  )
74 {
75  BMSfreeMemory(exprint);
76 
77  return SCIP_OKAY;
78 } /*lint !e715*/
79 
80 /** compiles an expression tree and stores compiled data in expression tree */
82  SCIP_EXPRINT* exprint, /**< interpreter data structure */
83  SCIP_EXPRTREE* tree /**< expression tree */
84  )
85 {
86  return SCIP_OKAY;
87 } /*lint !e715*/
88 
89 /** frees interpreter data */
91  SCIP_EXPRINTDATA** interpreterdata /**< interpreter data that should freed */
92  )
93 {
94  assert(interpreterdata != NULL);
95  assert(*interpreterdata == NULL);
96 
97  return SCIP_OKAY;
98 } /*lint !e715*/
99 
100 /** notify expression interpreter that a new parameterization is used
101  * this probably causes retaping by AD algorithms
102  */
104  SCIP_EXPRINT* exprint, /**< interpreter data structure */
105  SCIP_EXPRTREE* tree /**< expression tree */
106  )
107 {
108  return SCIP_OKAY;
109 } /*lint !e715*/
110 
111 /** evaluates an expression tree */
113  SCIP_EXPRINT* exprint, /**< interpreter data structure */
114  SCIP_EXPRTREE* tree, /**< expression tree */
115  SCIP_Real* varvals, /**< values of variables */
116  SCIP_Real* val /**< buffer to store value */
117  )
118 {
119  SCIPerrorMessage("No expression interpreter linked to SCIP, try recompiling with EXPRINT=cppad.\n");
120  return SCIP_PLUGINNOTFOUND;
121 } /*lint !e715*/
122 
123 /** evaluates an expression tree on intervals */
125  SCIP_EXPRINT* exprint, /**< interpreter data structure */
126  SCIP_EXPRTREE* tree, /**< expression tree */
127  SCIP_Real infinity, /**< value for infinity */
128  SCIP_INTERVAL* varvals, /**< interval values of variables */
129  SCIP_INTERVAL* val /**< buffer to store interval value of expression */
130  )
131 {
132  SCIPerrorMessage("No expression interpreter linked to SCIP, try recompiling with EXPRINT=cppad.\n");
133  return SCIP_PLUGINNOTFOUND;
134 } /*lint !e715*/
135 
136 /** computes value and gradient of an expression tree */
138  SCIP_EXPRINT* exprint, /**< interpreter data structure */
139  SCIP_EXPRTREE* tree, /**< expression tree */
140  SCIP_Real* varvals, /**< values of variables, can be NULL if new_varvals is FALSE */
141  SCIP_Bool new_varvals, /**< have variable values changed since last call to a point evaluation routine? */
142  SCIP_Real* val, /**< buffer to store expression value */
143  SCIP_Real* gradient /**< buffer to store expression gradient, need to have length at least SCIPexprtreeGetNVars(tree) */
144  )
145 {
146  SCIPerrorMessage("No expression interpreter linked to SCIP, try recompiling with EXPRINT=cppad.\n");
147  return SCIP_PLUGINNOTFOUND;
148 } /*lint !e715*/
149 
150 /** computes interval value and interval gradient of an expression tree */
152  SCIP_EXPRINT* exprint, /**< interpreter data structure */
153  SCIP_EXPRTREE* tree, /**< expression tree */
154  SCIP_Real infinity, /**< value for infinity */
155  SCIP_INTERVAL* varvals, /**< interval values of variables, can be NULL if new_varvals is FALSE */
156  SCIP_Bool new_varvals, /**< have variable interval values changed since last call to an interval evaluation routine? */
157  SCIP_INTERVAL* val, /**< buffer to store expression interval value */
158  SCIP_INTERVAL* gradient /**< buffer to store expression interval gradient, need to have length at least SCIPexprtreeGetNVars(tree) */
159  )
160 {
161  SCIPerrorMessage("No expression interpreter linked to SCIP, try recompiling with EXPRINT=cppad.\n");
162  return SCIP_PLUGINNOTFOUND;
163 } /*lint !e715*/
164 
165 /** gives sparsity pattern of hessian
166  * NOTE: this function might be replaced later by something nicer
167  * Since the AD code might need to do a forward sweep, you should pass variable values in here.
168  */
170  SCIP_EXPRINT* exprint, /**< interpreter data structure */
171  SCIP_EXPRTREE* tree, /**< expression tree */
172  SCIP_Real* varvals, /**< values of variables */
173  SCIP_Bool* sparsity /**< buffer to store sparsity pattern of Hessian, sparsity[i+n*j] indicates whether entry (i,j) is nonzero in the hessian */
174  )
175 {
176  SCIPerrorMessage("No expression interpreter linked to SCIP, try recompiling with EXPRINT=cppad.\n");
177  return SCIP_PLUGINNOTFOUND;
178 } /*lint !e715*/
179 
180 /** computes value and dense hessian of an expression tree
181  * the full hessian is computed (lower left and upper right triangle)
182  */
184  SCIP_EXPRINT* exprint, /**< interpreter data structure */
185  SCIP_EXPRTREE* tree, /**< expression tree */
186  SCIP_Real* varvals, /**< values of variables, can be NULL if new_varvals is FALSE */
187  SCIP_Bool new_varvals, /**< have variable values changed since last call to an evaluation routine? */
188  SCIP_Real* val, /**< buffer to store function value */
189  SCIP_Real* hessian /**< buffer to store hessian values, need to have size at least n*n */
190  )
191 {
192  SCIPerrorMessage("No expression interpreter linked to SCIP, try recompiling with EXPRINT=cppad.\n");
193  return SCIP_PLUGINNOTFOUND;
194 } /*lint !e715*/
const char * SCIPexprintGetName(void)
methods to interpret (evaluate) an expression tree "fast"
#define NULL
Definition: lpi_spx.cpp:129
SCIP_RETCODE SCIPexprintHessianDense(SCIP_EXPRINT *exprint, SCIP_EXPRTREE *tree, SCIP_Real *varvals, SCIP_Bool new_varvals, SCIP_Real *val, SCIP_Real *hessian)
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
#define SCIPdebugMessage
Definition: pub_message.h:77
unsigned int SCIP_EXPRINTCAPABILITY
SCIP_RETCODE SCIPexprintCreate(BMS_BLKMEM *blkmem, SCIP_EXPRINT **exprint)
SCIP_RETCODE SCIPexprintFreeData(SCIP_EXPRINTDATA **interpreterdata)
SCIP_RETCODE SCIPexprintNewParametrization(SCIP_EXPRINT *exprint, SCIP_EXPRTREE *tree)
#define SCIPerrorMessage
Definition: pub_message.h:45
SCIP_RETCODE SCIPexprintEval(SCIP_EXPRINT *exprint, SCIP_EXPRTREE *tree, SCIP_Real *varvals, SCIP_Real *val)
SCIP_RETCODE SCIPexprintHessianSparsityDense(SCIP_EXPRINT *exprint, SCIP_EXPRTREE *tree, SCIP_Real *varvals, SCIP_Bool *sparsity)
SCIP_RETCODE SCIPexprintCompile(SCIP_EXPRINT *exprint, SCIP_EXPRTREE *tree)
const char * SCIPexprintGetDesc(void)
struct SCIP_ExprTree SCIP_EXPRTREE
Definition: type_expr.h:91
#define SCIP_Bool
Definition: def.h:49
struct SCIP_ExprInt SCIP_EXPRINT
#define SCIP_EXPRINTCAPABILITY_NONE
SCIP_EXPRINTCAPABILITY SCIPexprintGetCapability(void)
SCIP_RETCODE SCIPexprintGradInt(SCIP_EXPRINT *exprint, SCIP_EXPRTREE *tree, SCIP_Real infinity, SCIP_INTERVAL *varvals, SCIP_Bool new_varvals, SCIP_INTERVAL *val, SCIP_INTERVAL *gradient)
public methods for message output
#define SCIP_Real
Definition: def.h:123
SCIP_RETCODE SCIPexprintFree(SCIP_EXPRINT **exprint)
SCIP_RETCODE SCIPexprintGrad(SCIP_EXPRINT *exprint, SCIP_EXPRTREE *tree, SCIP_Real *varvals, SCIP_Bool new_varvals, SCIP_Real *val, SCIP_Real *gradient)
#define SCIP_ALLOC(x)
Definition: def.h:269
struct SCIP_ExprIntData SCIP_EXPRINTDATA
SCIP_RETCODE SCIPexprintEvalInt(SCIP_EXPRINT *exprint, SCIP_EXPRTREE *tree, SCIP_Real infinity, SCIP_INTERVAL *varvals, SCIP_INTERVAL *val)