glpk/lib/glpspx02.js
/***********************************************************************
     *  err_in_cbar - compute maximal relative error in dual solution
     *
     *  This routine returns maximal relative error:
     *
     *     max |cost[j] - cbar[j]| / (1 + |cost[j]|),
     *
     *  where cost and cbar are, respectively, directly computed and the
     *  current (updated) reduced costs of non-basic non-fixed variables.
     *
     *  NOTE: The routine is intended only for debugginig purposes. */
compute maximal relative error in dual solution
This routine returns maximal relative error.





The routine is intended only for debugginig purposes.
compute maximal relative error in dual solution This routine returns maximal relative error . The routine is intended only for debugginig purposes .
function err_in_cbar(csa){
        var m = csa.m;
        var n = csa.n;
        var stat = csa.stat;
        var cbar = csa.cbar;
        var j;
        var e, emax, cost;
        var pi = new Float64Array(1+m);
        eval_pi(csa, pi);
        emax = 0.0;
        for (j = 1; j <= n; j++)
        {  if (stat[j] == GLP_NS) continue;
            cost = eval_cost(csa, pi, j);
            e = Math.abs(cost - cbar[j]) / (1.0 + Math.abs(cost));
            if (emax < e) emax = e;
        }
        return emax;
    }
function err_in_cbar ( csa ) { var m = csa . m ; var n = csa . n ; var stat = csa . stat ; var cbar = csa . cbar ; var j ; var e , emax , cost ; var pi = new Float64Array ( 1 + m ) ; eval_pi ( csa , pi ) ; emax = 0.0 ; for ( j = 1 ; j <= n ; j ++ ) { if ( stat [ j ] == GLP_NS ) continue ; cost = eval_cost ( csa , pi , j ) ; e = Math . abs ( cost - cbar [ j ] ) / ( 1.0 + Math . abs ( cost ) ) ; if ( emax < e ) emax = e ; } return emax ; }
err_in_cbar - compute maximal relative error in dual solution
  This routine returns maximal relative error:
err_in_cbar - compute maximal relative error in dual solution This routine returns maximal relative error :