Package net.bmahe.genetics4j.gp
Interface OperationFactory
public interface OperationFactory
Factory interface for creating operations in genetic programming.
An OperationFactory provides a way to create Operation
instances with type information
and context-dependent parameters. Factories are particularly useful when operations need to be
configured based on input specifications or when operations require runtime information.
The factory pattern allows for:
- Dynamic operation creation based on input specifications
- Type-safe operation construction in strongly-typed GP
- Parameterized operations that adapt to problem context
- Lazy evaluation of expensive operation setup
Common use cases include:
- Creating input operations that depend on input variable count
- Building coefficient operations with domain-specific ranges
- Constructing type-specific mathematical operations
- Generating random constants within specified bounds
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionClass[]
Returns the types that operations created by this factory accept as arguments.Creates a new operation instance using the provided input specification.Returns the type that operations created by this factory return.
-
Method Details
-
acceptedTypes
Class[] acceptedTypes()Returns the types that operations created by this factory accept as arguments.This defines the type signature for the operation's arguments and is used for type checking in strongly-typed genetic programming.
- Returns:
- an array of classes representing the accepted argument types
-
returnedType
Class returnedType()Returns the type that operations created by this factory return.- Returns:
- the return type of operations created by this factory
-
build
Creates a new operation instance using the provided input specification.The input specification provides context about the problem domain, such as the number and types of input variables, which can be used to customize the created operation.
- Parameters:
inputSpec
- the input specification providing context for operation creation- Returns:
- a new operation instance configured according to the input specification
-