shridharmishra4 / europa-pso

Automatically exported from code.google.com/p/europa-pso
0 stars 1 forks source link

lt() (less-than) and leq() (less-than-or-equal) functions in the Domain class has minor incorrectness #153

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
In the Domain class, those functions seem to be (slightly) incorrectly defined:

    /**
     * @brief Tests if one value is less than another to within minDelta
     */
    inline bool lt(edouble a, edouble b) const { return a != PLUS_INFINITY && b != MINUS_INFINITY && (a + minDelta() <= b); }

    /**
     * @brief Tests if one value is less than or equal to another to within minDelta
     */
    inline bool leq(edouble a, edouble b) const { return a == b || (a - minDelta() < b); }

Expected definition:
1. In lt() we should change "<=" to "<" as in changing "(a + minDelta() <= b)" 
to "a + minDelta() < b"

2. In leq() should change: "a == b || (a - minDelta() < b)"; to either "eq(a,b) 
|| lt(a,b)" or "a - minDelta() <= b"
(NOTE: the condition: "(a - minDelta() < b)" is incorrect -- see the lt() 
definition above --  and "a == b" is not the same with eq(a,b) due to the 
minDelta epsilon check)

Original issue reported on code.google.com by minh...@gmail.com on 8 Jun 2012 at 9:37