lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 53a5817 1/6: Simplify logic


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 53a5817 1/6: Simplify logic
Date: Wed, 8 Jul 2020 20:18:27 -0400 (EDT)

branch: master
commit 53a58172f6d5875a47a2ffee80545f449319e6f0
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Simplify logic
    
    The survival limit is a single choice from four elements. For reports,
    it's translated to three booleans, one for every choice except the
    default (no limit). To ascertain the choice for a composite, there is
    no more reasonable method than to pick the last cell's choice. AND-ing
    the booleans was a complicated way of achieving the same result.
    
    How should an (integer) age or duration limit be composited? Arguments
    could be made for using the highest, or the lowest, but both are wrong
    from some point of view, and both introduce the possibility of anomalies
    (age 70, dying at age 60, e.g.; or age 80, dying at duration 50, on a
    product that matures at age 100). Picking the last cell's value is
    simple and robust.
---
 ledger_invariant.cpp | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/ledger_invariant.cpp b/ledger_invariant.cpp
index ada6098..91f8e62 100644
--- a/ledger_invariant.cpp
+++ b/ledger_invariant.cpp
@@ -501,9 +501,9 @@ void LedgerInvariant::Init()
     EndtAge                    = 100;
     NoLongerIssued             = false;
     AllowGroupQuote            = true;
-    SurviveToExpectancy        = true;
-    SurviveToYear              = true;
-    SurviveToAge               = true;
+    SurviveToExpectancy        = false;
+    SurviveToYear              = false;
+    SurviveToAge               = false;
     SurvivalMaxYear            = 0;
     SurvivalMaxAge             = 0;
     InforceYear                = Length;
@@ -674,12 +674,11 @@ LedgerInvariant& LedgerInvariant::PlusEq(LedgerInvariant 
const& a_Addend)
     UseExperienceRating        = UseExperienceRating   || 
a_Addend.UseExperienceRating;
     UsePartialMort             = a_Addend.UsePartialMort;
 
-    SurviveToExpectancy        = SurviveToExpectancy   && 
a_Addend.SurviveToExpectancy;
-    SurviveToYear              = SurviveToYear         && 
a_Addend.SurviveToYear;
-    SurviveToAge               = SurviveToAge          && 
a_Addend.SurviveToAge;
-    LMI_ASSERT(SurviveToExpectancy + SurviveToYear + SurviveToAge <= 1);
-    SurvivalMaxYear            = std::max(SurvivalMaxYear, 
a_Addend.SurvivalMaxYear);
-    SurvivalMaxAge             = std::max(SurvivalMaxAge , 
a_Addend.SurvivalMaxAge);
+    SurviveToExpectancy        = a_Addend.SurviveToExpectancy;
+    SurviveToYear              = a_Addend.SurviveToYear;
+    SurviveToAge               = a_Addend.SurviveToAge;
+    SurvivalMaxYear            = a_Addend.SurvivalMaxYear;
+    SurvivalMaxAge             = a_Addend.SurvivalMaxAge;
 
     AvgFund                    = a_Addend.AvgFund;
     CustomFund                 = a_Addend.CustomFund;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]