Skip to content

Refactor TracePath to return a struct with relevant data#935

Open
AndresFerCervell wants to merge 4 commits into
gambitproject:masterfrom
AndresFerCervell:tracepath-return-value
Open

Refactor TracePath to return a struct with relevant data#935
AndresFerCervell wants to merge 4 commits into
gambitproject:masterfrom
AndresFerCervell:tracepath-return-value

Conversation

@AndresFerCervell

@AndresFerCervell AndresFerCervell commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Issues closed by this PR

None. Related to #492 and #876

Description of the changes in this PR

This PR adds a return structure in TracePath (src/solvers/logit/path.[cc/h]).
The struct has the following fields:

  • Final parameter value (“lambda” in our terminology)
  • Final vector (as represented in TracePath)
  • Status
  • Message (for the human-readable explanation)

I intended to pass that error upstream by returning an empty list in nfglogit and efglogit. However, it raises an exception in the Python API, so I have decided to remove it for now.

Therefore, this PR does not solve the problem of warning the user about not having found NE, but it keeps the struct that will be of use in the future.

If it is a priority to warn the C++ users when the NE is not found, a check could be easily implemented in logit.cc. Otherwise, I would wait until path.cc is abstracted to make all the changes together in Python too.

Suggestions are welcome!

How to review this PR

-Review the TracePathResult struct definition in path.h and the updated return statements in path.cc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant