Skip to content

Commit e4f37c2

Browse files
committed
Merge remote-tracking branch 'origin/v10-minor'
2 parents 7d445c4 + 85acc05 commit e4f37c2

File tree

3 files changed

+42
-23
lines changed

3 files changed

+42
-23
lines changed

src/scip/cons_logicor.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@ SCIP_RETCODE dualPresolving(
908908
}
909909

910910
/** deletes all zero-fixed variables, checks for variables fixed to one, replace all variables which are not active or
911-
* not a negation of an active variable by there active or negation of an active counterpart
911+
* not a negation of an active variable by their active or negation of an active counterpart
912912
*/
913913
static
914914
SCIP_RETCODE applyFixings(
@@ -981,7 +981,7 @@ SCIP_RETCODE applyFixings(
981981
/* get active or negation of active variables */
982982
SCIP_CALL( SCIPgetBinvarRepresentatives(scip, nvars, consdata->vars, vars, negarray) );
983983

984-
/* renew all variables, important that we do a backwards loop because deletion only affect rear items */
984+
/* renew all variables, important that we do a backwards loop because deletion only affects rear items */
985985
for( v = nvars - 1; v >= 0; --v )
986986
{
987987
var = vars[v];
@@ -1053,7 +1053,7 @@ SCIP_RETCODE applyFixings(
10531053
++(*nchgcoefs);
10541054
}
10551055
}
1056-
/* we need to degrade this logicor constraint to a linear constraint*/
1056+
/* we need to degrade this logicor constraint to a linear constraint */
10571057
else if( (ndelconss != NULL && naddconss != NULL) || SCIPconsIsAdded(cons) )
10581058
{
10591059
char name[SCIP_MAXSTRLEN];
@@ -1062,7 +1062,7 @@ SCIP_RETCODE applyFixings(
10621062
SCIP_Real rhs;
10631063
int k;
10641064

1065-
/* it might happen that there are more than one multi-aggregated variable, so we need to get the whole probvar sum over all variables */
1065+
/* it might happen that there is more than one multi-aggregated variable, so we need to get the whole probvar sum over all variables */
10661066

10671067
size = MAX(nconsvars, 1) + nvars - 1;
10681068

@@ -1084,7 +1084,7 @@ SCIP_RETCODE applyFixings(
10841084
/* get active variables for new constraint */
10851085
SCIP_CALL( SCIPgetProbvarLinearSum(scip, consvars, consvals, &nconsvars, size, &constant, &requiredsize) );
10861086

1087-
/* if space was not enough(we found another multi-aggregation), we need to resize the buffers */
1087+
/* if space was not enough (we found another multi-aggregation), we need to resize the buffers */
10881088
if( requiredsize > size )
10891089
{
10901090
SCIP_CALL( SCIPreallocBufferArray(scip, &consvars, requiredsize) );
@@ -1128,7 +1128,7 @@ SCIP_RETCODE applyFixings(
11281128

11291129
goto TERMINATE;
11301130
}
1131-
/* we need to degrade this logicor constraint to a linear constraint*/
1131+
/* we need to degrade this logicor constraint to a linear constraint */
11321132
else
11331133
{
11341134
if( var != consdata->vars[v] )

tests/src/sepa/convexproj.c

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,22 @@
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

4149
static SCIP* scip = NULL;
4250
static SCIP_SEPA* sepa = NULL;
43-
static SCIP_NLPI* nlpi = NULL;
51+
static SCIP_Bool haveipopt = FALSE;
4452
static SCIP_NLROW* nlrow1 = NULL;
4553
static SCIP_NLROW* nlrow2 = NULL;
4654
static 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 */

tests/src/sepa/gauge.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
#define EPS 1e-6
4949

5050
static SCIP* scip = NULL;
51-
static SCIP_NLPI* nlpi = NULL;
51+
static SCIP_Bool haveipopt = FALSE;
5252
static SCIP_NLROW* nlrow1 = NULL;
5353
static SCIP_NLROW* nlrow2 = NULL;
5454
static SCIP_NLROW* nlrow3 = NULL;
@@ -186,7 +186,8 @@ void evaluation_setup(void)
186186
if( ! SCIPisIpoptAvailableIpopt() )
187187
return;
188188

189-
SCIPincludeNlpSolverIpopt(scip);
189+
SCIP_CALL( SCIPincludeNlpSolverIpopt(scip) );
190+
haveipopt = TRUE;
190191

191192
/* create a problem */
192193
SCIP_CALL( SCIPcreateProbBasic(scip, "problem") );
@@ -251,7 +252,7 @@ void evaluate_gauge(CONVEXSIDE* convexsides)
251252
SCIP_NLROW* nlrows[2];
252253

253254
/* if no IPOPT available, don't run test */
254-
if( nlpi == NULL )
255+
if( !haveipopt )
255256
return;
256257

257258
/* create the nl rows */
@@ -363,7 +364,7 @@ Test(evaluation, gradient_cut_convex)
363364
SCIP_Bool success = FALSE;
364365

365366
/* if no IPOPT available, don't run test */
366-
if( nlpi == NULL )
367+
if( !haveipopt )
367368
return;
368369

369370
/* create the nl row */
@@ -400,7 +401,7 @@ Test(evaluation, gradient_cut_concave)
400401
SCIP_Bool success = FALSE;
401402

402403
/* if no IPOPT available, don't run test */
403-
if( nlpi == NULL )
404+
if( !haveipopt )
404405
return;
405406

406407
/* create the nl row */
@@ -437,7 +438,7 @@ Test(evaluation, gradient_complicated_convex)
437438
SCIP_Bool success = FALSE;
438439

439440
/* if no IPOPT available, don't run test */
440-
if( nlpi == NULL )
441+
if( !haveipopt )
441442
return;
442443

443444
/* create compicated nlrow */
@@ -474,7 +475,7 @@ Test(evaluation, gradient_complicated_concave)
474475
SCIP_Bool success = FALSE;
475476

476477
/* if no IPOPT available, don't run test */
477-
if( nlpi == NULL )
478+
if( !haveipopt )
478479
return;
479480

480481
/* create compicated nlrow */
@@ -526,7 +527,7 @@ Test(interior_point, compute_interior_point)
526527
return;
527528

528529
/* include NLPI's */
529-
SCIPincludeNlpSolverIpopt(scip);
530+
SCIP_CALL( SCIPincludeNlpSolverIpopt(scip) );
530531

531532
/* include gauge separator */
532533
SCIP_CALL( SCIPincludeSepaGauge(scip) );

0 commit comments

Comments
 (0)