3333#include "scip/nlpi_ipopt.h"
3434
3535#include "scip/sepa_convexproj.c"
36+ #include "scip/expr_varidx.h"
37+ #include "scip/expr_exp.h"
38+ #include "scip/expr_log.h"
39+ #include "scip/expr_pow.h"
40+ #include "scip/expr_product.h"
41+ #include "scip/expr_sum.h"
42+ #include "scip/expr_var.h"
43+ #include "scip/expr_value.h"
3644
3745#include "include/scip_test.h"
3846
3947#define EPS 1e-5
4048
4149static SCIP * scip = NULL ;
4250static SCIP_SEPA * sepa = NULL ;
43- static SCIP_NLPI * nlpi = NULL ;
51+ static SCIP_Bool haveipopt = FALSE ;
4452static SCIP_NLROW * nlrow1 = NULL ;
4553static SCIP_NLROW * nlrow2 = NULL ;
4654static SCIP_NLROW * nlrow3 = NULL ;
@@ -74,15 +82,15 @@ void createNlRow1(CONVEXSIDE convexside)
7482 /* decide curvature */
7583 if ( convexside == RHS )
7684 {
77- SCIP_CALL ( SCIPparseExpr (scip , & expr , (char * )"log(exp(<x >) + exp(<y>))" , NULL , NULL , NULL ) );
85+ SCIP_CALL ( SCIPparseExpr (scip , & expr , (char * )"log(exp(<t_x >) + exp(<y>))" , NULL , NULL , NULL ) );
7886
7987 curvature = SCIP_EXPRCURV_CONVEX ;
8088 lhs = - SCIPinfinity (scip );
8189 rhs = 1.0 ;
8290 }
8391 else
8492 {
85- SCIP_CALL ( SCIPparseExpr (scip , & expr , (char * )"-(log(exp(<x >) + exp(<y>)))" , NULL , NULL , NULL ) );
93+ SCIP_CALL ( SCIPparseExpr (scip , & expr , (char * )"-(log(exp(<t_x >) + exp(<y>)))" , NULL , NULL , NULL ) );
8694
8795 curvature = SCIP_EXPRCURV_CONCAVE ;
8896 lhs = -1.0 ;
@@ -108,15 +116,15 @@ void createNlRow2(CONVEXSIDE convexside)
108116 /* decide curvature */
109117 if ( convexside == RHS )
110118 {
111- SCIP_CALL ( SCIPparseExpr (scip , & expr , (char * )"<x >^2 - <y>" , NULL , NULL , NULL ) );
119+ SCIP_CALL ( SCIPparseExpr (scip , & expr , (char * )"<t_x >^2 - <y>" , NULL , NULL , NULL ) );
112120
113121 curvature = SCIP_EXPRCURV_CONVEX ;
114122 lhs = - SCIPinfinity (scip );
115123 rhs = 0.0 ;
116124 }
117125 else
118126 {
119- SCIP_CALL ( SCIPparseExpr (scip , & expr , (char * )"<y> - <x >^2" , NULL , NULL , NULL ) );
127+ SCIP_CALL ( SCIPparseExpr (scip , & expr , (char * )"<y> - <t_x >^2" , NULL , NULL , NULL ) );
120128
121129 curvature = SCIP_EXPRCURV_CONCAVE ;
122130 lhs = 0.0 ;
@@ -142,15 +150,15 @@ void createNlRow3(CONVEXSIDE convexside)
142150 /* decide curvature */
143151 if ( convexside == RHS )
144152 {
145- SCIP_CALL ( SCIPparseExpr (scip , & expr , (char * )"1.1*<x >+2.4*<x >^2 + 0.01*<x >*<y> + 0.3*<y>^2 + 0.2*log(0.5*exp(0.12*<x >+0.1)+2*exp(0.1*<y>)+0.7)" , NULL , NULL , NULL ) );
153+ SCIP_CALL ( SCIPparseExpr (scip , & expr , (char * )"1.1*<t_x >+2.4*<t_x >^2 + 0.01*<t_x >*<y> + 0.3*<y>^2 + 0.2*log(0.5*exp(0.12*<t_x >+0.1)+2*exp(0.1*<y>)+0.7)" , NULL , NULL , NULL ) );
146154
147155 curvature = SCIP_EXPRCURV_CONVEX ;
148156 lhs = - SCIPinfinity (scip );
149157 rhs = 0.5 ;
150158 }
151159 else
152160 {
153- SCIP_CALL ( SCIPparseExpr (scip , & expr , (char * )"-(1.1*<x >+2.4*<x >^2 + 0.01*<x >*<y> + 0.3*<y>^2 + 0.2*log(0.5*exp(0.12*<x >+0.1)+2*exp(0.1*<y>)+0.7))" , NULL , NULL , NULL ) );
161+ SCIP_CALL ( SCIPparseExpr (scip , & expr , (char * )"-(1.1*<t_x >+2.4*<t_x >^2 + 0.01*<t_x >*<y> + 0.3*<y>^2 + 0.2*log(0.5*exp(0.12*<t_x >+0.1)+2*exp(0.1*<y>)+0.7))" , NULL , NULL , NULL ) );
154162
155163 curvature = SCIP_EXPRCURV_CONCAVE ;
156164 lhs = -0.5 ;
@@ -205,13 +213,23 @@ void test_setup(void)
205213
206214 SCIP_CALL ( SCIPcreate (& scip ) );
207215
216+ /* include some expr handlers */
217+ SCIP_CALL ( SCIPincludeExprhdlrExp (scip ) );
218+ SCIP_CALL ( SCIPincludeExprhdlrLog (scip ) );
219+ SCIP_CALL ( SCIPincludeExprhdlrVar (scip ) );
220+ SCIP_CALL ( SCIPincludeExprhdlrVaridx (scip ) );
221+ SCIP_CALL ( SCIPincludeExprhdlrValue (scip ) );
222+ SCIP_CALL ( SCIPincludeExprhdlrSum (scip ) );
223+ SCIP_CALL ( SCIPincludeExprhdlrPow (scip ) );
224+ SCIP_CALL ( SCIPincludeExprhdlrProduct (scip ) );
225+
208226 /* if no IPOPT available, don't run test */
209227 if ( ! SCIPisIpoptAvailableIpopt () )
210228 return ;
211229
212230 /* include NLPI's */
213231 SCIP_CALL ( SCIPincludeNlpSolverIpopt (scip ) );
214-
232+ haveipopt = TRUE;
215233
216234 /* include convexproj separator and get it */
217235 SCIP_CALL ( SCIPincludeSepaConvexproj (scip ) );
@@ -269,7 +287,7 @@ void project(SCIP_Bool* isrhsconvex)
269287
270288 test_setup ();
271289 /* if no IPOPT available, don't run test */
272- if ( nlpi == NULL )
290+ if ( ! haveipopt )
273291 return ;
274292
275293 /* create the nl rows */
0 commit comments