[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 0090fb0 3/6: Refactor for simplicity
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 0090fb0 3/6: Refactor for simplicity |
Date: |
Thu, 24 Jun 2021 20:09:16 -0400 (EDT) |
branch: master
commit 0090fb05ec8c14573d05f6ec50d1f31c2e2d8f0d
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Refactor for simplicity
Removed code that saved and restored a small subset of ledger values
before and after a guaranteed-premium solve. That's a refactoring, in
effect. because the values altered by that solve, whether previously
preserved or not, are immediately discarded--as elaborated comments
now make clear.
---
account_value.hpp | 8 ++++++--
ihs_acctval.cpp | 6 +++++-
ihs_avsolve.cpp | 22 +++++++++++++---------
3 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/account_value.hpp b/account_value.hpp
index 6cd9fda..c61daab 100644
--- a/account_value.hpp
+++ b/account_value.hpp
@@ -126,8 +126,12 @@ class LMI_SO AccountValue final
// We're not yet entirely sure how to handle ledger values. Right now,
// we have pointers to a Ledger and also to its variant and invariant
// parts. We put data into the parts, and then insert the parts into
- // the Ledger. At this moment it seems best to work not through these
- // "parts" but rather through references to components of the Ledger.
+ // the Ledger. It might seem better to work not through these distinct
+ // "parts" but rather through references to components of the Ledger;
+ // however, the present design permits a solve for NAIC illustration
+ // reg guaranteed premium that (as desired) has no side effects--the
+ // ledger "parts" it affects are simply thrown away.
+ //
// While we gather more information and consider this, all access comes
// through the following functions.
LedgerInvariant& InvariantValues();
diff --git a/ihs_acctval.cpp b/ihs_acctval.cpp
index 64de69d..6cf09ea 100644
--- a/ihs_acctval.cpp
+++ b/ihs_acctval.cpp
@@ -541,7 +541,11 @@ void AccountValue::InitializeLife(mcenum_run_basis a_Basis)
);
}
-//============================================================================
+/// Post results to ledger for a single basis.
+///
+/// However, exit early, posting nothing, when performing a solve
+/// for NAIC illustration reg guaranteed premium.
+
void AccountValue::FinalizeLife(mcenum_run_basis a_Basis)
{
LMI_ASSERT(RunBasis_ == a_Basis);
diff --git a/ihs_avsolve.cpp b/ihs_avsolve.cpp
index ed1730b..d74365f 100644
--- a/ihs_avsolve.cpp
+++ b/ihs_avsolve.cpp
@@ -304,14 +304,23 @@ void AccountValue::SolveSetWD(currency a_CandidateValue)
Outlay_->set_withdrawals(a_CandidateValue, SolveBeginYear_, SolveEndYear_);
}
+/// Ascertain guaranteed premium for NAIC illustration reg.
+///
+/// Zero out all payments [not yet], and solve for level ee premium
+/// to keep the contract in force until normal maturity. (It would be
+/// equally good to solve for er premium--the choice is arbitrary.)
+///
+/// This is necessarily the last step in producing an illustration,
+/// so that the guaranteed premium reflects any parameters that have
+/// been adjusted dynamically. It's okay that it overwrites payments
+/// and indeed most other values, because the overwritten values are
+/// not posted to the ledger.
+
currency AccountValue::SolveGuarPremium()
{
- // Store original er premiums for later restoration.
- std::vector<currency> stored = Outlay_->er_modal_premiums();
- // Zero out er premiums and solve for ee premiums only.
Outlay_->set_er_modal_premiums(C0, 0, BasicValues::GetLength());
+ // other payments, like 1035 exchanges, to be zeroed out soon
- bool temp_solving = Solving;
Solving = true;
SolvingForGuarPremium = true;
@@ -327,11 +336,6 @@ currency AccountValue::SolveGuarPremium()
,mce_sep_full
);
- // Restore original values.
- Outlay_->set_er_modal_premiums(stored);
- Solving = temp_solving;
- SolvingForGuarPremium = false;
-
return guar_premium;
}
- [lmi-commits] [lmi] master updated (04379f7 -> 3f71b11), Greg Chicares, 2021/06/24
- [lmi-commits] [lmi] master 131d1a2 2/6: Expunge another disused function, Greg Chicares, 2021/06/24
- [lmi-commits] [lmi] master 1b73f19 1/6: Expunge two disused functions, Greg Chicares, 2021/06/24
- [lmi-commits] [lmi] master 0090fb0 3/6: Refactor for simplicity,
Greg Chicares <=
- [lmi-commits] [lmi] master 3f71b11 6/6: Follow odd NAIC "in force" definition more closely, Greg Chicares, 2021/06/24
- [lmi-commits] [lmi] master be19add 4/6: Block all other payments for guaranteed-premium solves, Greg Chicares, 2021/06/24
- [lmi-commits] [lmi] master d018628 5/6: Do guaranteed-premium solves in first year only [276], Greg Chicares, 2021/06/24