[Scip] Getting duals solution in MIP solving

Gerald Gamrath gamrath at zib.de
Mon Mar 11 09:13:07 MET 2013


Hi Vivek,

when you read in an lp-file, only linear constaints are constructed 
(unless you have quadratic constraints or mark some constraints to be of 
a special type like indicator, sos, ...).

In presolving, however, an upgrade of (linear) constraints is performed. 
This means that handlers for specialized linear constraints like 
knapsack, set packing/partitioning/covering, logicor, can register an 
upgrade method in the linear constraint handler, which is called during 
presolving and checks for each constraint whether it is of the 
respective type. For example, a less-equal inequality with only 
nonnegative integer coefficients and binary variables will be upgraded 
to a knapsack.

This is only done if the constraint is not modifiable and normally helps 
because the specialized constraint handler can do some additional things 
or does some things more efficiently. If you don't want SCIP to do the 
update, you can change the following parameters to FALSE (although I 
would not recommend it due to the already mentioned advantages of the 
upgrade):
constraints/linear/upgrade/knapsack
constraints/linear/upgrade/logicor
constraints/linear/upgrade/setppc
constraints/linear/upgrade/varbound

Best,
Gerald

Am 10.03.2013 16:58, schrieb Vivek Periaraj:
> Hi Gerald,
>
> That was it! Yes, I was reading in a restricted problem which I write out as a LP file. This problem is actually an entire problem with the correct bounds only for a subset of variables. My idea was to alter the bounds of those columns which I price. I wasn't aware of variable pricer. I just read about it and it makes more sense to use it. Is variable pricer more effective?
>
> The presolve output I gave before was from a different run of a different problem. I dug into this problem little bit more. When I read in the problem from an LP file, some how the constraint handlers are not set correctly I believe. I guess the handler type is auto detected. I expected linear constraint handlers to be used. I have now disabled some presolve plugins too.
>
> Thanks,
> Vivek.
>
>
> ----- Original Message -----
>
> From: "Gerald Gamrath"<gamrath at zib.de>
> To: "Vivek Periaraj"<vivek.periaraj at gmail.com>
> Cc: scip at zib.de
> Sent: Sunday, March 10, 2013 3:47:48 PM
> Subject: Re: [Scip] Getting duals solution in MIP solving
>
> Hi Vivek,
>
> normally, when you do pricing, you don't read in a standard .lp file,
> but you write your own reader which reads in some problem data, creates
> the model constraints and initializes some pricer data structure. How do
> you do it? Your lp-file contains just the starting restricted problem
> and your pricer gets its information somehow, too?
>
> What somehow does not fit in your reports is that on the one hand, cited
> the presolving output with all the different kinds of constraints, but
> on the other hand, you transformed problem which you write does not
> contain any constraints? Is this really the same run? How do you write
> your problem?
>
> In any case, there is a flag for the constraints which specifies whether
> priced-in variables will be added to a constraint during solving. This
> means that no or only a limited amount of presolving can be performed
> (you don't know which variables will be added with which constraints),
> and also no constraint upgrades will be done. If you read in an lp-file,
> this flag (called "modifiable") will be set to FALSE. Thus, you need to
> set this flag to TRUE for all constraints to which priced variables can
> be added by using SCIPsetConsModifiable(), see:
> http://scip.zib.de/doc/html/scip_8h.shtml#ab2b88302a2ccd6e18ec932fcc15ad3db
> When creating the constraints by hand, you need to set the modifiable
> flag in the SCIPcreateConsLinear() method to TRUE.
>
> If you do this, all constraints should stay linear constraints. Of
> course, if you create the constraints yourself, you could also create
> constraints of other types, in this case, you would need to use the
> corresponding SCIPgetDualsolXYZ() method.
>
> Best,
> Gerald
>
> Am 10.03.2013 07:57, schrieb Vivek Periaraj:
>> Hi Gerald,
>>
>> At a given node, when PRICERREDCOST is being called, I tried to write the problem object. But it contains nothing.
>>
>> At the node SCIPisTransformed(scip) returns true.
>>
>> Following is the output of the LP file.
>>
>> \ SCIP STATISTICS
>> \ Problem name : t_orgmodel.lp
>> \ Variables : 0 (0 binary, 0 integer, 0 implicit integer, 0 continuous)
>> \ Constraints : 0
>> \ Obj. scale : 1
>> \ Obj. offset : -7860.74136294638
>> Minimize
>> Obj:
>> Subject to
>> Bounds
>> End
>>
>> I think this is why I am not getting any duals.
>>
>> Thanks,
>> Vivek.
>>
>> ----- Original Message -----
>>
>> From: "Gerald Gamrath"<gamrath at zib.de>
>> To: "Vivek Periaraj"<vivek.periaraj at gmail.com>
>> Cc: scip at zib.de
>> Sent: Sunday, March 10, 2013 3:57:46 AM
>> Subject: Re: [Scip] Getting duals solution in MIP solving
>>
>> Dear Vivek,
>>
>> you do not need to call SCIPtransformProb() yourself, that is done
>> automatically when you start the solving process by calling SCIPsolve().
>> The transformation results in a copy of the original problem, which is
>> used during the (pre)solving process, for example when constraints are
>> removed, bounds are changed, etc.
>>
>> Therefore, you need to work with the transformed constraints in the
>> PRICERREDCOST callback. I guess, you still work with the original
>> constraints, you can check that by calling SCIPconsIsTransformed() on
>> the constraints. If they are not transformed yet, you can get the
>> corresponding transformed one by calling SCIPgetTransformedCons() or
>> SCIPgetTransformedConss() for getting the transformed constraints for an
>> array of constraints. See
>> http://scip.zib.de/doc/html/scip_8h.shtml#ac783997fa88d9b38b4bb7cfc0c101e95
>> http://scip.zib.de/doc/html/scip_8h.shtml#a11bfa7463e407dab949f3ac77e2e051b
>>
>> Best,
>> Gerald
>>
>> Am 09.03.2013 18:30, schrieb Vivek Periaraj:
>>> Hi List,
>>>
>>> I am trying to implement a pricer but I am unable to get any dual solutions from the problem object. The following are the steps I did:
>>>
>>> 1) I loaded default plugins
>>> 2) I loaded a lp file into SCIP problem object using SCIPreadProb()
>>> 3) I initialize and activate the pricer.
>>> 4) I invoke SCIPsolve()
>>>
>>> In the PRICERREDCOST callback, I call SCIPgetDualsolLinear() and all the duals turn out to be zeros. I tried several problems and same is the case.
>>>
>>> I tried SCIPtransformProb() but still duals were zeros.
>>>
>>> Am I missing any step? Do I have to enable/disable any other plugins? Using soplex and cpx as the LP solver exhibit the same problem.
>>>
>>> Regards,
>>> Vivek.
>>>
>>>
>>> _______________________________________________
>>> Scip mailing list
>>> Scip at zib.de
>>> http://listserv.zib.de/mailman/listinfo/scip



More information about the Scip mailing list