Skip to content

Conversation

@willGraham01
Copy link
Collaborator

TLDR;

  • Creates a SolverResult class that can be used as the output for any methods we implement to solve casual problems.
  • Replaces the return type of the SGD solver method with this class, populating appropriate values.

Why?

A couple of reasons.

The first is that the SGD method was already returning a tuple of 4 values, the order of which was both somewhat arbitrary and going to be a pain to enforce consistently across the codebase if we ever add any more solver methods. Having a simple container object that can store this information for later access is cleaner to return.

The second being that we don't want to rely on throwing errors when one of our solver methods fails to converge (or encounters some other problem), since we may want to take action based on this result. (This is particularly relevant to the Quadratic Penalty Method). Instead, we should just bundle all the relevant information into the object that's returned, which can indicate whether or not the solver method was successful on inspection of an attribute.

Copy link
Collaborator

@samjmolyneux samjmolyneux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@willGraham01 willGraham01 merged commit 9dd7a58 into main Sep 25, 2025
5 checks passed
@willGraham01 willGraham01 deleted the wgraham/sgd-return-nicer-object branch September 25, 2025 08:15
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.

3 participants