[SCIP] Issue with Linear Constraint Not Being Added in SCIP Pricing Problem
Kamp, Dominik
Dominik.Kamp at uni-bayreuth.de
Thu Jan 30 01:18:45 CET 2025
Hello Mahdi,
the linear constraint seems to be there, only the variable contributions are missing. At first I recommend to enclose the creation call by SCIP_CALL(). Knapsack constraints only allow positive weights but linear constraints should allow knapsack constraints, so if nothing but the function name changed, something is wrong.
Please check whether nvars, vars, and vals are as expected. If this is the case, it would be nice to have an issue with reproducible details. Feel free to file one at https://scipopt.org/bugs.php or https://github.com/scipopt/scip/issues/new?template=bug_report.md.
Best regards,
Dominik
> On 29. Jan 2025, at 16:31, Mahdi Mohammadi <mo.mahdi1379 at gmail.com> wrote:
>
> Hello,
> I've been stuck on an issue and encountered the following error:
> [solve.c:4676] ERROR: pricing was aborted, but no branching could be created!
>
> To investigate, I exported the pricing model using the following code:
> SCIP_CALL( SCIPsolve(subscip) );
> SCIPwriteOrigProblem(subscip, filename, NULL, TRUE);
>
> I adapted the BinPacking example for my problem. However, in my pricing problem, I replaced the knapsack constraint with a linear constraint. Specifically, I commented out the knapsack constraint and added mine like what follows:
> /* Create capacity constraint */
> SCIPcreateConsBasicLinear(subscip, &cons, "edgesum", nvars, vars, vals, capacity, capacity);
> // SCIPcreateConsBasicKnapsack(subscip, &cons, "edgesum", nvars, vars, vals, capacity);
> SCIP_CALL( SCIPaddCons(subscip, cons) );
> SCIP_CALL( SCIPreleaseCons(subscip, &cons) );
>
> When I checked the output, the linear constraint did not appear in the exported problem:
> \ SCIP STATISTICS
> \ Problem name : pricing
> \ Variables : 15 (15 binary, 0 integer, 0 implicit integer, 0 continuous)
> \ Constraints : 7
> Maximize
> Obj: +1 x4
> Subject to
> c0: = +3
> \ [linking] <c1>: <x10> = +0.5<x0> +0.5<x1> +0.5<x2> +0.5<x3>;
> ...
>
> However, when I used the knapsack constraint instead, the problem was correctly formulated:
> \ SCIP STATISTICS
> \ Problem name : pricing
> \ Variables : 15 (15 binary, 0 integer, 0 implicit integer, 0 continuous)
> \ Constraints : 7
> Maximize
> Obj: +1 x4
> Subject to
> c0: +1 x0 +1 x1 +1 x2 +1 x3 +1 x4 +1 x5 +1 x6 +1 x7 +1 x8 +1 x9 <= +3
> \ [linking] <c1>: <x10> = +0.5<x0> +0.5<x1> +0.5<x2> +0.5<x3>;
> ...
>
> Is this a bug in SCIP?
> PS:
> I also tried using SCIPcreateConsLinear, but the result was the same. Additionally, I attempted to circumvent the issue by adding another knapsack constraint with a negated version of the original equation so that force what I wanted:
> -1 x0 -1 x1 -1 x2 -1 x3 -1 x4 -1 x5 -1 x6 -1 x7 -1 x8 -1 x9 <= -3
>
> However, this constraint was also not added to the pricing problem.
> Best regards,
> Mahdi Mohammadi
> _______________________________________________
> Scip mailing list
> Scip at zib.de
> https://listserv.zib.de/mailman/listinfo/scip
More information about the Scip
mailing list