[Scip] Best solution in pricing iteration

Jan Berling berlingjan at gmail.com
Thu Jun 5 19:51:34 CEST 2014


Dear Gerald,
Dear Mailing List,

thanks a lot for your suggestions in:
http://listserv.zib.de/pipermail/scip/2014-April/001930.html

A new question arised: The current best solution in my pricing stays
at the initial solution in all iterations. Only at the end, the
optimal solution is changed. How can I get the current best solution
in a pricing round?

Given that the dual variables change in every iteration and the
initial solution has a cost of 23.000 and my optimal solution has a
cost of 600, I doubt that the solution does not become better in the
pricing loop. In the SCIP_DECL_PRICERREDCOST callback, following
functions only give the cost of the inial solution:

    SCIP_SOL* scipPricingSol = SCIPgetBestSol(scip);
    SCIPgetSolTransObj(scip, scipPricingSol);
    SCIPgetSolOrigObj(scip, scipbestsol);


I suspect, that the problem lies within how the variables are added to
the problem. All Variables of my Problem are known from the beginning.
Only some of them are added to the initial LP; because of the
structure of the problem, I know which variables could improve the
solution.

As you suggested, transforming the variables before adding them has
done the trick. The pricer is now running smoothly, adding variables
in all pricing rounds. The problem is solved to optimality. The
sequence of my program is as follows:


Initialization:

    All variables are created: SCIPcreateVarBasic()
    All variables are captured: SCIPcaptureVar()
    Only initial variables are added to the problem: SCIPaddVar()
    Only initial variables are added to the constraints
    All other variables are set to not initial: SCIPvarSetInitial(vars(f,d),0)
    /* Setting the variables as not initial is only done to identify
them in the pricing round */


Pricing, for a variable with reduced cost:

    Variable is transformed: SCIPtransformVar(scip,
pricerData->vars(f,d),&pricerData->vars(f,d))
    Transformed variable is added to the problem:
SCIPaddPricedVar(scip,pricerData->vars(f,d),redCost)
    Transformed variable is added to all constraints


How can I get the current best solution in each pricing iteration? At
best without changing too much of the program, time is very critical
at the moment.

Best regards,
Jan

PS on your remarks to the upper archive message:

> what do you mean exactly with linear indexing (just putting all
> variables into an array? do they need a specific order?)?

I put all variables in a 2D array, because they need a specific order.
At least I need to access them quickly with indices (f,d).
#define vars(f,d) vars[(f)*(maxd) + d]

> ... I would recommend to create all variables in the
> beginning and add them to the constraints, but set their initial flag to
> FALSE, so that they are dynamically priced into the LP. This reduces the
> size of the LP without the need to implement anything (SCIP will just go
> over all variables and check for some with negative reduced costs).

>From the dual variables it is known which  variables can have reduced
costs. So only a small subset of variables has to be checked for
reduced costs.

> However, if you really want to do branch-and-price, can't you just
> create variables when they should be priced in and add them to your
> local array of variables in that moment. Perhaps even at the place where
> they belong (with some variables in between not yet created)?

This would be optimal. But then I would have to allocate memory in
every pricing round? And I cant access the variables with vars(f,d)
anymore? (which is equal to vars[(f)*(maxd) + d])


More information about the Scip mailing list