[Scip] getting column coefficients and realloc error

Stefan Heinz heinz at zib.de
Tue May 11 21:54:40 MEST 2010


Hi Mattia,


> Hi all,
>   I am developing a Branch&Price application in SCIP (1.2.0, linked with
> Soplex 1.4.2b , gcc version 4.3.3 on Ubuntu SMP x86_64), with a column
> generation approach. Simply I defined plugin Pricer that is a shortest path
> problem (in accord to my model decomposition), and a new constraint handler
> to store branching decision (like explained in SCIP: FAQ). A variable in my
> model represent a path of a given commodity from a source to a destination.
> What I want to do is to obtain the column coefficient of a given variable,
> without storing this information in SCIP_VARDATA, too expensive for my
> purpose (path o f hundred nodes for over 10e6 variables). I try this
> procedure:
>   SCIP_VAR** vars = SCIPgetVars(scip);
>   SCIP_COL* col = SCIPvarGetCol(vars[0]);
>   SCIP_Real* vals = SCIPcolGetVals(col);
> But what I get is a set of 1's and 0's in positions that do not match
> generated path (clearly, when new priced var is found, it is added to the
> problem, and coefficients of the constraints involved are updated in
>  order). May be because I relate whit transformed variable and not whit
>  original variable? But I read that priced var don't have an original
>  counterpart. So how can I solve this problem?
Well it is not possible to construct the information you need out of a 
SCIP_COL. The reason is that a column in SCIP knows the rows which have 
nonzero entries. The row, however, does not know the constraint which created 
that row. If you think that it is not possible to store the necessary 
information in SCIP_VARDATA you can construct the information in the following 
way.
You loop  over you (linear) constraints and ask each constraint for its 
variables (SCIPgetVarsLinear(), SCIPgetNVarsLinear()) and check if the 
variable you currently have in your hand is part of that linear constraint. So 
this means your idea should work if you use the (linear) constraints instead 
of the SCIP_COL. I hope that helps.
 
> I have a second problem. when creating a new constraint handler (as
> mentioned before), I get sometimes a segmentation fault error when I put a
> new constraint on the stack (more precisely when the program try to
> Reallocate memory for new constraint). The code used is the same as in the
> Coloring example provided with the default SCIP installation.
> 
> /* put constraint on the stack */
>    if ( conshdlrData->nstack >= conshdlrData->maxstacksize )
>    {
>       SCIPreallocMemoryArray(scip, &(conshdlrData->stack),
> 2*(conshdlrData->maxstacksize));
>       conshdlrData->maxstacksize = 2*(conshdlrData->maxstacksize);
>       SCIPdebugMessage("reallocating Memory for stack! %d --> %d\n",
> conshdlrData->maxstacksize/2, conshdlrData->maxstacksize);
>    }
>    conshdlrData->stack[conshdlrData->nstack] = cons;
>    ++(conshdlrData->nstack);
> 
> May be the problem is elsewhere, but the backtrace I obtain is as follow:
Could you check the values for conshdlrData->maxstacksize? Did you run SCIP 
and your program in debug mode? If not recompile SCIP and your program using 
the command "make OPT=dbg" and rerun your program and check if an assert() 
comes up.

Best Stefan 

> 
> *** glibc detected *** ./gse1/bin/gse: realloc(): invalid next size:
> 0x000000000243bfb0 ***
> ======= Backtrace: =========
> /lib/libc.so.6[0x7f22d49b0a58]
> /lib/libc.so.6[0x7f22d49b4d51]
> /lib/libc.so.6(realloc+0x12e)[0x7f22d49b5bde]
> ./gse1/bin/gse[0x6034e9]
> ./gse1/bin/gse[0x5f1445]
> ./gse1/bin/gse[0x5f12a8]
> ./gse1/bin/gse[0x5f918b]
> ./gse1/bin/gse[0x5b48ae]
> ./gse1/bin/gse[0x5af200]
> ./gse1/bin/gse[0x596a41]
> ./gse1/bin/gse[0x5a1f8d]
> ./gse1/bin/gse[0x5a25dc]
> ./gse1/bin/gse[0x45df04]
> ./gse1/bin/gse[0x45f456]
> ./gse1/bin/gse[0x4627d9]
> ./gse1/bin/gse[0x464256]
> ./gse1/bin/gse[0x44bf5c]
> ./gse1/bin/gse[0x4046d6]
> /lib/libc.so.6(__libc_start_main+0xe6)[0x7f22d4955466]
> ./gse1/bin/gse[0x404479]
> ======= Memory map: ========
> [...]
> [...]
> 
> 
> How can I solve this problem?
> 
> Thank you for the time you will spend to read and answer my questions.
> 


More information about the Scip mailing list