Skip to content

[2] feat: add support for discrete problems#25

Merged
WojtAcht merged 21 commits intomainfrom
2-lons-for-discrete-problems
Mar 22, 2026
Merged

[2] feat: add support for discrete problems#25
WojtAcht merged 21 commits intomainfrom
2-lons-for-discrete-problems

Conversation

@WojtAcht
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings March 14, 2026 19:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds discrete optimization support (problems + Iterated Local Search sampler) alongside a refactor/expansion of continuous basin-hopping sampling, with accompanying tests to validate hashing behavior and function-evaluation counting.

Changes:

  • Introduce a discrete optimization API (DiscreteProblem), bitstring problems (OneMax, NumberPartitioning), and an ILSSampler that produces LON-compatible trace data.
  • Add/expand continuous BasinHoppingSampler implementation (now under lonkit.continuous.sampling) including solution hashing updates and compute_lon.
  • Add tests for discrete problems and continuous hashing + nfev counting; update package exports/import paths.

Reviewed changes

Copilot reviewed 9 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/discrete/test_problems.py Adds unit tests for OneMax and NumberPartitioning behavior.
tests/continuous/test_sampling.py Tests hashing behavior, especially around rounding and -0.0 handling.
tests/continuous/test_nfev.py Verifies nfev tracking via a counting wrapper.
src/lonkit/discrete/sampling.py New ILS sampler + config/result types; emits LON-compatible trace data.
src/lonkit/discrete/problems/problem.py Adds DiscreteProblem ABC (stateless, RNG-injected).
src/lonkit/discrete/problems/bitstring.py Implements bitstring base class + OneMax and NumberPartitioning.
src/lonkit/discrete/problems/init.py Exposes discrete problems API.
src/lonkit/discrete/init.py Exposes discrete public API (problems + ILS sampler).
src/lonkit/continuous/step_size.py Updates import path to the new continuous sampling module.
src/lonkit/continuous/sampling.py Adds/defines basin-hopping sampling, hashing, trace building, and compute_lon.
src/lonkit/continuous/init.py Exposes continuous public API (sampler, step size, compute_lon).
src/lonkit/init.py Re-exports continuous + discrete APIs from top-level package.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/lonkit/discrete/sampling.py
@WojtAcht WojtAcht requested a review from pFornagiel March 15, 2026 07:51
@WojtAcht WojtAcht linked an issue Mar 15, 2026 that may be closed by this pull request
Comment thread src/lonkit/discrete/sampling.py Outdated
Comment thread src/lonkit/discrete/problems/bitstring.py
Comment thread src/lonkit/discrete/problems/bitstring.py
Comment thread src/lonkit/discrete/problems/bitstring.py Outdated
Comment thread docs/user-guide/discrete.md Outdated
Comment thread docs/user-guide/discrete.md
Copy link
Copy Markdown
Collaborator

@pFornagiel pFornagiel left a comment

Choose a reason for hiding this comment

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

Some nitpicks, but otherwise looks good 🚀

Make sure to properly resolve conflicts before merging, though

@WojtAcht WojtAcht merged commit 62e9e3e into main Mar 22, 2026
3 checks passed
@WojtAcht WojtAcht deleted the 2-lons-for-discrete-problems branch March 22, 2026 11:10
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.

Add LONs for discrete problems

3 participants