5.0
View the full changelog here.
Breaking changes:
Type definitions
- The majority of the core library has been modified to accept a generic target type parameter, to allow the target
of the data set to be strongly-typed through the system. Previously, only the program data type and type of program
output was generic. The main benefit of the introduced target type parameter, is to simplify the usage and
implementation of fitness functions.
Modules
ModuleContainer
has been moved to thenz.co.jedsimson.lgp.core.modules
package.- The module resolution functions
instance
andinstanceUnsafe
are no longer the responsibility ofModuleContainer
and have been relocated to theModuleFactory
class.
The intended usage is thatModuleContainer
defines a set ofModuleBuilder
s, and
theModuleFactory
can be used to resolve instances from a givenModuleContainer
.
Environment
- Direct dependency on
Environment
has been removed from all core implementations and is recommended for any custom implementations.
The public contract is now defined inEnvironmentFacade
and this should be the contract relied upon. Environment
can no longer be directly used to resolve dependencies as theregisteredModule
andregisterModuleUnsafe
functions have been removed. Dependencies should be resolved usingEnvironmentFacade.moduleFactory
.
Evolution operators
- The
nz.co.jedsimson.lgp.core.evolution
package was restructured significantly. It is now split up as below:
nz.co.jedsimson.lgp.core.evolution.operators
├── mutation
│ ├── macro
│ ├── micro
│ └── strategy
├── recombination
└── selection
MacroMutationOperator
now accepts an optionalMutationStrategyFactory
which can be used to customise the mutation behaviour.MicroMutationOperator
now accepts an optionalMutationStrategyFactory
which can be used to customise the mutation behaviour.- When no
MutationStrategyFactory
is given to eitherMacroMutationOperator
orMicroMutationOperator
, they will use the default
strategy factory which preserves the previous behaviour of these implementations. The main reason behind this change is internal,
but it can be used externally too.
Program
- The properties
instructions
,registers
, andoutputRegisterIndices
are now abstract properties ofProgram
. - The properties
arity
andfunc
(now renamed tofunction
) are now abstract properties ofOperation
.
Registers
- RegisterSet is now an interface and the implementation has been moved to ArrayRegisterSet.
Miscellaneous
- The built-in Kotlin
Random
is now used instead ofjava.util.Random
. - Moved
Random
extension functionschoice
,randInt
,sample
to thenz.co.jedsimson.lgp.core.environment
package. - Move
MutableList
extension functionslice
into thenz.co.jedsimson.lgp.core.evolution.operators
package. - Moved
Valid
andInvalid
ConfigurationValidity
implementations into the parent class (i.e. no longer accessValid
, instead useConfigurationValidity.Valid
).