[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] Zero valued coefficients
From: |
Heinrich Schuchardt |
Subject: |
Re: [Help-glpk] Zero valued coefficients |
Date: |
Tue, 25 Aug 2015 21:22:20 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.8.0 |
On 25.08.2015 21:00, Andrew Makhorin wrote:
>
>> currently
>>
>> glp_set_mat_col()
>> glp_set_mat_row()
>> glp_load_matrix()
>>
>> may be used to place zero valued coefficients in the sparse matrix
>> stored as structure GLPAIJ.
>>
>> These zero values are not needed in any way by GLPK.
>>
>> It is left to the calling problem to avoid passing zeros.
>>
>> I suggest to change above functions to check the value of coefficients
>> and to simply ignore any zero values.
>>
>> A simple
>>
>> if (0 == val[k])
>> continue;
>>
>> will be sufficient.
>>
>
> The idea was to keep the user data untouched, so it is undesirable to
> change the default behavior.
> Probably to resolve the issue there should
> be an option or additional api routines. Note that on passing the data
> to the solver zero coeffs are skipped.
>
The documentation of glp_get_mat_col and glp_get_mat_row says:
The routine glp_get_mat_col/-row scans (non-zero) elements
So the user knows that zero elements are not considered.
As dropping the zeros only changes internal data which is not accessible
to the user I see no need for any new API routines nor for any option.
Best regards
Heinrich Schuchardt