[Scip] SCIPgetTransformedCons

Tue Christensen TUEC at asb.dk
Wed May 16 08:27:41 MEST 2012


Yiakes!

It is by no means obvious to me where the bug is... When doing the debug mode I would expect an assertion to fail when trying to do printCons, stating that the pointer should not be NULL. Just to be perfectly clear, you are getting the segmentation fault in the line SCIPprintCons(scip, pricerdata->budCon, NULL); ?

There might be another assertion failing long before that, though.

>From the top of my head possible errors are:

1) The pointer is not stored properly in the pricer (which is a bit strange, since the other constraints are, but it calls for a double check!).
2) The problem is either in the stage INIT or PROBLEM, which will make SCIP return the NULL pointer in SCIPgetTransformedCons()
3) The constraint is for some reason not created in the transformed problem.

I know this is not much to go on, sorry!

Cheers,

Tue

HI Tue,

Thanks for the response. There is no problem with the names, for some reason I called the pointer to the constraint budCon instead of budCons in that function and I forgot to replace it. I'll try to compile it in debug mode to see what happens. I know that the pointer is actually pointing to the correct constraint. I am using the following code to verify it:

    SCIPprintCons(scip, cons, NULL);


    /* get transformed constraint */
    SCIP_CALL( SCIPgetTransformedCons(scip, cons, &pricerdata->budCon) );


    SCIPprintCons(scip, cons, NULL);


    SCIPprintCons(scip, pricerdata->budCon, NULL);

I'm getting the segmentation problem in the 4th line.

Regards,

Jose.



On May 15, 2012, at 2:35 AM, Tue Christensen wrote:


Hi Jose!

I am by no means a SCIP expert, so here are just a few random thoughts.

At a first glance I cannot see any problem. Did you try to run the code in debug mode (i.e. OPT=dbg)? When creating the budget constraint you call it budCons, but you use pricerdata->budCon, so are you calling the correct constraint name (you probably still are, but I too frequently make such mistakes)?

Do you get a segmentation error or is the pointer returned 'simply' NULL?

Cheers,

Tue Christensen
PhD Student,
Aarhus University, Denmark

From: scip-bounces at zib.de<mailto:scip-bounces at zib.de> [mailto:scip-bounces at zib.de] On Behalf Of Jose Walteros
Sent: 14. maj 2012 22:45
To: SCIP mailing list
Subject: [Scip] SCIPgetTransformedCons


Hi all,

I am coding a branch and price using SCIP and I have a question about a segmentation problem within  the pricer. I was wondering if you guys can help me with it.

I used the bin packing example that you have, and so far everything has been working very smoothly (the branching, the constraint handler, etc), Although, I am experiencing a problem with the pricer. The problem is as follows:

I have two kinds of constraints that I require to get the duals from, to solve the pricer problem. The first kind are a set of constraints that I named parCons. For those constraints, I have been able to catch the transformed version of the constraints and obtain the duals without any problem.

The second  kind  is a single constraint, some sort of a budget/ knapsack constraint. I defined it as follows:

   /* create set budget constraint */
   (void) SCIPsnprintf(name, SCIP_MAXSTRLEN, "BudgetCon");
   SCIP_CALL( SCIPcreateConsLinear(scip, &budCons, name, 0,  NULL, NULL,
                                   -num_B,    /* lhs */
                                   SCIPinfinity(scip),                    /* rhs */
                                   TRUE,                   /* initial */
                                   TRUE,                  /* separate */
                                   TRUE,                   /* enforce */
                                   TRUE,                   /* check */
                                   TRUE,                   /* propagate */
                                   FALSE,                  /* local */
                                   TRUE,                   /* modifiable */
                                   FALSE,                  /* dynamic */
                                   FALSE,                  /* removable */
                                   FALSE) );               /* stickingatnode */
   SCIP_CALL( SCIPaddCons(scip, budCons) );

As I mentioned before, I used the bin packing example as a guide.

Now, in the code of the pricer, within function SCIP_DECL_PRICERINIT(pricerInitCCP),As you can see in the code below, I am trying to get the transformed version of this constraint but I am getting a segmentation problem. Apparently SCIP is not able to get the transformed constraint, it returns null. I tried to comment that line to see what happens, and the code starts working. However, when I call for the dual of budCon, it always returns 0 (which in my opinion is expected as is not the transformed constraint).

The following is the code that I have


   /* get transformed constraints */
   for( c = 0; c < pricerdata->nodes; ++c )
   {
       cons = pricerdata->parCons[c];


       /* release original constraint */
       SCIP_CALL( SCIPreleaseCons(scip, &pricerdata->parCons[c]) );


       /* get transformed constraint */
       SCIP_CALL( SCIPgetTransformedCons(scip, cons, &pricerdata->parCons[c]) );


       /* capture transformed constraint */
       SCIP_CALL( SCIPcaptureCons(scip, pricerdata->parCons[c]) );
   }


   cons = pricerdata->budCon;


   /* get transformed constraint */
   SCIP_CALL( SCIPgetTransformedCons(scip, cons, &pricerdata->budCon) );


   /* capture transformed constraint */
   /* THE SEGMENTATION PROBLEM OCCURS IN THIS LINE. APPARENTLY SCIP IS NOT ABLE TO CAPTURE THE TRANSFORMED CONSTRAINT (I.E., THE SCIPgetTransformedCon IS RETURNING NULL)*/
   /* I FIND THIS WEIRD BECAUSE IT WORKS PERFECTLY FOR THE STATEMENT WITHIN THE FOR LOOP ABOVE. I.E., IT WORKS FOR THE parCons but not for the budCon/*
   SCIP_CALL( SCIPcaptureCons(scip, pricerdata->budCon) );


At first I thought that the problem was happening because maybe I was not not transforming the constraint somewhere else in the code. However, I the function SCIP_DECL_PROBTRANS(probtransCcp) in prob_data, I have the following code:

   /* transform all constraints */
   SCIP_CALL( SCIPtransformCons(scip, (*targetdata)->budCons, &(*targetdata)->budCons) );
   SCIP_CALL( SCIPtransformConss(scip, (*targetdata)->num_nodes, (*targetdata)->parCons, (*targetdata)->parCons) );

I ran out of ideas. Could you please help me with this?

Thanks for your time and sorry for the long email.

Jose L. Walteros
Ph.D. Student
Dept. of Industrial & Systems Engineering.
401 Weil Hall
University of Florida
Gainesville, FL 32611-6595, USA


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserv.zib.de/mailman/private/scip/attachments/20120516/58ba8f1f/attachment.html


More information about the Scip mailing list