[Scip] Problems with SCIPcopy() and SCIPcopyProb()

Robert Schwarz schwarz at zib.de
Tue Dec 20 11:24:24 MET 2011


Hi Daniel

On 12/20/2011 11:17 AM, Daniel Karch wrote:
> src/scip/scip.c:1422: SCIPcopyVars: Assertion `SCIPgetNIntVars(sourcescip)
> + SCIPgetNBinVars(sourcescip) <= SCIPgetNIntVars(targetscip) +
> SCIPgetNBinVars(targetscip) && SCIPgetNIntVars(targetscip) +
> SCIPgetNBinVars(targetscip) <= SCIPgetNIntVars(sourcescip) +
> SCIPgetNBinVars(sourcescip) + nfixedbinvars + nfixedintvars' failed.
> 
> I get
> 
> SCIPgetNIntVars(sourcescip) + SCIPgetNBinVars(sourcescip) + nfixedbinvars +
> nfixedintvars == 25093
> 
> and
> 
> SCIPgetNIntVars(targetscip) + SCIPgetNBinVars(targetscip) == 27366
> 
> After the presolving, the problem has 2273 binary variables, which is
> exactly the difference here.
> I figured out that the problem occurs in scip.c, l. 1966:
> 
> /* create problem in the target SCIP and copying the source problem data */
> SCIP_CALL( SCIPcopyProb(sourcescip, targetscip, localvarmap, localconsmap,
> global, name) );
> 
> /* copy all active variables */
> SCIP_CALL( SCIPcopyVars(sourcescip, targetscip, localvarmap, localconsmap,
> global) );
> 
> The call to SCIPcopyProb() calls my scip_copy() callback and copies all the
> variables, and the subsequent call to SCIPcopyVars() copies the active
> variables *again*.
> Now I don't really know what to do. The TSP example is the only one I am
> aware of that implements the scip_copy() callback in the ProbData class,
> and I did it just like it is
> done there.
> 
> Any suggestions?

I just had the same problem. In your copy method of your ProbData class,
you probably copy the variables of the original problem, whereas the
SCIPcopyVars() line copies the variables of the transformed problem.
This also explains the difference in cardinality.

Otherwise SCIPgetVarCopy() can figure out which variables have already
been copied.

I suggest you also copy the transformed variables in your probdata,
using SCIPgetTransformedVar.

Hope that helps.

-- 
Robert Schwarz
schwarz at zib.de

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
Url : http://listserv.zib.de/mailman/private/scip/attachments/20111220/05fc9b09/signature.bin


More information about the Scip mailing list