Skip to content

Conversation

@MarcinStolarczyk01
Copy link
Collaborator

@MarcinStolarczyk01 MarcinStolarczyk01 commented Apr 13, 2025

Add patience parameter to stop optimization after stagnation

Description

This PR extends SolutionUpdater by a "patience" parameter which defines how many iterations with the same best results in a row will stop optimization loop.

How Has This Been Tested?

Describe the tests that you ran to verify your changes. Include details on the testing environment, test cases, and any relevant configurations. If applicable, provide steps to reproduce the testing process.

  • Unit tests
  • Integration tests
  • Manual tests
  • Skip test - Please provide an explanation why you skip tests

We encourage you to keep the code coverage percentage at 90% and above.

  • Yes
  • No, and this is why: please replace this line with details on why tests
    have not been included
  • I need help with writing tests

Testing Environment:

  • Python Version: [3.12]
  • OS: [Ubuntu 22.04]

If your PR includes UI changes or modifications to the command-line interface (CLI), provide before and after screenshots.

Checklist

Ensure that all the following tasks are completed before submitting your PR:

  • Code is formatted and has been linted using 'makefile' run-check option
  • New and existing tests pass locally.
  • All relevant documentation has been updated (e.g., docstrings, README, etc.).
  • Dependencies have been updated, and requirements.txt or pyproject.toml has been updated accordingly.
  • This PR has been reviewed by at least one other developer.

Copy link
Collaborator

@dJaniga dJaniga left a comment

Choose a reason for hiding this comment

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

Thanks Marcin for doing this implementation!
There are some suggestion which in my option will improve code readability and maintenance. Let's have discussion and challenge my point of view :)

Copy link
Collaborator

@dJaniga dJaniga left a comment

Choose a reason for hiding this comment

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

@MarcinStolarczyk01 2 small comments and ready to go :)

Introduced the `patience` parameter in `SolutionUpdaterService` and associated tests to enhance optimization control. Replaced unnecessary convergence check logic and ensured proper comparison handling for `None` values in the optimization loop. This improves flexibility and robustness of the solution updater process.
@MarcinStolarczyk01 MarcinStolarczyk01 merged commit 3590ccf into main Apr 27, 2025
1 check passed
@MarcinStolarczyk01 MarcinStolarczyk01 deleted the feature/add_solution_updater_patience branch April 27, 2025 17:50
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.

Solution updater should terminate when candidates converge to value and stale for P iteration

4 participants