Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added configurable source of randomness #638

Merged
merged 76 commits into from
Jul 27, 2023
Merged

Conversation

cicirello
Copy link
Owner

@cicirello cicirello commented Jun 13, 2023

Summary

Added configurable source of randomness. This includes the following (from the related issue):

  • All operators, etc that require randomness should maintain their own random number generator instance
  • Factory that creates instances of currently configured random number generator
  • Enable configuring the factory with a source of randomness by specifying an instance of a RandomGenerator.SplittableGenerator (split is needed for library's multithreaded functionality
  • Enable configuring by seed
  • Provide ThreadLocal instances for cases where less convenient to manage a PRNG within a component
  • Provide a default source of randomness (fast algorithm... perhaps SplittableRandom... currently ThreadLocalRandom)
  • Replace all calls to methods of ThreadLocalRandom with calls to equivalent methods on operators' own PRNG
  • Replace all calls to static methods of dependency rho-mu's RandomIndexer, RandomSampler, RandomVariates classes to methods equivalent methods on operators' own PRNG
  • Carefully examine all method calls that pass a RandomGenerator
  • All files in list later in PR have been verified, i.e., that check list is entirely checked

Closing Issues

Closes #636

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvements to existing code, such as refactoring or optimizations (non-breaking)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Checklist of files

This is a list of files in the library that might need changes in order for this PR to be ready to merge. It is a list of all Java files in the library that use randomness in some way, generated by a simple text search of import statements and classes used.

  • Configurator.java
  • evo\AbstractRouletteWheelSelection.java
  • evo\AdaptiveGeneration.java
  • evo\AdaptiveMutationOnlyGeneration.java
  • evo\AlwaysMutateGeneration.java
  • evo\EncodingWithParameters.java
  • evo\MutuallyExclusiveGeneration.java
  • evo\NaiveAlwaysMutateGeneration.java
  • evo\NaiveSimpleGeneration.java
  • evo\OnlyMutateGeneration.java
  • evo\RandomSelection.java
  • evo\SimpleGeneration.java
  • evo\StochasticUniversalSampling.java
  • evo\TournamentSelection.java
  • evo\TruncationSelection.java
  • internal\RandomnessFactory.java
  • operators\HybridCrossover.java
  • operators\HybridMutation.java
  • operators\HybridUndoableMutation.java
  • operators\WeightedHybridCrossover.java
  • operators\WeightedHybridMutation.java
  • operators\WeightedHybridUndoableMutation.java
  • operators\bits\BitFlipMutation.java
  • operators\bits\BitVectorInitializer.java
  • operators\bits\DefiniteBitFlipMutation.java
  • operators\bits\KPointCrossover.java
  • operators\bits\SinglePointCrossover.java
  • operators\bits\TwoPointCrossover.java
  • operators\bits\UniformCrossover.java
  • operators\integers\IntegerValueInitializer.java
  • operators\integers\IntegerVectorInitializer.java
  • operators\integers\KPointCrossover.java
  • operators\integers\RandomValueChangeMutation.java
  • operators\integers\SinglePointCrossover.java
  • operators\integers\TwoPointCrossover.java
  • operators\integers\UndoableUniformMutation.java
  • operators\integers\UniformCrossover.java
  • operators\integers\UniformMutation.java
  • operators\permutations\AdjacentSwapMutation.java
  • operators\permutations\BlockInterchangeMutation.java
  • operators\permutations\BlockMoveMutation.java
  • operators\permutations\CycleAlphaMutation.java
  • operators\permutations\CycleCrossover.java
  • operators\permutations\CycleMutation.java
  • operators\permutations\EdgeRecombination.java
  • operators\permutations\EnhancedEdgeRecombination.java
  • operators\permutations\InsertionMutation.java
  • operators\permutations\NonWrappingOrderCrossover.java
  • operators\permutations\OrderCrossover.java
  • operators\permutations\OrderCrossoverTwo.java
  • operators\permutations\PartiallyMatchedCrossover.java
  • operators\permutations\PermutationInitializer.java
  • operators\permutations\PrecedencePreservativeCrossover.java
  • operators\permutations\ReversalMutation.java
  • operators\permutations\RotationMutation.java
  • operators\permutations\ScrambleMutation.java
  • operators\permutations\SwapMutation.java
  • operators\permutations\ThreeOptMutation.java
  • operators\permutations\TwoChangeMutation.java
  • operators\permutations\UndoableScrambleMutation.java
  • operators\permutations\UndoableUniformScrambleMutation.java
  • operators\permutations\UniformOrderBasedCrossover.java
  • operators\permutations\UniformPartiallyMatchedCrossover.java
  • operators\permutations\UniformPrecedencePreservativeCrossover.java
  • operators\permutations\UniformScrambleMutation.java
  • operators\permutations\WindowLimitedBlockMoveMutation.java
  • operators\permutations\WindowLimitedInsertionMutation.java
  • operators\permutations\WindowLimitedReversalMutation.java
  • operators\permutations\WindowLimitedScrambleMutation.java
  • operators\permutations\WindowLimitedSwapMutation.java
  • operators\permutations\WindowLimitedUndoableScrambleMutation.java
  • operators\reals\CauchyMutation.java
  • operators\reals\GaussianMutation.java
  • operators\reals\KPointCrossover.java
  • operators\reals\RealValueInitializer.java
  • operators\reals\RealVectorInitializer.java
  • operators\reals\SinglePointCrossover.java
  • operators\reals\TwoPointCrossover.java
  • operators\reals\UndoableCauchyMutation.java
  • operators\reals\UndoableGaussianMutation.java
  • operators\reals\UndoableUniformMutation.java
  • operators\reals\UniformCrossover.java
  • operators\reals\UniformMutation.java
  • problems\LargestCommonSubgraph.java
  • problems\QuadraticAssignmentProblem.java
  • problems\binpack\BinPacking.java
  • problems\scheduling\CommonDuedateScheduling.java
  • problems\scheduling\WeightedStaticScheduling.java
  • problems\scheduling\WeightedStaticSchedulingWithSetups.java
  • problems\tsp\RandomTSPMatrix.java
  • problems\tsp\TSP.java
  • representations\BitVector.java
  • sa\ExponentialCooling.java
  • sa\LinearCooling.java
  • sa\LogarithmicCooling.java
  • sa\ModifiedLam.java
  • sa\ModifiedLamOriginal.java
  • sa\ParameterFreeExponentialCooling.java
  • sa\ParameterFreeLinearCooling.java
  • sa\SelfTuningLam.java
  • ss\AcceptanceBandSampling.java
  • ss\HeuristicBiasedStochasticSampling.java
  • ss\HybridConstructiveHeuristic.java
  • ss\ValueBiasedStochasticSampling.java

@cicirello cicirello added the enhancement New feature or request label Jun 13, 2023
@cicirello cicirello added this to the chips-n-salsa 6.4.0 milestone Jun 13, 2023
@cicirello cicirello self-assigned this Jun 13, 2023
@cicirello cicirello marked this pull request as draft June 13, 2023 21:39
@github-actions
Copy link
Contributor

JaCoCo Test Coverage Summary Statistics

  • Coverage: 100%
  • Branches: 100%

@github-actions
Copy link
Contributor

JaCoCo Test Coverage Summary Statistics

  • Coverage: 100%
  • Branches: 100%

@github-actions
Copy link
Contributor

JaCoCo Test Coverage Summary Statistics

  • Coverage: 100%
  • Branches: 100%

@github-actions
Copy link
Contributor

JaCoCo Test Coverage Summary Statistics

  • Coverage: 100%
  • Branches: 100%

@github-actions
Copy link
Contributor

JaCoCo Test Coverage Summary Statistics

  • Coverage: 100%
  • Branches: 100%

@github-actions
Copy link
Contributor

JaCoCo Test Coverage Summary Statistics

  • Coverage: 100%
  • Branches: 100%

@github-actions
Copy link
Contributor

JaCoCo Test Coverage Summary Statistics

  • Coverage: 100%
  • Branches: 100%

@github-actions
Copy link
Contributor

JaCoCo Test Coverage Summary Statistics

  • Coverage: 100%
  • Branches: 100%

@github-actions
Copy link
Contributor

JaCoCo Test Coverage Summary Statistics

  • Coverage: 100%
  • Branches: 100%

@github-actions
Copy link
Contributor

JaCoCo Test Coverage Summary Statistics

  • Coverage: 100%
  • Branches: 100%

@github-actions
Copy link
Contributor

JaCoCo Test Coverage Summary Statistics

  • Coverage: 100%
  • Branches: 100%

@github-actions
Copy link
Contributor

JaCoCo Test Coverage Summary Statistics

  • Coverage: 100%
  • Branches: 100%

@github-actions
Copy link
Contributor

JaCoCo Test Coverage Summary Statistics

  • Coverage: 100%
  • Branches: 100%

@github-actions
Copy link
Contributor

JaCoCo Test Coverage Summary Statistics

  • Coverage: 100%
  • Branches: 100%

@github-actions
Copy link
Contributor

JaCoCo Test Coverage Summary Statistics

  • Coverage: 100%
  • Branches: 100%

@github-actions
Copy link
Contributor

JaCoCo Test Coverage Summary Statistics

  • Coverage: 100%
  • Branches: 100%

@github-actions
Copy link
Contributor

JaCoCo Test Coverage Summary Statistics

  • Coverage: 100%
  • Branches: 100%

@github-actions
Copy link
Contributor

JaCoCo Test Coverage Summary Statistics

  • Coverage: 100%
  • Branches: 100%

@github-actions
Copy link
Contributor

JaCoCo Test Coverage Summary Statistics

  • Coverage: 100%
  • Branches: 100%

@cicirello cicirello marked this pull request as ready for review July 27, 2023 18:37
@cicirello cicirello merged commit 4422e4f into master Jul 27, 2023
4 checks passed
@cicirello cicirello deleted the feat-customize-randomness branch July 27, 2023 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

Customizable source of randomness
1 participant