This commit is contained in:
chriseth 2022-02-03 16:26:41 +01:00
parent 592b421f44
commit 8835b95719
2 changed files with 5 additions and 0 deletions

View File

@ -760,6 +760,9 @@ pair<LPResult, map<string, rational>> LPSolver::check(SolvingState _state)
LPResult lpResult; LPResult lpResult;
vector<rational> solution; vector<rational> solution;
// TODO this actually compares including the variable names.
// If we only compare based on coefficients, we will get way more cache hits.
// The downside is that we need to adjust the model.
auto it = m_cache.find(split); auto it = m_cache.find(split);
if (it != m_cache.end()) if (it != m_cache.end())
tie(lpResult, solution) = it->second; tie(lpResult, solution) = it->second;

View File

@ -161,6 +161,8 @@ public:
private: private:
// TODO check if the model is requested in production. If not, we do not need to cache it. // TODO check if the model is requested in production. If not, we do not need to cache it.
// TODO This cache is inefficient because it compares including the variable names.
// See comment in LPSolver::check for details.
std::map<SolvingState, std::pair<LPResult, std::vector<boost::rational<bigint>>>> m_cache; std::map<SolvingState, std::pair<LPResult, std::vector<boost::rational<bigint>>>> m_cache;
}; };