[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-glpk] GLPK locale bug

From: Andrew Makhorin
Subject: Re: [Bug-glpk] GLPK locale bug
Date: Wed, 13 Dec 2017 18:01:30 +0300

On Wed, 2017-12-13 at 14:09 +0000, Moritz Emanuel Beber wrote:
> Hi,
> On 2017-12-13 14:23, Andrew Makhorin wrote:
> > Which error message glp_read_prob writes on stdout/stderr?
> /tmp/tiny.glpk:2: error: column lower bound/fixed value missing or
> invalid
> > Please note that glpk does not support using 'decimal comma' instead of
> > 'decimal point' in text files, so if the error is caused by this, you
> > probably need to call setlocale(LC_NUMERIC, "en_US.UTF-8") to restore
> > default behavior.
> The error is indeed caused by the decimal sign. However, if GLPK
> doesn't support anything other than a point when reading in text
> files, why does it support different locales in writing to a file? 

Because for writing fp numbers it uses standard functions like fprintf
while for reading it uses its own routines that support only 'decimal
point' mode.

> I was surprised by this problem in a Python program that is reading
> and writing the problem within the same context and thus failed.
> I am now aware of this problem and can fix it accordingly but I think
> an ideal solution would be for GLPK to always write with a decimal
> point.

For some reasons glpk doesn't use locale features at all assuming that
the current locale is always "C".

BTW, if you are using utf-8 to encode national alphabet characters, you
don't need to change locale to something other than "C", since glpk
routines work correctly on such characters. And this also would resolve
the 'decimal point' issue.

> Best,
> Moritz
> -- 
> Moritz Emanuel Beber
> Postdoc
> DTU Biosustain
> Technical University of Denmark
> Novo Nordisk Foundation Center for
> Biosustainability
> Kemitorvet
> Building 220, Room 228D
> 2800 Kgs.Lyngby
> Mobile +45 93511963
> address@hidden
> www.dtu.dk/english

reply via email to

[Prev in Thread] Current Thread [Next in Thread]