Skip to content

Add getLastRunBestChromosome() and release 0.3.0#3

Merged
OscarSotoSanchez merged 1 commit into
mainfrom
feat/last-run-best-chromosome
Jul 19, 2026
Merged

Add getLastRunBestChromosome() and release 0.3.0#3
OscarSotoSanchez merged 1 commit into
mainfrom
feat/last-run-best-chromosome

Conversation

@OscarSotoSanchez

Copy link
Copy Markdown
Member

What

Adds getLastRunBestChromosome() — the historical best solution of a run, which
survives shake/reset, unlike getBestChromosome() (the current-population best
that a later shake/reset may drop). Bumps the version to 0.3.0 for release.

Changes

  • native (brkga_bridge.cpp): new brkga_get_last_status_best_chromosome, copying
    last_status.best_chromosome (the incumbent run() snapshots on every improvement),
    with bounds check + exception guard.
  • Java (BrkgaMpIpr, NativeBrkga): new getLastRunBestChromosome() mirroring the
    getBestChromosome pattern; its fitness equals the AlgorithmStatus.bestFitness that
    run() returns. Clarifies getBestChromosome's javadoc to point here.
  • test (LastRunBestChromosomeTest): throw-before-run, survival across forced
    shake/reset, and fitness matching the run's bestFitness.
  • version: 0.2.0 → 0.3.0 across POMs, examples brkga.version,
    README/GUIDE/JAVA_GUIDE dependency snippets and the native build script; README upgrade
    note that custom native libs must be rebuilt from 0.3.0 for the new symbol.

Notes

The native .so is recompiled from source at build time, so the new symbol ships in the
published artifact. Local build here is blocked by an ancient system g++ (9.4, no
<concepts>); CI (modern g++) is the authoritative build.

Expose the historical best solution of a run, which survives shake/reset,
unlike getBestChromosome() (the current-population best that a later
shake/reset may drop).

- native: brkga_get_last_status_best_chromosome copies last_status.best_chromosome
  (the incumbent run() snapshots on every improvement), with bounds check + guard.
- Java: BrkgaMpIpr.getLastRunBestChromosome() mirrors the getBestChromosome
  pattern via a new NativeBrkga handle; its fitness equals the AlgorithmStatus
  bestFitness that run() returns. Clarify getBestChromosome's javadoc to point here.
- test: LastRunBestChromosomeTest covers throw-before-run, survival across
  forced shake/reset, and fitness matching the run's bestFitness.
- Bump 0.2.0 -> 0.3.0 across POMs, examples brkga.version, README/GUIDE/JAVA_GUIDE
  dependency snippets and the native build script; add a README upgrade note that
  custom native libs must be rebuilt from 0.3.0 for the new symbol.
@OscarSotoSanchez
OscarSotoSanchez merged commit 14fa349 into main Jul 19, 2026
1 check passed
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