Repository navigation
Highlights
This release refines reward scoring, iteration numbering, and statistics, adds
operator names, and removes the public Alns constructors. Results for the same
seed may differ from 0.1.0.
Breaking changes
- Builder only: the public
Alnsconstructors were removed. Use
Alns.builder()to configure a solver. - Iteration numbering: iterations are now numbered from 1, and 0 denotes the
initial solution. Selection, acceptance, and iteration callback contexts all
report the same index for an iteration.StoppingContext.iteration()is
unchanged and still reports the number of completed iterations. - Statistics:
getIterationRuntimesNanos()now starts with a zero entry for the initial
solution, so all histories share the same indexing.- Data getters on disabled statistics now throw
IllegalStateException
instead of returning empty values.
- Final classes:
SimulatedAnnealing,RouletteWheelOperatorSelector,
MaxRuntime, andNoImprovementare nowfinal. Implement the
corresponding interfaces for custom behavior.
Behavior changes
- Reward scoring: accepted candidates that are revisited, or whose objective
equals the current objective, now receive the configured rejected-outcome
score (scores[3]) instead of a hard zero. Results are unchanged when
scores[3]is 0. - Hill climbing:
HillClimbingnow accepts candidates whose objective equals
the current objective. - Infeasible candidates: only feasible solutions must have finite objectives.
Infeasible candidates may return any value, including infinities orNaN, and
are rejected instead of aborting the search.
Added
- Operator names:
addDestroyOperator(String, DestroyOperator)and
addRepairOperator(String, RepairOperator). Unnamed operators default to
destroy-<index>andrepair-<index>. Names must be non-blank and unique
within each group, and appear in logs and in
AlnsStatistics.getDestroyOperatorNames()andgetRepairOperatorNames().
Improved
NoImprovementkeeps only the best objective value instead of copying
solutions.- Javadoc and README were revised for accuracy and consistency.
Migrating from 0.1.0
- Replace
new Alns<>(...)withAlns.builder(). - If your selector or acceptance criterion reads
context.iteration(), the value
is now one higher than in 0.1.0. - When reading runtimes, skip index 0 (the initial solution) for averages.
- Call
statistics.isEnabled()before reading statistics. - Rerun experiments that must be reproducible with 0.1.0 using the 0.1.0 JAR.
Requirements
- Java 17 or later.
org.slf4j:slf4j-api:2.0.20on the classpath. Dependencies are not bundled in
the release JAR.
Requirements are unchanged from 0.1.0.
Downloads
alns-0.2.0.jar: the library.alns-0.2.0-sources.jar: source code.alns-0.2.0-javadoc.jar: API documentation.