From acf8c35803ceece02b9494944b3d42fb7021c06c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Fern=C3=A1ndez=20Cervell?= Date: Sat, 6 Jun 2026 22:13:15 +0200 Subject: [PATCH 1/8] Refactor TracePath to return a struct with relevant data --- src/solvers/logit/efglogit.cc | 10 ++++++-- src/solvers/logit/nfglogit.cc | 10 ++++++-- src/solvers/logit/path.cc | 10 +++++--- src/solvers/logit/path.h | 10 +++++++- src/tools/logit/logit.cc | 48 ++++++++++++++++++++++++++++++----- 5 files changed, 72 insertions(+), 16 deletions(-) diff --git a/src/solvers/logit/efglogit.cc b/src/solvers/logit/efglogit.cc index 536677c895..172a22f436 100644 --- a/src/solvers/logit/efglogit.cc +++ b/src/solvers/logit/efglogit.cc @@ -326,7 +326,7 @@ LogitBehaviorSolve(const LogitQREMixedBehaviorProfile &p_start, double p_regret, Vector x(ProfileToPoint(p_start)); TracingCallbackFunction callback(game, p_observer); EquationSystem system(game); - tracer.TracePath( + TracePathResult result = tracer.TracePath( [&system](const Vector &p_point, Vector &p_lhs) { system.GetValue(p_point, p_lhs); }, @@ -338,6 +338,9 @@ LogitBehaviorSolve(const LogitQREMixedBehaviorProfile &p_start, double p_regret, return RegretTerminationFunction(game, p_point, p_regret); }, [&callback](const Vector &p_point) -> void { callback.AppendPoint(p_point); }); + if (!result.status) { + return {}; + } return callback.GetProfiles(); } @@ -357,7 +360,7 @@ LogitBehaviorSolveLambda(const LogitQREMixedBehaviorProfile &p_start, EquationSystem system(game); std::list ret; for (auto lam : p_targetLambda) { - tracer.TracePath( + TracePathResult result = tracer.TracePath( [&system](const Vector &p_point, Vector &p_lhs) { system.GetValue(p_point, p_lhs); }, @@ -369,6 +372,9 @@ LogitBehaviorSolveLambda(const LogitQREMixedBehaviorProfile &p_start, [lam](const Vector &x, const Vector &) -> double { return x.back() - lam; }); + if (!result.status) { + return {}; + } ret.push_back(callback.GetProfiles().back()); } return ret; diff --git a/src/solvers/logit/nfglogit.cc b/src/solvers/logit/nfglogit.cc index 0187887bd6..f17ff85848 100644 --- a/src/solvers/logit/nfglogit.cc +++ b/src/solvers/logit/nfglogit.cc @@ -364,7 +364,7 @@ LogitStrategySolve(const LogitQREMixedStrategyProfile &p_start, double p_regret, Vector x(ProfileToPoint(p_start)); TracingCallbackFunction callback(game, p_observer); EquationSystem system(game); - tracer.TracePath( + TracePathResult result = tracer.TracePath( [&system](const Vector &p_point, Vector &p_lhs) { system.GetValue(p_point, p_lhs); }, @@ -376,6 +376,9 @@ LogitStrategySolve(const LogitQREMixedStrategyProfile &p_start, double p_regret, return RegretTerminationFunction(p_start.GetGame(), p_point, p_regret); }, [&callback](const Vector &p_point) -> void { callback.AppendPoint(p_point); }); + if (!result.status) { + return {}; + } return callback.GetProfiles(); } @@ -395,7 +398,7 @@ LogitStrategySolveLambda(const LogitQREMixedStrategyProfile &p_start, std::list ret; EquationSystem system(game); for (auto lam : p_targetLambda) { - tracer.TracePath( + TracePathResult result = tracer.TracePath( [&system](const Vector &p_point, Vector &p_lhs) { system.GetValue(p_point, p_lhs); }, @@ -408,6 +411,9 @@ LogitStrategySolveLambda(const LogitQREMixedStrategyProfile &p_start, return x.back() - lam; }); ret.push_back(callback.GetProfiles().back()); + if (!result.status) { + return {}; + } } return ret; } diff --git a/src/solvers/logit/path.cc b/src/solvers/logit/path.cc index 2541ec51f7..46722ea303 100644 --- a/src/solvers/logit/path.cc +++ b/src/solvers/logit/path.cc @@ -125,7 +125,7 @@ void NewtonStep(Matrix &q, Matrix &b, Vector &u, Vector< // bifurcation point that the tracing gets stuck there as it is not possible // to find a small enough step size to avoid stepping over the bifurcation // point. -void PathTracer::TracePath( +TracePathResult PathTracer::TracePath( std::function &, Vector &)> p_function, std::function &, Matrix &)> p_jacobian, Vector &x, double &p_omega, TerminationFunctionType p_terminate, CallbackFunctionType p_callback, @@ -152,6 +152,7 @@ void PathTracer::TracePath( Matrix b(x.size(), x.size() - 1); Matrix q(x.size(), x.size()); + // Obtain the tangent at the initial point p_jacobian(x, b); QRDecomp(b, q); q.GetRow(q.NumRows(), t); @@ -161,7 +162,7 @@ void PathTracer::TracePath( bool accept = true; if (fabs(h) <= c_hmin) { - return; + return {x.back(), x, false, "Stepsize fell below minimum threshold."}; } // Predictor step @@ -204,7 +205,7 @@ void PathTracer::TracePath( disto = dist; iter++; if (iter > c_maxIter) { - return; + return {x.back(), x, false, "Maximum iterations exceeded."}; } } @@ -226,7 +227,7 @@ void PathTracer::TracePath( if (!accept) { h /= m_maxDecel; // PC not accepted; change stepsize and retry if (fabs(h) <= c_hmin) { - return; + return {x.back(), x, false, "Stepsize fell below minimum threshold."}; } continue; } @@ -268,6 +269,7 @@ void PathTracer::TracePath( } } } + return {x.back(), x, true, "Path tracing terminated successfully."}; } } // end namespace Gambit diff --git a/src/solvers/logit/path.h b/src/solvers/logit/path.h index 3951539f26..36226f1798 100644 --- a/src/solvers/logit/path.h +++ b/src/solvers/logit/path.h @@ -58,6 +58,14 @@ using CallbackFunctionType = std::function &)>; inline void NullCallbackFunction(const Vector &) {} +struct TracePathResult { + double final_parameter_value; + Vector final_point; + bool status; // true if path tracing terminated successfully, false if it terminated due to error + std::string message; // error message if status is false + +}; + // // This class implements a generic path-following algorithm for smooth curves. // It is based on the ideas and codes presented in Allgower and Georg's @@ -74,7 +82,7 @@ class PathTracer { void SetStepsize(double p_hStart) { m_hStart = p_hStart; } double GetStepsize() const { return m_hStart; } - void + TracePathResult TracePath(std::function &, Vector &)> p_function, std::function &, Matrix &)> p_jacobian, Vector &p_x, double &p_omega, TerminationFunctionType p_terminate, diff --git a/src/tools/logit/logit.cc b/src/tools/logit/logit.cc index a10fbebd2d..48ffb6b9fd 100644 --- a/src/tools/logit/logit.cc +++ b/src/tools/logit/logit.cc @@ -199,7 +199,6 @@ int main(int argc, char *argv[]) MixedStrategyProfile frequencies(game->NewMixedStrategyProfile(0.0)); std::ifstream mleData(mleFile.c_str()); ReadProfile(mleData, frequencies); - auto printer = [fullGraph, decimals](const LogitQREMixedStrategyProfile &p) { if (fullGraph) { PrintProfile(std::cout, decimals, p); @@ -212,7 +211,11 @@ int main(int argc, char *argv[]) } if (!game->IsTree() || useStrategic) { - auto printer = [fullGraph, decimals](const LogitQREMixedStrategyProfile &p) { + LogitQREMixedStrategyProfile last_profile(game); + bool valid = false; + auto printer = [&last_profile, &valid, fullGraph, decimals](const LogitQREMixedStrategyProfile &p) { + last_profile = p; + valid = true; if (fullGraph) { PrintProfile(std::cout, decimals, p); } @@ -221,17 +224,34 @@ int main(int argc, char *argv[]) if (!targetLambda.empty()) { auto result = LogitStrategySolveLambda(start, targetLambda, 1.0, hStart, maxDecel, printer); + if (result.empty()) { + if(valid){ + std::cout << "Warning: Path tracing terminated due to error before reaching target lambda values. Last valid profile:\n"; + PrintProfile(std::cout, decimals, last_profile, false); + } + } for (auto &profile : result) { - PrintProfile(std::cout, decimals, profile); + PrintProfile(std::cout, decimals, profile); } - } + } else { auto result = LogitStrategySolve(start, maxregret, 1.0, hStart, maxDecel, printer); - PrintProfile(std::cout, decimals, result.back(), true); + if (result.empty()) { + if(valid){ + std::cout << "Warning: Path tracing terminated due to error before reaching target lambda values. Last valid profile:\n"; + PrintProfile(std::cout, decimals, last_profile, false); + } + } else{ + PrintProfile(std::cout, decimals, result.back(), true); + } } } else { - auto printer = [fullGraph, decimals](const LogitQREMixedBehaviorProfile &p) { + LogitQREMixedBehaviorProfile last_profile(game); + bool valid = false; + auto printer = [&last_profile, &valid, fullGraph, decimals](const LogitQREMixedBehaviorProfile &p) { + last_profile = p; + valid = true; if (fullGraph) { PrintProfile(std::cout, decimals, p); } @@ -240,13 +260,27 @@ int main(int argc, char *argv[]) if (!targetLambda.empty()) { auto result = LogitBehaviorSolveLambda(start, targetLambda, 1.0, hStart, maxDecel, printer); + if (result.empty()) { + if(valid){ + std::cout << "Warning: Path tracing terminated due to error before reaching target lambda values. Last valid profile:\n"; + PrintProfile(std::cout, decimals, last_profile, false); + } + } for (auto &profile : result) { PrintProfile(std::cout, decimals, profile); } } else { auto result = LogitBehaviorSolve(start, maxregret, 1.0, hStart, maxDecel, printer); - PrintProfile(std::cout, decimals, result.back(), true); + if (result.empty()) { + if(valid){ + std::cout << "Warning: Path tracing terminated due to error before reaching target lambda values. Last valid profile:\n"; + PrintProfile(std::cout, decimals, last_profile, false); + } + } + else{ + PrintProfile(std::cout, decimals, result.back(), true); + } } } return 0; From 29acee558993286e58b1017bca6919e722fb6f96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Fern=C3=A1ndez=20Cervell?= Date: Sat, 6 Jun 2026 22:41:04 +0200 Subject: [PATCH 2/8] style: apply clang-format to fix CI formatting checks --- src/solvers/logit/path.cc | 11 ++++++----- src/solvers/logit/path.h | 3 +-- src/tools/logit/logit.cc | 35 +++++++++++++++++++++-------------- 3 files changed, 28 insertions(+), 21 deletions(-) diff --git a/src/solvers/logit/path.cc b/src/solvers/logit/path.cc index 46722ea303..3e15d3b36f 100644 --- a/src/solvers/logit/path.cc +++ b/src/solvers/logit/path.cc @@ -125,11 +125,12 @@ void NewtonStep(Matrix &q, Matrix &b, Vector &u, Vector< // bifurcation point that the tracing gets stuck there as it is not possible // to find a small enough step size to avoid stepping over the bifurcation // point. -TracePathResult PathTracer::TracePath( - std::function &, Vector &)> p_function, - std::function &, Matrix &)> p_jacobian, Vector &x, - double &p_omega, TerminationFunctionType p_terminate, CallbackFunctionType p_callback, - CriterionFunctionType p_criterion, CriterionBracketFunctionType p_criterionBracket) const +TracePathResult +PathTracer::TracePath(std::function &, Vector &)> p_function, + std::function &, Matrix &)> p_jacobian, + Vector &x, double &p_omega, TerminationFunctionType p_terminate, + CallbackFunctionType p_callback, CriterionFunctionType p_criterion, + CriterionBracketFunctionType p_criterionBracket) const { const double c_tol = 1.0e-4; // tolerance for corrector iteration const double c_maxDist = 0.4; // maximal distance to curve diff --git a/src/solvers/logit/path.h b/src/solvers/logit/path.h index 36226f1798..42e886cfab 100644 --- a/src/solvers/logit/path.h +++ b/src/solvers/logit/path.h @@ -61,9 +61,8 @@ inline void NullCallbackFunction(const Vector &) {} struct TracePathResult { double final_parameter_value; Vector final_point; - bool status; // true if path tracing terminated successfully, false if it terminated due to error + bool status; // true if path tracing terminated successfully, false if it terminated due to error std::string message; // error message if status is false - }; // diff --git a/src/tools/logit/logit.cc b/src/tools/logit/logit.cc index 48ffb6b9fd..794bfbc2a8 100644 --- a/src/tools/logit/logit.cc +++ b/src/tools/logit/logit.cc @@ -213,7 +213,8 @@ int main(int argc, char *argv[]) if (!game->IsTree() || useStrategic) { LogitQREMixedStrategyProfile last_profile(game); bool valid = false; - auto printer = [&last_profile, &valid, fullGraph, decimals](const LogitQREMixedStrategyProfile &p) { + auto printer = [&last_profile, &valid, fullGraph, + decimals](const LogitQREMixedStrategyProfile &p) { last_profile = p; valid = true; if (fullGraph) { @@ -225,23 +226,26 @@ int main(int argc, char *argv[]) auto result = LogitStrategySolveLambda(start, targetLambda, 1.0, hStart, maxDecel, printer); if (result.empty()) { - if(valid){ - std::cout << "Warning: Path tracing terminated due to error before reaching target lambda values. Last valid profile:\n"; + if (valid) { + std::cout << "Warning: Path tracing terminated due to error before reaching target " + "lambda values. Last valid profile:\n"; PrintProfile(std::cout, decimals, last_profile, false); } } for (auto &profile : result) { - PrintProfile(std::cout, decimals, profile); + PrintProfile(std::cout, decimals, profile); } - } + } else { auto result = LogitStrategySolve(start, maxregret, 1.0, hStart, maxDecel, printer); if (result.empty()) { - if(valid){ - std::cout << "Warning: Path tracing terminated due to error before reaching target lambda values. Last valid profile:\n"; + if (valid) { + std::cout << "Warning: Path tracing terminated due to error before reaching target " + "lambda values. Last valid profile:\n"; PrintProfile(std::cout, decimals, last_profile, false); } - } else{ + } + else { PrintProfile(std::cout, decimals, result.back(), true); } } @@ -249,7 +253,8 @@ int main(int argc, char *argv[]) else { LogitQREMixedBehaviorProfile last_profile(game); bool valid = false; - auto printer = [&last_profile, &valid, fullGraph, decimals](const LogitQREMixedBehaviorProfile &p) { + auto printer = [&last_profile, &valid, fullGraph, + decimals](const LogitQREMixedBehaviorProfile &p) { last_profile = p; valid = true; if (fullGraph) { @@ -261,8 +266,9 @@ int main(int argc, char *argv[]) auto result = LogitBehaviorSolveLambda(start, targetLambda, 1.0, hStart, maxDecel, printer); if (result.empty()) { - if(valid){ - std::cout << "Warning: Path tracing terminated due to error before reaching target lambda values. Last valid profile:\n"; + if (valid) { + std::cout << "Warning: Path tracing terminated due to error before reaching target " + "lambda values. Last valid profile:\n"; PrintProfile(std::cout, decimals, last_profile, false); } } @@ -273,12 +279,13 @@ int main(int argc, char *argv[]) else { auto result = LogitBehaviorSolve(start, maxregret, 1.0, hStart, maxDecel, printer); if (result.empty()) { - if(valid){ - std::cout << "Warning: Path tracing terminated due to error before reaching target lambda values. Last valid profile:\n"; + if (valid) { + std::cout << "Warning: Path tracing terminated due to error before reaching target " + "lambda values. Last valid profile:\n"; PrintProfile(std::cout, decimals, last_profile, false); } } - else{ + else { PrintProfile(std::cout, decimals, result.back(), true); } } From 0422fed5e293de9db301d2ed2631d4a5f5886a5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Fern=C3=A1ndez=20Cervell?= Date: Sat, 6 Jun 2026 22:42:57 +0200 Subject: [PATCH 3/8] style --- src/solvers/logit/nfglogit.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/solvers/logit/nfglogit.cc b/src/solvers/logit/nfglogit.cc index f17ff85848..7b1c8c415b 100644 --- a/src/solvers/logit/nfglogit.cc +++ b/src/solvers/logit/nfglogit.cc @@ -412,8 +412,8 @@ LogitStrategySolveLambda(const LogitQREMixedStrategyProfile &p_start, }); ret.push_back(callback.GetProfiles().back()); if (!result.status) { - return {}; - } + return {}; + } } return ret; } From 156d03af08abd2327833c83f5ccdfdba9ffc9d80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Fern=C3=A1ndez=20Cervell?= Date: Sun, 7 Jun 2026 21:28:23 +0200 Subject: [PATCH 4/8] style and API --- src/solvers/logit/efglogit.cc | 12 +++----- src/solvers/logit/nfglogit.cc | 10 ++----- src/tools/logit/logit.cc | 53 ++++------------------------------- 3 files changed, 12 insertions(+), 63 deletions(-) diff --git a/src/solvers/logit/efglogit.cc b/src/solvers/logit/efglogit.cc index 172a22f436..05a42215a9 100644 --- a/src/solvers/logit/efglogit.cc +++ b/src/solvers/logit/efglogit.cc @@ -326,7 +326,7 @@ LogitBehaviorSolve(const LogitQREMixedBehaviorProfile &p_start, double p_regret, Vector x(ProfileToPoint(p_start)); TracingCallbackFunction callback(game, p_observer); EquationSystem system(game); - TracePathResult result = tracer.TracePath( + tracer.TracePath( [&system](const Vector &p_point, Vector &p_lhs) { system.GetValue(p_point, p_lhs); }, @@ -338,9 +338,7 @@ LogitBehaviorSolve(const LogitQREMixedBehaviorProfile &p_start, double p_regret, return RegretTerminationFunction(game, p_point, p_regret); }, [&callback](const Vector &p_point) -> void { callback.AppendPoint(p_point); }); - if (!result.status) { - return {}; - } + return callback.GetProfiles(); } @@ -360,7 +358,7 @@ LogitBehaviorSolveLambda(const LogitQREMixedBehaviorProfile &p_start, EquationSystem system(game); std::list ret; for (auto lam : p_targetLambda) { - TracePathResult result = tracer.TracePath( + tracer.TracePath( [&system](const Vector &p_point, Vector &p_lhs) { system.GetValue(p_point, p_lhs); }, @@ -372,9 +370,7 @@ LogitBehaviorSolveLambda(const LogitQREMixedBehaviorProfile &p_start, [lam](const Vector &x, const Vector &) -> double { return x.back() - lam; }); - if (!result.status) { - return {}; - } + ret.push_back(callback.GetProfiles().back()); } return ret; diff --git a/src/solvers/logit/nfglogit.cc b/src/solvers/logit/nfglogit.cc index 7b1c8c415b..0187887bd6 100644 --- a/src/solvers/logit/nfglogit.cc +++ b/src/solvers/logit/nfglogit.cc @@ -364,7 +364,7 @@ LogitStrategySolve(const LogitQREMixedStrategyProfile &p_start, double p_regret, Vector x(ProfileToPoint(p_start)); TracingCallbackFunction callback(game, p_observer); EquationSystem system(game); - TracePathResult result = tracer.TracePath( + tracer.TracePath( [&system](const Vector &p_point, Vector &p_lhs) { system.GetValue(p_point, p_lhs); }, @@ -376,9 +376,6 @@ LogitStrategySolve(const LogitQREMixedStrategyProfile &p_start, double p_regret, return RegretTerminationFunction(p_start.GetGame(), p_point, p_regret); }, [&callback](const Vector &p_point) -> void { callback.AppendPoint(p_point); }); - if (!result.status) { - return {}; - } return callback.GetProfiles(); } @@ -398,7 +395,7 @@ LogitStrategySolveLambda(const LogitQREMixedStrategyProfile &p_start, std::list ret; EquationSystem system(game); for (auto lam : p_targetLambda) { - TracePathResult result = tracer.TracePath( + tracer.TracePath( [&system](const Vector &p_point, Vector &p_lhs) { system.GetValue(p_point, p_lhs); }, @@ -411,9 +408,6 @@ LogitStrategySolveLambda(const LogitQREMixedStrategyProfile &p_start, return x.back() - lam; }); ret.push_back(callback.GetProfiles().back()); - if (!result.status) { - return {}; - } } return ret; } diff --git a/src/tools/logit/logit.cc b/src/tools/logit/logit.cc index 794bfbc2a8..31317926a1 100644 --- a/src/tools/logit/logit.cc +++ b/src/tools/logit/logit.cc @@ -199,6 +199,7 @@ int main(int argc, char *argv[]) MixedStrategyProfile frequencies(game->NewMixedStrategyProfile(0.0)); std::ifstream mleData(mleFile.c_str()); ReadProfile(mleData, frequencies); + auto printer = [fullGraph, decimals](const LogitQREMixedStrategyProfile &p) { if (fullGraph) { PrintProfile(std::cout, decimals, p); @@ -211,12 +212,7 @@ int main(int argc, char *argv[]) } if (!game->IsTree() || useStrategic) { - LogitQREMixedStrategyProfile last_profile(game); - bool valid = false; - auto printer = [&last_profile, &valid, fullGraph, - decimals](const LogitQREMixedStrategyProfile &p) { - last_profile = p; - valid = true; + auto printer = [fullGraph, decimals](const LogitQREMixedStrategyProfile &p) { if (fullGraph) { PrintProfile(std::cout, decimals, p); } @@ -225,38 +221,17 @@ int main(int argc, char *argv[]) if (!targetLambda.empty()) { auto result = LogitStrategySolveLambda(start, targetLambda, 1.0, hStart, maxDecel, printer); - if (result.empty()) { - if (valid) { - std::cout << "Warning: Path tracing terminated due to error before reaching target " - "lambda values. Last valid profile:\n"; - PrintProfile(std::cout, decimals, last_profile, false); - } - } for (auto &profile : result) { PrintProfile(std::cout, decimals, profile); } } else { auto result = LogitStrategySolve(start, maxregret, 1.0, hStart, maxDecel, printer); - if (result.empty()) { - if (valid) { - std::cout << "Warning: Path tracing terminated due to error before reaching target " - "lambda values. Last valid profile:\n"; - PrintProfile(std::cout, decimals, last_profile, false); - } - } - else { - PrintProfile(std::cout, decimals, result.back(), true); - } + PrintProfile(std::cout, decimals, result.back(), true); } } else { - LogitQREMixedBehaviorProfile last_profile(game); - bool valid = false; - auto printer = [&last_profile, &valid, fullGraph, - decimals](const LogitQREMixedBehaviorProfile &p) { - last_profile = p; - valid = true; + auto printer = [fullGraph, decimals](const LogitQREMixedBehaviorProfile &p) { if (fullGraph) { PrintProfile(std::cout, decimals, p); } @@ -265,29 +240,13 @@ int main(int argc, char *argv[]) if (!targetLambda.empty()) { auto result = LogitBehaviorSolveLambda(start, targetLambda, 1.0, hStart, maxDecel, printer); - if (result.empty()) { - if (valid) { - std::cout << "Warning: Path tracing terminated due to error before reaching target " - "lambda values. Last valid profile:\n"; - PrintProfile(std::cout, decimals, last_profile, false); - } - } for (auto &profile : result) { PrintProfile(std::cout, decimals, profile); } } else { auto result = LogitBehaviorSolve(start, maxregret, 1.0, hStart, maxDecel, printer); - if (result.empty()) { - if (valid) { - std::cout << "Warning: Path tracing terminated due to error before reaching target " - "lambda values. Last valid profile:\n"; - PrintProfile(std::cout, decimals, last_profile, false); - } - } - else { - PrintProfile(std::cout, decimals, result.back(), true); - } + PrintProfile(std::cout, decimals, result.back(), true); } } return 0; @@ -296,4 +255,4 @@ int main(int argc, char *argv[]) std::cerr << "Error: " << e.what() << std::endl; return 1; } -} +} \ No newline at end of file From b9b5dd01d88a420cc832d26a35b524e29cdddb4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Fern=C3=A1ndez=20Cervell?= Date: Sat, 20 Jun 2026 22:41:55 +0200 Subject: [PATCH 5/8] remove final_parameter_value from TracePathResult and format corrections --- src/solvers/logit/path.cc | 9 ++++----- src/solvers/logit/path.h | 1 - 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/solvers/logit/path.cc b/src/solvers/logit/path.cc index 3e15d3b36f..267d8f9148 100644 --- a/src/solvers/logit/path.cc +++ b/src/solvers/logit/path.cc @@ -153,7 +153,6 @@ PathTracer::TracePath(std::function &, Vector Matrix b(x.size(), x.size() - 1); Matrix q(x.size(), x.size()); - // Obtain the tangent at the initial point p_jacobian(x, b); QRDecomp(b, q); q.GetRow(q.NumRows(), t); @@ -163,7 +162,7 @@ PathTracer::TracePath(std::function &, Vector bool accept = true; if (fabs(h) <= c_hmin) { - return {x.back(), x, false, "Stepsize fell below minimum threshold."}; + return {x, false, "Stepsize fell below minimum threshold."}; } // Predictor step @@ -206,7 +205,7 @@ PathTracer::TracePath(std::function &, Vector disto = dist; iter++; if (iter > c_maxIter) { - return {x.back(), x, false, "Maximum iterations exceeded."}; + return {x, false, "Maximum iterations exceeded."}; } } @@ -228,7 +227,7 @@ PathTracer::TracePath(std::function &, Vector if (!accept) { h /= m_maxDecel; // PC not accepted; change stepsize and retry if (fabs(h) <= c_hmin) { - return {x.back(), x, false, "Stepsize fell below minimum threshold."}; + return {x, false, "Stepsize fell below minimum threshold."}; } continue; } @@ -270,7 +269,7 @@ PathTracer::TracePath(std::function &, Vector } } } - return {x.back(), x, true, "Path tracing terminated successfully."}; + return {x, true, "Path tracing terminated successfully."}; } } // end namespace Gambit diff --git a/src/solvers/logit/path.h b/src/solvers/logit/path.h index 42e886cfab..655194e42a 100644 --- a/src/solvers/logit/path.h +++ b/src/solvers/logit/path.h @@ -59,7 +59,6 @@ using CallbackFunctionType = std::function &)>; inline void NullCallbackFunction(const Vector &) {} struct TracePathResult { - double final_parameter_value; Vector final_point; bool status; // true if path tracing terminated successfully, false if it terminated due to error std::string message; // error message if status is false From 8b1f3aedacf97bba78dfaeb26a77d6d9d798a4bc Mon Sep 17 00:00:00 2001 From: Ted Turocy Date: Wed, 24 Jun 2026 08:38:09 +0100 Subject: [PATCH 6/8] Update efglogit.cc --- src/solvers/logit/efglogit.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/solvers/logit/efglogit.cc b/src/solvers/logit/efglogit.cc index 52f25467ba..011b9a45f7 100644 --- a/src/solvers/logit/efglogit.cc +++ b/src/solvers/logit/efglogit.cc @@ -340,7 +340,6 @@ LogitBehaviorSolve(const LogitQREMixedBehaviorProfile &p_start, double p_regret, return RegretTerminationFunction(game, p_point, p_regret); }, [&callback](const Vector &p_point) -> void { callback.AppendPoint(p_point); }); - return callback.GetProfiles(); } From f48a1cfcc506161bc24e6798d456ef1c9d64f680 Mon Sep 17 00:00:00 2001 From: Ted Turocy Date: Wed, 24 Jun 2026 08:38:41 +0100 Subject: [PATCH 7/8] Update efglogit.cc --- src/solvers/logit/efglogit.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/solvers/logit/efglogit.cc b/src/solvers/logit/efglogit.cc index 011b9a45f7..cae2f769d6 100644 --- a/src/solvers/logit/efglogit.cc +++ b/src/solvers/logit/efglogit.cc @@ -374,7 +374,6 @@ LogitBehaviorSolveLambda(const LogitQREMixedBehaviorProfile &p_start, [lam](const Vector &x, const Vector &) -> double { return x.back() - lam; }); - ret.push_back(callback.GetProfiles().back()); } return ret; From 7fd8af4b7ec48a8266524e50c1b87ff1a9411392 Mon Sep 17 00:00:00 2001 From: Ted Turocy Date: Wed, 24 Jun 2026 08:39:14 +0100 Subject: [PATCH 8/8] Update logit.cc --- src/tools/logit/logit.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/logit/logit.cc b/src/tools/logit/logit.cc index 31317926a1..a10fbebd2d 100644 --- a/src/tools/logit/logit.cc +++ b/src/tools/logit/logit.cc @@ -255,4 +255,4 @@ int main(int argc, char *argv[]) std::cerr << "Error: " << e.what() << std::endl; return 1; } -} \ No newline at end of file +}