Commit 2dbb70e5 authored by jpekka's avatar jpekka

Fix also floor, ceil, and fabs calls. New run of the script.

	* import-GLPK: Fix also floor, ceil, and fabs calls.
	  New run of the script.
parent 73f89fdc
......@@ -26,6 +26,7 @@
#ifndef _GLPBBM_H
#define _GLPBBM_H
#include "gnumeric-config.h"
#include "gnumeric.h"
#include "numbers.h"
......
......@@ -26,6 +26,7 @@
#ifndef _GLPHBSM_H
#define _GLPHBSM_H
#include "gnumeric-config.h"
#include "gnumeric.h"
#include "numbers.h"
......
......@@ -26,6 +26,7 @@
#ifndef _GLPINV_H
#define _GLPINV_H
#include "gnumeric-config.h"
#include "gnumeric.h"
#include "numbers.h"
......
......@@ -26,6 +26,7 @@
#ifndef _GLPIPM_H
#define _GLPIPM_H
#include "gnumeric-config.h"
#include "gnumeric.h"
#include "numbers.h"
......
......@@ -26,6 +26,7 @@
#ifndef _GLPK_H
#define _GLPK_H
#include "gnumeric-config.h"
#include "gnumeric.h"
#include "numbers.h"
......
......@@ -26,6 +26,7 @@
#ifndef _GLPLANG_H
#define _GLPLANG_H
#include "gnumeric-config.h"
#include "gnumeric.h"
#include "numbers.h"
......
......@@ -26,6 +26,7 @@
#ifndef _GLPLIB_H
#define _GLPLIB_H
#include "gnumeric-config.h"
#include "gnumeric.h"
#include "numbers.h"
......
......@@ -26,6 +26,7 @@
#ifndef _GLPLP_H
#define _GLPLP_H
#include "gnumeric-config.h"
#include "gnumeric.h"
#include "numbers.h"
......
......@@ -26,6 +26,7 @@
#ifndef _GLPLPX_H
#define _GLPLPX_H
#include "gnumeric-config.h"
#include "gnumeric.h"
#include "numbers.h"
......
......@@ -26,6 +26,7 @@
#ifndef _GLPLUF_H
#define _GLPLUF_H
#include "gnumeric-config.h"
#include "gnumeric.h"
#include "numbers.h"
......
......@@ -26,6 +26,7 @@
#ifndef _GLPMAT_H
#define _GLPMAT_H
#include "gnumeric-config.h"
#include "gnumeric.h"
#include "numbers.h"
......
......@@ -36,6 +36,7 @@
#ifndef _GLPQMD_H
#define _GLPQMD_H
#include "gnumeric-config.h"
#include "gnumeric.h"
#include "numbers.h"
......
......@@ -26,6 +26,7 @@
#ifndef _GLPRSM_H
#define _GLPRSM_H
#include "gnumeric-config.h"
#include "gnumeric.h"
#include "numbers.h"
......
......@@ -26,6 +26,7 @@
#ifndef _GLPSPM_H
#define _GLPSPM_H
#include "gnumeric-config.h"
#include "gnumeric.h"
#include "numbers.h"
......
......@@ -26,6 +26,7 @@
#ifndef _GLPSPX_H
#define _GLPSPX_H
#include "gnumeric-config.h"
#include "gnumeric.h"
#include "numbers.h"
......
......@@ -26,6 +26,7 @@
#ifndef _GLPSTR_H
#define _GLPSTR_H
#include "gnumeric-config.h"
#include "gnumeric.h"
#include "numbers.h"
......
......@@ -147,10 +147,10 @@ static void initialize(LP *mip, LPSOL *sol)
for (j = 1; j <= n; j++)
{ if (!mip->kind[j]) continue;
k = m + j; /* x[k] = xS[j] */
if (mip->lb[k] != floor(mip->lb[k]))
if (mip->lb[k] != floorgnum(mip->lb[k]))
fault("bbm1_driver: lower bound of some integer structural "
"variable is not integer");
if (mip->ub[k] != floor(mip->ub[k]))
if (mip->ub[k] != floorgnum(mip->ub[k]))
fault("bbm1_driver: upper bound of some integer structural "
"variable is not integer");
}
......@@ -569,7 +569,7 @@ static void new_bound(int j, int type, gnum_float bound)
/* x[k] = xS[j] should be integer structural variable */
insist(1 <= j && j <= n && bb->mip->kind[j]);
/* new bound should be integer */
insist(bound == floor(bound));
insist(bound == floorgnum(bound));
/* set new lower or upper bound of the variable x[k] = xS[j] */
switch (type)
{ case 'L':
......@@ -757,7 +757,7 @@ static void round_off(void)
/* if xS[j] is close to the nearest integer, it may be assumed
that actually it is exact integer, where a small difference
appeared due to round-off errors */
ival = floor(bb->bbar[i] + 0.5); /* the nearest integer */
ival = floorgnum(bb->bbar[i] + 0.5); /* the nearest integer */
if (ival - tol <= bb->bbar[i] && bb->bbar[i] <= ival + tol)
bb->bbar[i] = ival;
}
......@@ -778,8 +778,8 @@ static gnum_float eval_infsum(void)
{ if (bb->mip->kind[j])
{ gnum_float val, t1, t2;
val = get_value(m+j);
t1 = val - floor(val);
t2 = ceil(val) - val;
t1 = val - floorgnum(val);
t2 = ceilgnum(val) - val;
insist(t1 >= 0.0 && t2 >= 0.0);
sum += (t1 < t2 ? t1 : t2);
}
......@@ -997,7 +997,7 @@ static void store_sol(LPSOL *sol, int status)
{ if (rsm->posx[k] > 0)
{ i = +rsm->posx[k]; /* x[k] = xB[i] */
sol->tagx[k] = 'B';
if (cp->round && fabs(bbar[i]) < cp->tol_bnd) bbar[i] = 0.0;
if (cp->round && gnumabs(bbar[i]) < cp->tol_bnd) bbar[i] = 0.0;
sol->valx[k] = bbar[i];
sol->dx[k] = 0.0;
}
......@@ -1005,7 +1005,7 @@ static void store_sol(LPSOL *sol, int status)
{ j = -rsm->posx[k]; /* x[k] = xN[j] */
sol->tagx[k] = rsm->tagn[j];
sol->valx[k] = eval_xn(rsm, j);
if (cp->round && fabs(cbar[j]) < cp->tol_dj) cbar[j] = 0.0;
if (cp->round && gnumabs(cbar[j]) < cp->tol_dj) cbar[j] = 0.0;
sol->dx[k] = cbar[j];
}
}
......@@ -1117,8 +1117,8 @@ static void save_diff(BBNODE *node)
-- sets the parameter what which tells to the solver what of two child
-- subproblems derived from the current problem should be solved first:
--
-- 'L' - that one where xS[j] >= new lower bound = ceil(beta) > beta
-- 'U' - that one where xS[j] <= new upper bound = floor(beta) < beta
-- 'L' - that one where xS[j] >= new lower bound = ceilgnum(beta) > beta
-- 'U' - that one where xS[j] <= new upper bound = floorgnum(beta) < beta
--
-- where beta is the (fractional) value of the variable xS[j] in basis
-- solution of the current problem.
......@@ -1157,7 +1157,7 @@ static int choose_branch(int *what)
insist(1 <= i && i <= m);
/* xS[j] should have fractional (integer infeasible) value in the
optimal basis solution of the current problem */
insist(bb->bbar[i] != floor(bb->bbar[i]));
insist(bb->bbar[i] != floorgnum(bb->bbar[i]));
/* check subproblem flag */
insist(*what == 'L' || *what == 'U');
/* return to the calling routine */
......@@ -1170,11 +1170,11 @@ static int choose_branch(int *what)
-- This routine divides the current problem in two child subproblems
-- using the chosen branching variable xS[j], 1 <= j <= n. In the first
-- child subproblem (which is fixed to the left of the current problem
-- node) the variable xS[j] has new lower bound ceil(beta), where beta
-- node) the variable xS[j] has new lower bound ceilgnum(beta), where beta
-- is the value of xS[j] in the optimal basis solution of its parent,
-- and in the second child subproblem (which is fixed to the right of
-- of the current problem node) the variable xS[j] has new upper bound
-- floor(beta). After creating subproblems the routine adds them to the
-- floorgnum(beta). After creating subproblems the routine adds them to the
-- end of the active list.
--
-- It is assumed that the current problem (specified by the parameter
......@@ -1194,7 +1194,7 @@ static void split_node(BBNODE *node, int j)
child->up = node;
child->j = j;
child->type = 'L';
child->bound = ceil(beta);
child->bound = ceilgnum(beta);
child->solved = 0;
child->diff = NULL;
child->objval = child->infsum = 0.0;
......@@ -1213,7 +1213,7 @@ static void split_node(BBNODE *node, int j)
child->up = node;
child->j = j;
child->type = 'U';
child->bound = floor(beta);
child->bound = floorgnum(beta);
child->solved = 0;
child->diff = NULL;
child->objval = child->infsum = 0.0;
......@@ -1570,8 +1570,8 @@ done: /* reflect the spent resources in the parameter block */
-- The routine also sets the parameter what which tells the solver what
-- of two subproblems should be solved after the current problem:
--
-- 'L' - that one where xS[j] >= new lower bound = ceil(beta) > beta
-- 'U' - that one where xS[j] <= new upper bound = floor(beta) < beta
-- 'L' - that one where xS[j] >= new lower bound = ceilgnum(beta) > beta
-- 'U' - that one where xS[j] <= new upper bound = floorgnum(beta) < beta
--
-- where beta is the (fractional) value of the variable xS[j] in basis
-- solution of the current problem.
......@@ -1602,7 +1602,7 @@ int branch_first(BBDATA *bb, int *what)
/* beta = value of xS[j] in the current basis solution */
beta = bb->bbar[i];
/* skip basic variable which has an integer value */
if (beta == floor(beta)) continue;
if (beta == floorgnum(beta)) continue;
/* choose xS[j] */
this = j;
break;
......@@ -1610,7 +1610,7 @@ int branch_first(BBDATA *bb, int *what)
insist(1 <= this && this <= n);
/* tell the solver to get next that problem where xS[j] violates
its new bound less than in the other */
if (ceil(beta) - beta < beta - floor(beta))
if (ceilgnum(beta) - beta < beta - floorgnum(beta))
*what = 'L';
else
*what = 'U';
......@@ -1633,8 +1633,8 @@ int branch_first(BBDATA *bb, int *what)
-- The routine also sets the parameter what which tells the solver what
-- of two subproblems should be solved after the current problem:
--
-- 'L' - that one where xS[j] >= new lower bound = ceil(beta) > beta
-- 'U' - that one where xS[j] <= new upper bound = floor(beta) < beta
-- 'L' - that one where xS[j] >= new lower bound = ceilgnum(beta) > beta
-- 'U' - that one where xS[j] <= new upper bound = floorgnum(beta) < beta
--
-- where beta is the (fractional) value of the variable xS[j] in basis
-- solution of the current problem.
......@@ -1666,7 +1666,7 @@ int branch_last(BBDATA *bb, int *what)
/* beta = value of xS[j] in the current basis solution */
beta = bb->bbar[i];
/* skip basic variable which has an integer value */
if (beta == floor(beta)) continue;
if (beta == floorgnum(beta)) continue;
/* choose xS[j] */
this = j;
break;
......@@ -1674,7 +1674,7 @@ int branch_last(BBDATA *bb, int *what)
insist(1 <= this && this <= n);
/* tell the solver to get next that problem where xS[j] violates
its new bound less than in the other */
if (ceil(beta) - beta < beta - floor(beta))
if (ceilgnum(beta) - beta < beta - floorgnum(beta))
*what = 'L';
else
*what = 'U';
......@@ -1697,8 +1697,8 @@ int branch_last(BBDATA *bb, int *what)
-- The routine also sets the parameter what which tells the solver what
-- of two subproblems should be solved after the current problem:
--
-- 'L' - that one where xS[j] >= new lower bound = ceil(beta) > beta
-- 'U' - that one where xS[j] <= new upper bound = floor(beta) < beta
-- 'L' - that one where xS[j] >= new lower bound = ceilgnum(beta) > beta
-- 'U' - that one where xS[j] <= new upper bound = floorgnum(beta) < beta
--
-- where beta is the (fractional) value of the variable xS[j] in basis
-- solution of the current problem.
......@@ -1729,12 +1729,12 @@ int branch_last(BBDATA *bb, int *what)
--
-- If tagp = 'L', this routine computes degradation (worsening) of the
-- objective function when the basic variable xB[p] increasing goes to
-- its new lower bound ceil(beta), where beta is value of this variable
-- its new lower bound ceilgnum(beta), where beta is value of this variable
-- in the current basis solution.
--
-- If tagp = 'U', this routine computes degradation (worsening) of the
-- objective function when the basic variable xB[p] decreasing goes to
-- its new upper bound floor(beta).
-- its new upper bound floorgnum(beta).
--
-- The array ap is the p-th row of the current simplex table. The array
-- cbar is the vector of reduced costs of non-basic variables.
......@@ -1761,12 +1761,12 @@ static gnum_float degrad(BBDATA *bb, int p, int tagp, gnum_float ap[],
switch (tagp)
{ case 'L':
/* xB[p] increases and goes to its new lower bound */
new_val = ceil(cur_val);
new_val = ceilgnum(cur_val);
insist(new_val > cur_val);
break;
case 'U':
/* xB[p] deacreses and goes to its new upper bound */
new_val = floor(cur_val);
new_val = floorgnum(cur_val);
insist(new_val < cur_val);
break;
default:
......@@ -1851,7 +1851,7 @@ int branch_drtom(BBDATA *bb, int *what)
/* beta = value of xS[j] in the current basis solution */
beta = bb->bbar[p];
/* skip basic variable which has an integer value */
if (beta == floor(beta)) continue;
if (beta == floorgnum(beta)) continue;
/* compute p-th row of inv(B) */
eval_zeta(bb->rsm, p, zeta);
/* compute p-th row of the simplex table */
......
......@@ -299,7 +299,7 @@ void inv_ftran(INV *inv, gnum_float x[], int save)
{ len = 0;
for (i = 1; i <= m; i++)
{ temp = x[i];
if (temp == 0.0 || fabs(temp) < eps_tol) continue;
if (temp == 0.0 || gnumabs(temp) < eps_tol) continue;
len++;
cc_ndx[len] = i;
cc_val[len] = temp;
......@@ -651,7 +651,7 @@ int inv_update(INV *inv, int j)
/* store new pivot that corresponds to u[k2,k2] */
vr_piv[i] = work[qq_col[k2]];
/* check if u[k2,k2] is closer to zero */
if (fabs(vr_piv[i]) < upd_tol)
if (gnumabs(vr_piv[i]) < upd_tol)
{ /* the factorization should be considered as inaccurate (this
mainly happens due to excessive round-off errors) */
inv->valid = luf->valid = 0;
......@@ -668,7 +668,7 @@ int inv_update(INV *inv, int j)
j = qq_col[k];
temp = work[j];
/* if v[i,j] is close to zero, skip it */
if (fabs(temp) < eps_tol) continue;
if (gnumabs(temp) < eps_tol) continue;
/* at least one unused location is needed in the j-th column */
if (vc_len[j] + 1 > vc_cap[j])
{ if (luf_enlarge_col(luf, j, vc_len[j] + 10))
......
......@@ -160,7 +160,7 @@ void lpx_realloc_prob(LPX *lp, int m_max, int n_max)
-- to the end of the row list, therefore the numbers of existing rows
-- remain unchanged.
--
-- Being added each a new row is free (unbounded) and has no constraint
-- Being added each a new row isg_free (unbounded) and has no constraint
-- coefficients. */
void lpx_add_rows(LPX *lp, int nrs)
......@@ -494,7 +494,7 @@ void lpx_set_row_bnds(LPX *lp, int i, int typx, gnum_float lb, gnum_float ub)
case LPX_DB:
lp->lb[i] = lb * lp->rs[i], lp->ub[i] = ub * lp->rs[i];
if (lp->tagx[i] != LPX_BS)
lp->tagx[i] = (fabs(lb) <= fabs(ub) ? LPX_NL : LPX_NU);
lp->tagx[i] = (gnumabs(lb) <= gnumabs(ub) ? LPX_NL : LPX_NU);
break;
case LPX_FX:
lp->lb[i] = lp->ub[i] = lb * lp->rs[i];
......@@ -566,7 +566,7 @@ void lpx_set_col_bnds(LPX *lp, int j, int typx, gnum_float lb, gnum_float ub)
case LPX_DB:
lp->lb[j] = lb / lp->rs[j], lp->ub[j] = ub / lp->rs[j];
if (lp->tagx[j] != LPX_BS)
lp->tagx[j] = (fabs(lb) <= fabs(ub) ? LPX_NL : LPX_NU);
lp->tagx[j] = (gnumabs(lb) <= gnumabs(ub) ? LPX_NL : LPX_NU);
break;
case LPX_FX:
lp->lb[j] = lp->ub[j] = lb / lp->rs[j];
......
......@@ -110,8 +110,8 @@ int lpx_get_num_bin(LPX *lp)
{ if (lp->kind[j] == LPX_IV)
{ k = lp->m + j;
if (lp->typx[k] == LPX_DB &&
fabs(lp->lb[k] * lp->rs[k]) <= trick &&
fabs(lp->ub[k] * lp->rs[k] - 1.0) <= trick) count++;
gnumabs(lp->lb[k] * lp->rs[k]) <= trick &&
gnumabs(lp->ub[k] * lp->rs[k] - 1.0) <= trick) count++;
}
}
return count;
......@@ -694,7 +694,7 @@ int lpx_get_dual_stat(LPX *lp)
-- LPX_BS - basic variable;
-- LPX_NL - non-basic variable on its lower bound;
-- LPX_NU - non-basic variable on its upper bound;
-- LPX_NF - non-basic free (unbounded) variable;
-- LPX_NF - non-basicg_free (unbounded) variable;
-- LPX_NS - non-basic fixed variable.
--
-- If some of pointers tagx, vx, or dx is NULL, the corresponding value
......@@ -723,7 +723,7 @@ void lpx_get_row_info(LPX *lp, int i, int *tagx, gnum_float *vx, gnum_float *dx)
insist(1 <= t && t <= m);
vx_i = lp->bbar[t];
/* round the primal value (if required) */
if (lp->round && fabs(vx_i) <= lp->tol_bnd) vx_i = 0.0;
if (lp->round && gnumabs(vx_i) <= lp->tol_bnd) vx_i = 0.0;
}
else
{ /* non-basic variable */
......@@ -762,7 +762,7 @@ void lpx_get_row_info(LPX *lp, int i, int *tagx, gnum_float *vx, gnum_float *dx)
insist(1 <= t && t <= n);
dx_i = lp->cbar[t];
/* round the dual value (if required) */
if (lp->round && fabs(dx_i) <= lp->tol_dj) dx_i = 0.0;
if (lp->round && gnumabs(dx_i) <= lp->tol_dj) dx_i = 0.0;
}
/* unscale the dual value */
dx_i *= lp->rs[i];
......@@ -792,7 +792,7 @@ void lpx_get_row_info(LPX *lp, int i, int *tagx, gnum_float *vx, gnum_float *dx)
-- LPX_BS - basic variable;
-- LPX_NL - non-basic variable on its lower bound;
-- LPX_NU - non-basic variable on its upper bound;
-- LPX_NF - non-basic free (unbounded) variable;
-- LPX_NF - non-basicg_free (unbounded) variable;
-- LPX_NS - non-basic fixed variable.
--
-- If some of pointers tagx, vx, or dx is NULL, the corresponding value
......@@ -823,7 +823,7 @@ void lpx_get_col_info(LPX *lp, int j, int *tagx, gnum_float *vx, gnum_float *dx)
insist(1 <= t && t <= m);
vx_j = lp->bbar[t];
/* round the primal value (if required) */
if (lp->round && fabs(vx_j) <= lp->tol_bnd) vx_j = 0.0;
if (lp->round && gnumabs(vx_j) <= lp->tol_bnd) vx_j = 0.0;
}
else
{ /* non-basic variable */
......@@ -862,7 +862,7 @@ void lpx_get_col_info(LPX *lp, int j, int *tagx, gnum_float *vx, gnum_float *dx)
insist(1 <= t && t <= n);
dx_j = lp->cbar[t];
/* round the dual value (if required) */
if (lp->round && fabs(dx_j) <= lp->tol_dj) dx_j = 0.0;
if (lp->round && gnumabs(dx_j) <= lp->tol_dj) dx_j = 0.0;
}
/* unscale the dual value */
dx_j /= lp->rs[j];
......@@ -964,8 +964,8 @@ void lpx_get_ips_row(LPX *lp, int i, gnum_float *vx, gnum_float *dx)
#if 0
/* round them (if required) */
if (lp->round)
{ if (fabs(vx_i) <= 1e-8) vx_i = 0.0;
if (fabs(dx_i) <= 1e-8) dx_i = 0.0;
{ if (gnumabs(vx_i) <= 1e-8) vx_i = 0.0;
if (gnumabs(dx_i) <= 1e-8) dx_i = 0.0;
}
#endif
/* and unscale these values */
......@@ -1012,8 +1012,8 @@ void lpx_get_ips_col(LPX *lp, int j, gnum_float *vx, gnum_float *dx)
#if 0
/* round them (if required) */
if (lp->round)
{ if (fabs(vx_j) <= 1e-8) vx_j = 0.0;
if (fabs(dx_j) <= 1e-8) dx_j = 0.0;
{ if (gnumabs(vx_j) <= 1e-8) vx_j = 0.0;
if (gnumabs(dx_j) <= 1e-8) dx_j = 0.0;
}
#endif
/* and unscale these values */
......@@ -1122,7 +1122,7 @@ gnum_float lpx_get_mip_row(LPX *lp, int i)
{ vx = lp->mipx[i];
if (lp->round)
{ gnum_float eps = lp->tol_bnd / lp->rs[i];
if (fabs(vx) <= eps) vx = 0.0;
if (gnumabs(vx) <= eps) vx = 0.0;
}
}
return vx;
......@@ -1153,10 +1153,10 @@ gnum_float lpx_get_mip_col(LPX *lp, int j)
else
{ vx = lp->mipx[lp->m+j];
if (lp->kind[j] == LPX_IV)
insist(vx == floor(vx));
insist(vx == floorgnum(vx));
else if (lp->round)
{ gnum_float eps = lp->tol_bnd * lp->rs[lp->m+j];
if (fabs(vx) <= eps) vx = 0.0;
if (gnumabs(vx) <= eps) vx = 0.0;
}
}
return vx;
......
......@@ -106,7 +106,7 @@ static void eq_scal(int m, int n, void *info,
if (!(1 <= j && j <= n))
fault("eq_scal: i = %d; j = %d; invalid column ind"
"ex", i, j);
temp = R[i] * fabs(val[t]) * S[j];
temp = R[i] * gnumabs(val[t]) * S[j];
if (big < temp) big = temp;
}
/* scale the i-th row */
......@@ -128,7 +128,7 @@ static void eq_scal(int m, int n, void *info,
if (!(1 <= i && i <= m))
fault("eq_scal: i = %d; j = %d; invalid row index",
i, j);
temp = R[i] * fabs(val[t]) * S[j];
temp = R[i] * gnumabs(val[t]) * S[j];
if (big < temp) big = temp;
}
/* scale the j-th column */
......@@ -181,7 +181,7 @@ static void eq_scal(int m, int n, void *info,
-- for the same row and column numbers.
--
-- To perform geometric mean scaling the routine gm_scal divides all
-- elements of each row (column) by sqrtgnum (beta/alfa), where alfa and beta
-- elements of each row (column) by sqrtgnum(beta/alfa), where alfa and beta
-- are, respectively, smallest and largest absolute values of non-zero
-- elements of the corresponding row (column). In order to improve the
-- scaling quality the routine scales rows and columns several times.
......@@ -237,7 +237,7 @@ static void gm_scal(int m, int n, void *info,
for (t = 1; t <= len; t++)
{ j = ndx[t];
if (!(1 <= j && j <= n)) goto err2;
temp = R[i] * fabs(val[t]) * S[j];
temp = R[i] * gnumabs(val[t]) * S[j];
if (temp == 0.0) continue;
if (alfa > temp) alfa = temp;
if (beta < temp) beta = temp;
......@@ -272,13 +272,13 @@ err1: fault("gm_scal: i = %d; len = %d; invalid row leng"
if (!(1 <= j && j <= n))
err2: fault("gm_scal: i = %d; j = %d; invalid column "
"index", i, j);
temp = R[i] * fabs(val[t]) * S[j];
temp = R[i] * gnumabs(val[t]) * S[j];
if (temp == 0.0) continue;
if (alfa > temp) alfa = temp;
if (beta < temp) beta = temp;
}
/* scale the i-th row */
if (beta != 0.0) R[i] /= sqrtgnum (alfa * beta);
if (beta != 0.0) R[i] /= sqrtgnum(alfa * beta);
}
}
else
......@@ -297,13 +297,13 @@ err2: fault("gm_scal: i = %d; j = %d; invalid column "
if (!(1 <= i && i <= m))
fault("gm_scal: i = %d; j = %d; invalid row ind"
"ex", i, j);
temp = R[i] * fabs(val[t]) * S[j];
temp = R[i] * gnumabs(val[t]) * S[j];
if (temp == 0.0) continue;
if (alfa > temp) alfa = temp;
if (beta < temp) beta = temp;
}
/* scale the j-th column */
if (beta != 0.0) S[j] /= sqrtgnum (alfa * beta);
if (beta != 0.0) S[j] /= sqrtgnum(alfa * beta);
}
}
}
......
......@@ -622,12 +622,12 @@ beg: /* save the original objective function, because it is changed by
case LPX_FX:
/* xB[i] is gnum_float-bounded or fixed variable */
if (lp->bbar[i] < lp->lb[k] - eps)
{ temp = 0.5 * fabs(lp->lb[k] - lp->ub[k]);
{ temp = 0.5 * gnumabs(lp->lb[k] - lp->ub[k]);
if (temp > delta) temp = delta;
av_i = (lp->lb[k] - lp->bbar[i]) + temp;
}
if (lp->bbar[i] > lp->ub[k] + eps)
{ temp = 0.5 * fabs(lp->lb[k] - lp->ub[k]);
{ temp = 0.5 * gnumabs(lp->lb[k] - lp->ub[k]);
if (temp > delta) temp = delta;
av_i = (lp->ub[k] - lp->bbar[i]) - temp;
}
......@@ -845,8 +845,8 @@ sing: { /* remove the artificial variable from the problem */
value) influence coefficient */
spx->q = 0, big = 0.0;
for (j = 1; j <= n; j++)
{ if (big < fabs(spx->ap[j]))
spx->q = j, big = fabs(spx->ap[j]);
{ if (big < gnumabs(spx->ap[j]))
spx->q = j, big = gnumabs(spx->ap[j]);
}
insist(spx->q != 0);
/* perform forward transformation of the column of xN[q] (to
......
......@@ -103,12 +103,12 @@ int lpx_integer(LPX *lp)
lpx_get_row_bnds(lp, k, &typx, &lb, &ub);
else
lpx_get_col_bnds(lp, k-m, &typx, &lb, &ub);
temp = floor(lb + 0.5);
if (fabs(lb - temp) / (1.0 + fabs(lb)) <= trick) lb = temp;
temp = floor(ub + 0.5);
if (fabs(ub - temp) / (1.0 + fabs(ub)) <= trick) ub = temp;
temp = floorgnum(lb + 0.5);
if (gnumabs(lb - temp) / (1.0 + gnumabs(lb)) <= trick) lb = temp;
temp = floorgnum(ub + 0.5);
if (gnumabs(ub - temp) / (1.0 + gnumabs(ub)) <= trick) ub = temp;
if (k > m && mip->kind[k-m])
{ if (!(lb == floor(lb) && ub == floor(ub)))
{ if (!(lb == floorgnum(lb) && ub == floorgnum(ub)))
{ print(prefix "integer column %d has non-integer lower/up"
"per bound", k-m);
ret = LPX_E_FAULT;
......@@ -135,8 +135,8 @@ int lpx_integer(LPX *lp)
gnum_float temp;
len = lpx_get_mat_col(lp, j, ndx, val);
for (t = 1; t <= len; t++)