Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Data/machine precision and floating-point arithmetic

    Posted 07/10/14 07:33 AM

    Originally posted by: JohannaH


    Hello,

     

    I'm using CPLEX 12.4 sometimes through modeler AMPL, sometimes directly via the Interactive Optimizer or the Python API (once the ".lp" is generated).

     

    1.
    "Machine precision" of cplex seems to be double (16 significant digits) by default, isn't it?


    But the data I am handling seems to be defined with single-precision.
    ex: 1.46699997E+02


    Does cplex convert data automatically to double precision?


    Also, are there "different" machine precision depending on whether we're using Cplex interactive solver, Cplex through Ampl or Cplex through the Python API? Or is it just different display precision?

     

    2.

    In my problem, I may have such a computation:
    y=1.73034896E+08-1.46699997E+ 02 *1800

    I wondering if the shift in order of magnitudes is not too wide, which may introduce round-off errors?

     

    Thank you in advance for your clarification,

    Best regards


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Data/machine precision and floating-point arithmetic

    Posted 07/13/14 05:01 PM

     

    All arithmetic in CPLEX is double-precision, regardless of the source of the problem. Precision may be lost using LP file format, though, so if exporting a model, you are better off using SAV format.

    Your computation does not look to dangerous to me, but the effects of rounding and truncation errors are difficult to predict. If you are worried, check the solution quality statistics.

     

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Data/machine precision and floating-point arithmetic

    Posted 07/15/14 04:03 PM

    Originally posted by: JohannaH


    Thank you Paul.

    When does the difference in order of magnitude becomes "numerically dangerous"? Absorption (for an addition) happens when the ratio of the terms is greater machine precision, right.

    I'll use another thread for posting results.

    Thanks again.


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Data/machine precision and floating-point arithmetic

    Posted 07/15/14 06:14 PM

    My last (and, come to think of it, only) numerical analysis class was in 1973 or '74, when "absorption" was used neither for any type of error I recall nor for my processing of the subject matter. :-) Give or take terminology, I think you have the right idea there.

    I'm not sure there is any particular order of magnitude at which things turn from "safe" to "dangerous". Dr. Ed Klotz (of IBM) once showed me a matrix, remembered from his student days, that caused numerical precision issues, and I seem to recall that it contained exclusively 0, +1 and possibly -1 as coefficients (and was not singular). Gremlins come in all sizes.

    Generally speaking, if I see a largest-to-smallest coefficient ratio on the order of 1e+10 or higher, I start getting nervous, even if CPLEX says 100% of bases were stable. It's also somewhat context specific. In the problems I've worked with to date, any coefficient ratio above about 100 could be traced back to me being lazy about scaling the data.

    I vaguely (very vaguely) recall encountering a problem once where substantial orders of magnitude differences among coefficients was unavoidable (I couldn't find a good way to scale things), and the problem caused the contemporary version of CPLEX indigestion. I think I solved it by decomposing into a master problem and a subproblem where the unit magnitude stuff pretty much all went into one problem and the 10^gazillion coefficients all landed in the other problem. It was basically equivalent to segregating the sumo wrestlers at one dining table and the jockeys at another (and, as would the analogy, avoided casualties).

    Sorry I can't be more specific, but my sense is that rounding adventures defy neat characterization/classification.

    Paul


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Data/machine precision and floating-point arithmetic

    Posted 07/16/14 07:25 AM

    Originally posted by: JohannaH


    Thank your for your replies (I like your analogy a lot!).

    I'm aware bad scaling, ill-conditionning, and numerical errors are related but not always.

    Cheers


    #CPLEXOptimizers
    #DecisionOptimization