From b232c5f7ae1ccd16b2b9aa2ddc1ca8c0c8ef2b62 Mon Sep 17 00:00:00 2001 From: Chris Matrakidis Date: Sun, 8 Jan 2017 23:31:03 +0200 Subject: [PATCH 3/3] intfeas1 needs to check objective only when bound specified diff --git a/src/api/intfeas1.c b/src/api/intfeas1.c index c2e5989..f440984 100644 --- a/src/api/intfeas1.c +++ b/src/api/intfeas1.c @@ -123,22 +123,24 @@ int glp_intfeas1(glp_prob *P, int use_bound, int obj_bound) goto done; } } - /* check the objective function */ - temp = (int)P->c0; - if ((double)temp != P->c0) - { xprintf("glp_intfeas1: objective constant term %g is non-integ" - "er or out of range\n", P->c0); - ret = GLP_EDATA; - goto done; - } - for (j = 1; j <= P->n; j++) - { temp = (int)P->col[j]->coef; - if ((double)temp != P->col[j]->coef) - { xprintf("glp_intfeas1: column %d: objective coefficient is " - "non-integer or out of range\n", j, P->col[j]->coef); + /* check the objective function if a bound is requested */ + if (use_bound) + { temp = (int)P->c0; + if ((double)temp != P->c0) + { xprintf("glp_intfeas1: objective constant term %g is non-integ" + "er or out of range\n", P->c0); ret = GLP_EDATA; goto done; } + for (j = 1; j <= P->n; j++) + { temp = (int)P->col[j]->coef; + if ((double)temp != P->col[j]->coef) + { xprintf("glp_intfeas1: column %d: objective coefficient is " + "non-integer or out of range\n", j, P->col[j]->coef); + ret = GLP_EDATA; + goto done; + } + } } /* save the objective function and set it to zero */ obj_ind = xcalloc(1+P->n, sizeof(int)); -- 2.7.4