[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 9537a20 2/2: Add ledger variables for reporti
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 9537a20 2/2: Add ledger variables for reporting survival limits |
Date: |
Sun, 12 Apr 2020 18:20:01 -0400 (EDT) |
branch: master
commit 9537a20d6f2498a6cf11bfffef436cfb310eecda
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Add ledger variables for reporting survival limits
---
ledger_evaluator.cpp | 5 +++++
ledger_invariant.cpp | 20 ++++++++++++++++++++
ledger_invariant.hpp | 5 +++++
ledger_invariant_init.cpp | 20 ++++++++++++++++++++
4 files changed, 50 insertions(+)
diff --git a/ledger_evaluator.cpp b/ledger_evaluator.cpp
index 00bf4e3..60958c5 100644
--- a/ledger_evaluator.cpp
+++ b/ledger_evaluator.cpp
@@ -535,6 +535,11 @@ format_map_t static_formats()
,{"SplitMinPrem" , f1}
,{"SpouseIssueAge" , f1}
,{"SupplementalReport" , f1}
+ ,{"SurvivalMaxAge" , f1}
+ ,{"SurvivalMaxYear" , f1}
+ ,{"SurviveToAge" , f1}
+ ,{"SurviveToExpectancy" , f1}
+ ,{"SurviveToYear" , f1}
,{"TxCallsGuarUwSubstd" , f1}
,{"UseExperienceRating" , f1}
,{"UsePartialMort" , f1}
diff --git a/ledger_invariant.cpp b/ledger_invariant.cpp
index 561c6b4..258c15c 100644
--- a/ledger_invariant.cpp
+++ b/ledger_invariant.cpp
@@ -156,6 +156,13 @@ void LedgerInvariant::Alloc(int len)
OtherScalars ["AllowExperienceRating" ] = &AllowExperienceRating ;
OtherScalars ["UseExperienceRating" ] = &UseExperienceRating ;
OtherScalars ["UsePartialMort" ] = &UsePartialMort ;
+
+ OtherScalars ["SurviveToExpectancy" ] = &SurviveToExpectancy ;
+ OtherScalars ["SurviveToYear" ] = &SurviveToYear ;
+ OtherScalars ["SurviveToAge" ] = &SurviveToAge ;
+ OtherScalars ["SurvivalMaxYear" ] = &SurvivalMaxYear ;
+ OtherScalars ["SurvivalMaxAge" ] = &SurvivalMaxAge ;
+
OtherScalars ["AvgFund" ] = &AvgFund ;
OtherScalars ["CustomFund" ] = &CustomFund ;
OtherScalars ["IsMec" ] = &IsMec ;
@@ -477,6 +484,11 @@ void LedgerInvariant::Init()
EndtAge = 100;
NoLongerIssued = false;
AllowGroupQuote = true;
+ SurviveToExpectancy = true;
+ SurviveToYear = true;
+ SurviveToAge = true;
+ SurvivalMaxYear = 0;
+ SurvivalMaxAge = 0;
InforceYear = Length;
InforceMonth = 11;
MecYear = Length;
@@ -583,6 +595,14 @@ LedgerInvariant& LedgerInvariant::PlusEq(LedgerInvariant
const& a_Addend)
AllowExperienceRating = AllowExperienceRating ||
a_Addend.AllowExperienceRating;
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);
+
AvgFund = a_Addend.AvgFund;
CustomFund = a_Addend.CustomFund;
IsMec = a_Addend.IsMec || IsMec;
diff --git a/ledger_invariant.hpp b/ledger_invariant.hpp
index 2c2218a..0b2d478 100644
--- a/ledger_invariant.hpp
+++ b/ledger_invariant.hpp
@@ -147,6 +147,11 @@ class LMI_SO LedgerInvariant final
double AllowExperienceRating;
double UseExperienceRating;
double UsePartialMort;
+ double SurviveToExpectancy;
+ double SurviveToYear;
+ double SurviveToAge;
+ double SurvivalMaxYear;
+ double SurvivalMaxAge;
double AvgFund;
double CustomFund;
double IsMec;
diff --git a/ledger_invariant_init.cpp b/ledger_invariant_init.cpp
index e6d7e9e..6e421d0 100644
--- a/ledger_invariant_init.cpp
+++ b/ledger_invariant_init.cpp
@@ -263,6 +263,26 @@ void LedgerInvariant::Init(BasicValues const* b)
AllowExperienceRating = b->database().query<bool>(DB_AllowExpRating);
UseExperienceRating = b->yare_input_.UseExperienceRating;
UsePartialMort = b->yare_input_.UsePartialMortality;
+
+ SurviveToExpectancy = false;
+ SurviveToYear = false;
+ SurviveToAge = false;
+ switch(b->yare_input_.SurviveToType)
+ {
+ case mce_no_survival_limit: /* do nothing */ ; break;
+ case mce_survive_to_age: SurviveToAge = true; break;
+ case mce_survive_to_year: SurviveToYear = true; break;
+ case mce_survive_to_expectancy: SurviveToExpectancy = true; break;
+ }
+ LMI_ASSERT(SurviveToExpectancy + SurviveToYear + SurviveToAge <= 1);
+
+ // These aren't constrained to cell-specific max age or duration.
+ // If a composite has two cells, ages 20 and 80, and the input max
+ // duration for the case (and both cells) is 25 years, then the
+ // composite max duration really is 25: it's not limited to 20
+ // because the 80-year-old matures earlier.
+ SurvivalMaxYear = b->yare_input_.SurviveToYear;
+ SurvivalMaxAge = b->yare_input_.SurviveToAge;
AvgFund = b->yare_input_.UseAverageOfAllFunds;
CustomFund = b->yare_input_.OverrideFundManagementFee;