[Scip] Nonlinear Constraint

Martin Tieves Martin.Tieves at rwth-aachen.de
Fri Jan 27 16:11:54 MET 2012


Hallo

I am currently trying so run / solve my first nonlinear problems with scip. Sadly, I am not totally understanding how I can add nonlinear constraints. For example, I want to create a "simple" constraint as x*y <= 1.

Am I right, that in general, these constraints are build up from an amount of (linear) variables / coefficients and an additional expression tree for the nonlinear part of the constraint? I did the following but it did not work :/

(scip pointer already decleared)

// get memory
BMS_BLKMEM* blkmem = SCIPblkmem(_scip);

SCIP_EXPRTREE* tree;
SCIP_EXPR* root;
SCIP_Real* params = NULL;

// create root expression
SCIPexprCreate(blkmem, &root, SCIP_EXPR_MUL);

//set childs for multiply / rood node        
SCIP_EXPR ** child = new SCIP_EXPR*[SCIPexprGetNChildren(root)];
child = SCIPexprGetChildren(root);
SCIPexprCreate(blkmem, &child[0], SCIP_EXPR_VARIDX, 0);
SCIPexprCreate(blkmem, &child[1], SCIP_EXPR_VARIDX, 1);

//create a tree of this expression
SCIPexprtreeCreate(blkmem, &tree, root, 0, 0, params);

// give the variables to the tree - vars_ have already been decleared as usual
SCIPexprtreeAddVars(tree, 2,vars_ );

SCIP_EXPRTREE** tree_cont = new SCIP_EXPRTREE*[1];
tree_cont[0] =  tree;
SCIP_CONS* nl_cons;
std::string name = "nl_test";
SCIPcreateConsNonlinear(_scip, &nl_cons, name.c_str(), 0, NULL, NULL, 1,tree_cont,
      NULL, -SCIPinfinity(_scip), 1, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE);
SCIPaddCons(_scip, nl_cons);

At start I included the ConshdlrNonlinear and the NodeselBfs. When I try to solve the model, I get the message:
(solver started, presolving is done)
[src/scip/cons_nonlinear.c:2022] Warning: indefinite expression tree in constraint <nltester>
[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:3019] ERROR: Error <-11> in function call
[src/scip/sol.c:1207] ERROR: Error <-11> in function call
[src/scip/primal.c:1147] ERROR: Error <-11> in function call
[src/scip/solve.c:2439] ERROR: Error <-11> in function call
[src/scip/solve.c:3062] ERROR: Error <-11> in function call
[src/scip/solve.c:3297] ERROR: Error <-11> in function call
[src/scip/solve.c:3879] ERROR: Error <-11> in function call
[src/scip/scip.c:7543] ERROR: Error <-11> in function call

What did I do wrong?

Best regards
Martin



More information about the Scip mailing list