[Scip] Nonlinear Constraint

Stefan Vigerske stefan at math.hu-berlin.de
Mon Jan 30 11:55:00 MET 2012


Hi,

> Hallo, thanky alot for your last response, it helped me a lot :)
>
> Nevertheless, I am still getting the same error messages (dbg mode didn't give any further information there):
>
> [src/scip/cons_nonlinear.c:3508] ERROR: Error<-11>  in function call
> [src/scip/cons_nonlinear.c:7193] ERROR: Error<-11>  in function call
> [src/scip/cons.c:5820] ERROR: Error<-11>  in function call
> [src/scip/scip.c:6083] ERROR: Error<-11>  in function call
> [src/scip/scip.c:20023] ERROR: Error<-11>  in function call
> [src/scip/heur_trivial.c:168] ERROR: Error<-11>  in function call
> [src/scip/heur.c:398] ERROR: Error<-11>  in function call
> [src/scip/solve.c:241] ERROR: Error<-11>  in function call
> [src/scip/scip.c:6856] ERROR: Error<-11>  in function call
> [src/scip/scip.c:7336] ERROR: Error<-11>  in function call
> [src/scip/scip.c:7521] ERROR: Error<-11>  in function call

That error means, that SCIP has been compiled without an "expression 
interpreter", i.e., a code that SCIP uses to compute derivatives of 
nonlinear expressions. (I agree that there should be a clearer error 
message)
The only expression interpreter supported by SCIP so far is CppAD (but 
not the 20120101 versions yet), which you can add by
1. changing to the scip/lib directory
2. svn co
     https://projects.coin-or.org/svn/CppAD/releases/20110101.5/cppad
3. compiling SCIP with "make EXPRINT=cppad"

If you have continuous variables in your nonlinear terms, then you may 
also want to compile with IPOPT.
See also Example 3 in SCIP's INSTALL file.


> I tried to incorporate your proposals and ended up with the following code (I did not use the SCIPcreateConsQuadratic
> since I want to add further parts to the constraint later):
>
>
> SCIP* _scip(0);
> SCIPcreate(&_scip);
> SCIPincludeDefaultPlugins(_scip);
>
> SCIPcreateProb(_scip, "MyProject", NULL, NULL, NULL, NULL, NULL, NULL, NULL);
> SCIPsetObjsense(_scip, SCIP_OBJSENSE_MINIMIZE);
>
> SCIP_VAR* vars_[2];
> SCIPcreateVar(_scip,&vars_[0], "myn1", 0.0, SCIPinfinity(_scip), 1.0, SCIP_VARTYPE_CONTINUOUS, TRUE, FALSE, NULL, NULL, NULL, NULL, NULL);
> SCIPcreateVar(_scip,&vars_[1], "myn2", 0.0, SCIPinfinity(_scip), 1.0, SCIP_VARTYPE_CONTINUOUS, TRUE, FALSE, NULL, NULL, NULL, NULL, NULL);
> SCIPaddVar(_scip, vars_[0]);
> SCIPaddVar(_scip, vars_[1]);
>
> BMS_BLKMEM* blkmem = SCIPblkmem(_scip);
> SCIP_EXPR* root;
> SCIP_EXPR* child[2];
> SCIPexprCreate(blkmem,&child[0], SCIP_EXPR_VARIDX, 0);
> SCIPexprCreate(blkmem,&child[1], SCIP_EXPR_VARIDX, 1);
> SCIPexprCreate(blkmem,&root, SCIP_EXPR_MUL, child[0], child[1]);
>
> SCIP_EXPRTREE* tree;
> SCIPexprtreeCreate(blkmem,&tree, root, 0, 0, NULL);
> SCIPexprtreeAddVars(tree, 2,vars_ );
>
> SCIP_CONS* nl_cons;
> SCIPcreateConsNonlinear(_scip,&nl_cons, "nl_test", 0, NULL, NULL, 1,&tree, NULL, -SCIPinfinity(_scip), 1, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE);
> SCIPaddCons(_scip, nl_cons);
>
> SCIPsolve(_scip);
>
> Can you help me there? Thank you in advance :)

Looks ok.
You may want to add SCIP_CALL macros around the calls of SCIP functions.
Also add a SCIPexprtreeFree(&tree) after SCIPcreateConsNonlinear.

Stefan

>
> _______________________________________________
> Scip mailing list
> Scip at zib.de
> http://listserv.zib.de/mailman/listinfo/scip
>



More information about the Scip mailing list