[CoinUtils-tickets] [COIN-OR Common Utilities] #56: Incorrect treatment of infinity when reading

COIN-OR Common Utilities coin-trac at coin-or.org
Tue Nov 4 08:12:06 EST 2008


#56: Incorrect treatment of infinity when reading
---------------------+------------------------------------------------------
Reporter:  fmargot   |     Owner:     
    Type:  defect    |    Status:  new
Priority:  minor     |   Version:     
Keywords:  infinity  |  
---------------------+------------------------------------------------------
 To be able to read a bound constraint of the type -Inf <= x <= 2 or Inf >=
 x, the following changes are necessary:

             int scan_sense = 0;
 1614        if(first_is_number(start_str)) {

 1615              bnd1 = mult * atof(start_str);

                   scan_sense = 1;

             }

             else {

               if((strlen(buff) == 3) &&
 (CoinStrNCaseCmp(buff, "inf", 3) == 0)) {

                 bnd1 = mult * lp_inf;

                 scan_sense = 1;

               }

             }

             if(scan_sense) {

 1616              scan_next(buff, fp);

 1617              read_sense1 = is_sense(buff);

 1618              if(read_sense1 < 0) {

 1619                char str[8192];

 1620                sprintf(str,"### ERROR: Bounds; expect a sense, get:
 %s\n", buff);

 1621                throw CoinError(str, "readLp", "CoinLpIO", __FILE__,
 __LINE__);

 1622              }

 1623              scan_next(buff, fp);

 1624            }


 To allow for any capitalization of inf,
 change line:

 1663         if (strncmp(start_str,"inf",3)&&strncmp(start_str,"Inf",3)) {

 to:

 1663         if(strlen(start_str) == 3) && (CoinStrNCaseCmp(start_str,
 "inf", 3) == 0)) {

 To be consistant with the definition of infinity by the user, change line:

 1670             bnd2 = DBL_MAX;

 to

 1670             bnd2 = lp_inf;

-- 
Ticket URL: <https://projects.coin-or.org/CoinUtils/ticket/56>
COIN-OR Common Utilities <http://projects.coin-or.org/CoinUtils>
Common data structures and linear algebra functions for COIN-OR projects



More information about the CoinUtils-tickets mailing list