[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-glpk] Bounds on Binary variables
From: |
Andrew Makhorin |
Subject: |
Re: [Bug-glpk] Bounds on Binary variables |
Date: |
Wed, 07 Aug 2013 09:32:34 +0400 |
> GLPK ignores these in LP files
>
Thank you for your bug report.
To fix the bug please replace the routine parse_integer in file
glpk/src/glpcpx.c by the following one:
static void parse_integer(struct csa *csa)
{ int j, binary;
/* parse the keyword 'general', 'integer', or 'binary' */
if (csa->token == T_GENERAL)
binary = 0, scan_token(csa);
else if (csa->token == T_INTEGER)
binary = 0, scan_token(csa);
else if (csa->token == T_BINARY)
binary = 1, scan_token(csa);
else
xassert(csa != csa);
/* parse list of variables (may be empty) */
while (csa->token == T_NAME)
{ /* find the corresponding column */
j = find_col(csa, csa->image);
/* change kind of the variable */
glp_set_col_kind(csa->P, j, GLP_IV);
/* set bounds for the binary variable */
if (binary)
#if 0 /* 07/VIII-2013 */
{ set_lower_bound(csa, j, 0.0);
set_upper_bound(csa, j, 1.0);
}
#else
{ set_lower_bound(csa, j,
csa->lb[j] == +DBL_MAX ? 0.0 : csa->lb[j]);
set_upper_bound(csa, j,
csa->ub[j] == -DBL_MAX ? 1.0 : csa->ub[j]);
}
#endif
scan_token(csa);
}
return;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Bug-glpk] Bounds on Binary variables,
Andrew Makhorin <=