[Scip] Solving the root node with pricing and then solve as an IP

michael.winkler@zib.de michael.winkler at zib.de
Sun Sep 18 13:04:18 MEST 2011


Hi Sebastian,

if you want to try the second case which Stefan suggested, presolving the
fixed model, then scip_init() or SCIP_DECL_PRICERINIT(??) is not the
correct callback to set the modifiable flag to false. You also need the
developer Version of SCIP because SCIPsetConsModifiable is not in Version
<= 2.0.2. (The next SCIP version 2.1??? will hopefully be released soon.)

The following will work if you have the developer Version and should lead
to your desired result.

Unfortunatly, you need to change two lines in scip.c.

Please change in method SCIPdeactivatePricer() the first line to:

SCIP_CALL( checkStage(scip, "SCIPdeactivatePricer", FALSE, TRUE, FALSE,
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE) )

and in method SCIPsetConsModifiable() the first line to

SCIP_CALL( checkStage(scip, "SCIPsetConsModifiable", FALSE, TRUE, TRUE,
FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE) );

This allows you to call these method later on.

Then please add at the beginning of scip_redcost() or
SCIP_DECL_PRICERREDCOST() :

if( SCIPgetDepth(scip) != 0 )
{
    *result = SCIP_SUCCESS;
     SCIP_CALL( SCIPrestartSolve(scip)  );
     return SCIP_OKAY;
}

This should restart SCIP when first calling the pricer callback not in the
root node.

Then the last change should be to add code at scip_exitsol() or
SCIP_DECL_PRICEREXITSOL()

if( SCIPisInRestart(scip) )
{
    SCIP_CONS** conss;
    int nconss;
    int c;

    conss = SCIPgetCons(scip);
    nconss = SCIPgetNCons(scip);

    for( c = 0; c < nconss; ++c )
    {
        SCIP_CALL( SCIPsetConsModifiable(scip, conss[c], FALSE) );
    }

    SCIP_CALL( SCIPdeactivatePricer(scip, pricer) );
}

This will mark all constraints not modifiable, to give SCIP the
possibility to presolve your fixed model as good as possible. The last
line will deactivate your pricer for the second run.

Best, Michael

> Hi Sebastian,
>
> yes there is currently nothing featuring that directly with a single
> method call.
>
> To get what you want there are several option. I will discuss two of them.
>
> 1) You just start the scip_redcost() or SCIP_DECL_PRICERREDCOST(??) with
>
> if( SCIPgetDepth(scip) != 0 )
> {
>     *result = SCIP_SUCCESS;
>     return SCIP_OKAY;
> }
>
> This cost no time and will ensure that you only create columns at the
> root node. In that case you should additionally loop over all
> constraints and change the modifiable flag to FALSE (see below).
>
> 2) You could also force SCIP to perform a restart after you generated
> all columns at the root node. This has the advantage that you get a
> presolving loop over your fixed model. Therefore, you also should change
> the modifiable flag of all constraints to FALSE (see below). A way of
> realizing this is to add the following code at the beginning of the
> reduced cost method of the pricer(s).
>
> if( SCIPgetNRuns(scip) > 1 )
> {
>     *result = SCIP_SUCCESS;
>     return SCIP_OKAY;
> }
>
> if( SCIPgetDepth(scip) != 0 || SCIPgetNRuns(scip) == 0 )
> {
>     *result = SCIP_SUCCESS;
>      SCIP_CALL( SCIPforceRestartSolve(scip)  );
>     return SCIP_OKAY;
> }
>
> The open question is how to change the modifiable flag of all
> constraints. This could be done in the pricer callback scip_init() or
> SCIP_DECL_PRICERINIT(??) using the following code:
>
> if( SCIPgetNRuns(scip) > 1 )
> {
>      SCIP_CONS** conss;
>      int nconss;
>      int c;
>
>      conss = SCIPgetCons(scip);
>      nconss = SCIPgetNCons(scip);
>
>      for( c = 0; c < nconss; ++c )
>      {
>          SCIP_CALL( SCIPsetConsModifiable(scip, conss[c], FALSE) );
>      }
> }
>
> Hope that helps and works.
>
> Best Stefan
>
>
> On 09/16/2011 05:15 PM, Sebastian Ruther wrote:
>> Hello,
>>
>> I want to generate columns only at the root node and then solve the
>> problem with the current set of columns using branch and cut and
>> variable branching. So this would be similar to just printing the
>> problem and then reading it in and solving with a solver like CPLEX or
>> GUROBI.
>> I tried to deactivate the pricer with SCIPdeactivatePricer but you are
>> not allowed to do that in the solving stage. Unfortunately there is no
>> function like SCIPsetBranchruleMaxdepth where you could set the depth of
>> the pricer. Btw. wihy isn't there? You might have some partial/inexact
>> pricing you want to do early in the tree.
>>
>> Thank you
>> Sebastian
>>
>> _______________________________________________
>> Scip mailing list
>> Scip at zib.de
>> http://listserv.zib.de/mailman/listinfo/scip
>
> _______________________________________________
> Scip mailing list
> Scip at zib.de
> http://listserv.zib.de/mailman/listinfo/scip
>



More information about the Scip mailing list