[SCIP] Problem with integer variables getting not integer solution

Jakob Witzig witzig at zib.de
Fri Jul 29 08:19:56 CEST 2016


Hi Luciana,

just an additional comment, calling SCIPprintSol without a solution 
pointer, i.e., sol = NULL, will print the LP or pseudo solution. You may 
want to call SCIPgetBestSol first get the best solution found so far (if 
such exists) and if this method does not return NULL, you can call 
SCIPprintSol for the best solution. Or you just call SCIPprintBestSol.

Cheers,

Jakob



On 29.07.2016 07:31, Jakob Witzig wrote:
> Hi Luciana,
>
> which SCIP version do you use? I tried your model with the latest 
> bugfix release (3.2.1) and everything works fine, I got the following 
> solution:
>
> objective value:                     6431.66666666667
> x1                                                  3 
> (obj:1280.55555555556)
> x2                                                  2   (obj:1295)
>
>
> Cheers,
> Jakob
>
> On 29.07.2016 00:53, Luciana Garcia Richter wrote:
>> Hi,
>>
>> I have defined a problem with integer variables (it is an instance of
>> a knapsack problem).
>> I have included the print for the original problem, the transformed
>> problem and the solution.
>> As you can see, all variables are defined as integer, but the solution
>> I get is far away from an integer value (e.g. 2.6 for x1 or 0.4 for
>> x3)
>> Is there something I'm missing?
>>
>>
>> #########################  SCIPprintOrigProblem 
>> ############################
>> STATISTICS
>>    Problem name     : Knapsack
>>    Variables        : 6 (0 binary, 6 integer, 0 implicit integer, 0 
>> continuous)
>>    Constraints      : 1 initial, 1 maximal
>> OBJECTIVE
>>    Sense            : maximize
>> VARIABLES
>>    [integer] <x0>: obj=575.555555555556, original bounds=[0,10000000000]
>>    [integer] <x1>: obj=1280.55555555556, original bounds=[0,10000000000]
>>    [integer] <x2>: obj=1295, original bounds=[0,10000000000]
>>    [integer] <x3>: obj=1295, original bounds=[0,10000000000]
>>    [integer] <x4>: obj=1295, original bounds=[0,10000000000]
>>    [integer] <x5>: obj=1295, original bounds=[0,10000000000]
>> CONSTRAINTS
>>    [linear] <R>: -10000000000 <=  +520<x0>[I] +1000<x1>[I] +1066<x2>[I]
>> +1120<x3>[I] +1150<x4>[I] +1250<x5>[I] <= 5180;
>> END
>> #########################  SCIPprintTransProblem 
>> ############################
>> STATISTICS
>>    Problem name     : t_Knapsack
>>    Variables        : 6 (0 binary, 6 integer, 0 implicit integer, 0 
>> continuous)
>>    Constraints      : 1 initial, 1 maximal
>> OBJECTIVE
>>    Sense            : minimize
>>    Scale            : 0.555555555555556
>> VARIABLES
>>    [integer] <t_x0>: obj=-1036, global bounds=[1,2], local bounds=[1,2]
>>    [integer] <t_x1>: obj=-2305, global bounds=[3,3], local bounds=[3,3]
>>    [integer] <t_x2>: obj=-2331, global bounds=[2,2], local bounds=[2,2]
>>    [integer] <t_x3>: obj=-2331, global bounds=[-0,0], local 
>> bounds=[-0,0]
>>    [integer] <t_x4>: obj=-2331, global bounds=[-0,0], local 
>> bounds=[-0,0]
>>    [integer] <t_x5>: obj=-2331, global bounds=[-0,0], local 
>> bounds=[-0,0]
>> CONSTRAINTS
>>    [linear] <R>:  +625<t_x5>[I] +500<t_x1>[I] +533<t_x2>[I]
>> +560<t_x3>[I] +575<t_x4>[I] +260<t_x0>[I] <= 2590;
>> END
>> #########################  SCIPprintSol ############################
>> objective value:                            -infinity
>> x0                               -1.00125783520231e-015
>> (obj:575.555555555556)
>> x1                                                2.6 
>> (obj:1280.55555555556)
>> x2                                                  2 (obj:1295)
>> x3                                  0.400000000000001 (obj:1295)
>> x4                                                 -0 (obj:1295)
>> x5                                                  0 (obj:1295)
>>
>> Thanks in advance,
>> Luciana
>> _______________________________________________
>> Scip mailing list
>> Scip at zib.de
>> http://listserv.zib.de/mailman/listinfo/scip
>

-- 
Jakob Witzig

Zuse Institute Berlin (ZIB)

Division Mathematical Optimization and Scientific Information
Research Group Mathematical Optimization Methods

Takustrasse 7
14195 Berlin

Tel. : +49 (0)30 84185-416
Fax  : +49 (0)30 84185-269
email: witzig at zib.de



More information about the Scip mailing list