Repository navigation
Releases
Releases · nhtc2005/alns-java
v0.2.0
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.
v0.1.0
Highlights
First public release of ALNS, a general-purpose Java implementation of the
Adaptive Large Neighborhood Search metaheuristic for combinatorial
optimization. Provide a solution type, a feasible initial solution, and
problem-specific destroy and repair operators; the library handles the search
loop, operator selection, acceptance, and stopping.
Features
- Search core: objective minimization with feasibility checks. Infeasible
candidates are rejected, and feasible new bests are always kept. - Acceptance criteria: hill climbing and simulated annealing, with linear or
exponential cooling andautofitto derive a schedule from a target
acceptance probability. - Operator selection: uniform random, roulette wheel, and segmented roulette
wheel. - Stopping criteria: maximum iterations, maximum runtime, and no improvement,
combinable withAnyOfStoppingCriterion. - Optional features, all disabled by default:
- local search applied to feasible repaired solutions;
- visited-solution tracking to control operator rewards;
- statistics with objective histories, iteration runtimes, and per-operator
outcome counts; - iteration callbacks.
- Reproducibility: every random choice uses the supplied
RandomGenerator. - Logging through SLF4J.
Requirements
- Java 17 or later.
org.slf4j:slf4j-api:2.0.20on the classpath. Dependencies are not bundled in
the release JAR.
Downloads
alns-0.1.0.jar: the library.alns-0.1.0-sources.jar: source code.alns-0.1.0-javadoc.jar: API documentation.