[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] odd/solve_limits 5c6aa42c: Experiment with solve bou
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] odd/solve_limits 5c6aa42c: Experiment with solve bounds |
Date: |
Mon, 29 Aug 2022 16:35:53 -0400 (EDT) |
branch: odd/solve_limits
commit 5c6aa42ca6872af8601f144efdb62255237616fc
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Experiment with solve bounds
This is potentially useful, but not for the problem at hand.
---
ihs_avsolve.cpp | 30 ++++++++++++++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)
diff --git a/ihs_avsolve.cpp b/ihs_avsolve.cpp
index e609c3dd..85b95d27 100644
--- a/ihs_avsolve.cpp
+++ b/ihs_avsolve.cpp
@@ -39,6 +39,7 @@
#include "ledger_variant.hpp"
#include "mc_enum_types_aux.hpp" // set_run_basis_from_cloven_bases()
#include "miscellany.hpp" // ios_out_app_binary()
+#include "name_value_pairs.hpp"
#include "null_stream.hpp"
#include "outlay.hpp"
#include "zero.hpp" // decimal_root()
@@ -391,9 +392,9 @@ currency AccountValue::Solve
// introduces new opportunities for mistkaes.
//
// Solve results are constrained to be nonnegative.
- double const lower_bound = 0.0;
+ double lower_bound = 0.0;
// No amount solved for can plausibly reach one billion dollars.
- double const upper_bound = 999999999.99;
+ double upper_bound = 999999999.99;
root_bias bias =
mce_solve_for_tax_basis == SolveTarget_
@@ -478,6 +479,31 @@ currency AccountValue::Solve
os_trace << std::fixed << std::setprecision(std::max(2, decimals));
}
+ if(contains(global_settings::instance().pyx(), "solve_bounds"))
+ {
+ // Create a file named "solve_bounds.nvp" in the directory
+ // where lmi is installed (probably /opt/lmi/bin/). Manually
+ // edit it to contain lines like the "lower" and "upper"
+ // lines here:
+#if 0
+lower=8000
+upper=9000
+#endif // 0
+ // without extraneous characters like commas or quotes. Then
+ // run with ' --pyx=solve_bounds'.
+ //
+ // The file can be changed even while lmi is running; changes
+ // will take effect the next time a solve is requested, even
+ // for a currently-open input file.
+ //
+ // Don't combine this with regression testing.
+ LMI_ASSERT(!global_settings::instance().regression_testing());
+ name_value_pairs nv_pairs("solve_bounds.nvp");
+ lower_bound = nv_pairs.numeric_value("lower");
+ upper_bound = nv_pairs.numeric_value("upper");
+// warning() << "bounds: [" << lower_bound << ", " << upper_bound << "]"
<< LMI_FLUSH;
+ }
+
SolveHelper solve_helper(*this, solve_set_fn);
root_type const solution = decimal_root
(solve_helper