[Scip] Adding rows to cutpool

sheetal murkute shvm11 at gmail.com
Fri Mar 30 20:48:00 MEST 2012


Hi,

I tried using  SCIPvarGetCol()  and  SCIPaddPoolCut() methods.
I am getting segmentation fault at the SCIPcreateRow() line.

I am now adding cuts as follows:
_vars is a vector where I store my SCIP variables.
cutind[0] = 5 ; cutind[1] = 351;    // indices of nonzero row variables
cutval[0] = 1; cutval[1] = -10;    // coefficients of nonzero row variables

SCIP_ROW * newrow;

SCIP_Var* xVar=_vars[cutind[0]];
SCIP_COL * xCol = SCIPvarGetCol(xVar);
SCIP_Var* yVar=_vars[cutind[1]];
SCIP_COL * yCol = SCIPvarGetCol(yVar);
SCIP_COL** cols= (SCIP_COL**) malloc( 2 * sizeof(SCIP_COL*));
cols[0]=xCol;
cols[1]=yCol;

SCIP_CALL_EXC( SCIPcreateRow(scip, &newrow, namebuf.str().c_str(), 2, cols,
cutval, -SCIPinfinity(scip), 0, FALSE,FALSE,FALSE));
SCIP_CALL_EXC( SCIPaddPoolCut(scip, newrow));


Please let me know if anything is incorrect.


-Sheetal

On Wed, Mar 28, 2012 at 8:51 PM, Stefan Heinz <heinz at zib.de> wrote:

> Hi,
>
> The creation of your cut is not correct. The SCIP_COL* array is *not* an
> array of indices. You should use the method SCIPvarGetCol()
>
> http://scip.zib.de/doc/html/**pub__var_8h.html#**
> a75111eed912d3f76ec076b787f7a0**b12<http://scip.zib.de/doc/html/pub__var_8h.html#a75111eed912d3f76ec076b787f7a0b12>
>
> to get for a variable to corresponding column. To add your cut into the
> cut pool of SCIP  you should use the method SCIPaddPoolCut()
>
>
> http://scip.zib.de/doc/html/**scip_8h.html#**
> a14b5af5c0722ae6284b2a2d2eb0b3**d5b<http://scip.zib.de/doc/html/scip_8h.html#a14b5af5c0722ae6284b2a2d2eb0b3d5b>
>
> Best Stefan
>
>
>
> On 03/27/2012 06:46 PM, sheetal murkute wrote:
>
>> Hello,
>>
>> I want to add rows to cutpool.
>> For this, I have written the code mentioned below:
>>
>> cutval = (double *) malloc((3) * sizeof(double *));
>> SCIP_CUTPOOL * cutpool;
>> SCIP_ROW * newrow;
>> SCIP_COL * cutind;
>> namebuf.str("");
>> namebuf<<"row_"<<k;
>> cutind[0] = 22 ; cutind[1] = 34;   ( 22 and 34 are column numbers with
>> nonzero values, there are total 2 non-zero coefficients in a row)
>>
>> SCIPcreateRow(scip,&newrow, namebuf.str().c_str(), 2,&cutind, cutval,
>>
>> -SCIPinfinity(scip), 0, FALSE,FALSE,FALSE);
>> SCIPaddRowCutpool(scip, cutpool, newrow);
>>
>> *I am getting error saying:*
>>
>> /home/sxm4946/SCIP/**ziboptsuite-2.1.1/scip-2.1.1/**
>> src/scip/scip/type_lp.h:73:
>> error: forward declaration of āstruct SCIP_Colā
>> scipmcfv2.cpp:308: error: invalid use of incomplete type āstruct SCIP_Colā
>>
>>
>>
>> Can you please help me with this?
>>
>>
>>
>>
>>
>>
>> ______________________________**_________________
>> Scip mailing list
>> Scip at zib.de
>> http://listserv.zib.de/**mailman/listinfo/scip<http://listserv.zib.de/mailman/listinfo/scip>
>>
>
>


-- 
Thanks with Best Regards,
Sheetal

:)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserv.zib.de/mailman/private/scip/attachments/20120330/21cf0493/attachment.html


More information about the Scip mailing list