[Scip] Problem with using non linear constraint handler
Ahmad Moradi
ahmad.moradi at gmail.com
Tue Dec 11 14:29:08 MET 2012
the file in .cip format attached....
On Tue, Dec 11, 2012 at 1:45 PM, Ahmad Moradi <ahmad.moradi at gmail.com>wrote:
> Dear all,
>
> I have a network design problem with nonlinear objective function and
> linear constraints. Let x_e be some variable defined on edge e, then the
> objective function looks like \sum_e f(x_e) where f is a concave
> function. I added the objective function as a nonlinear constraint, 0 =< z
> - \sum_e f(x_e) <= +inf to SCIP through the following code in which I
> considered f = SQRT(x_e)
>
>
> ----------------------------------------------------------------------------------------------------
> SCIP_CONS* zcon;
> char zcon_name[255];
> SCIPsnprintf(zcon_name, 255, "z_constraint");
>
> SCIP_Real coef;
> coef = 1.0;
>
> SCIP_CALL( SCIPcreateConsNonlinear( scip, &zcon, zcon_name, 1, &z,
> &coef, 0, NULL, NULL, 0.0, SCIPinfinity(scip),
> TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE) );
> coef = -1.0;
>
> for ( int i = 0; i < g.num_edges; i++) {
> SCIP_EXPR* varexpr;
> SCIP_EXPR* expr;
> SCIP_EXPRTREE* exprtree;
> SCIP_CALL( SCIPexprCreate(SCIPblkmem(scip), &varexpr, SCIP_EXPR_VARIDX,
> 0) );
> (*) SCIP_CALL( SCIPexprCreate(SCIPblkmem(scip), &expr, SCIP_EXPR_SQRT,
> varexpr) );
> SCIP_CALL( SCIPexprtreeCreate(SCIPblkmem(scip), &exprtree, expr, 1, 0,
> NULL) );
> SCIP_CALL( SCIPexprtreeSetVars(exprtree, 1, &(g.fwd_arc_var[i]) ) );
> SCIP_CALL( SCIPaddExprtreesNonlinear(scip, zcon, 1, &exprtree , &coef) );
>
> SCIP_CALL( SCIPexprtreeFree(&exprtree) );
> }
>
> SCIP_CALL_EXC( SCIPaddCons(scip, zcon) );
>
> SCIP_CALL_EXC( SCIPreleaseCons(scip, &zcon) );
> ----------------------------------------------------------------------------------------------------------
>
> However, After running the code, SCIP's optimal solution violates the
> z_constraint and I could not figure out why? The same probles happend while
> using
>
> SCIP_CALL( SCIPexprCreate(SCIPblkmem(scip), &expr,
> SCIP_EXPR_REALPOWER, varexpr, 0.5) );
>
> instead of (*). Other than that I noticed, SCIP will write the
> z_constraint while using SCIPprintOrigProblem() and omit it while using
> SCIPprintTransProblem(). I am confusing whether the constraint is deleted
> by presolving or not?
>
> Bests,
> Ahmad
> PS: I have already attached the log file to this email and an instance of
> the problem in .cip format
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserv.zib.de/mailman/private/scip/attachments/20121211/4afbc880/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: prob.cip
Type: application/octet-stream
Size: 25706 bytes
Desc: not available
Url : http://listserv.zib.de/mailman/private/scip/attachments/20121211/4afbc880/prob.obj
More information about the Scip
mailing list