- Type Parameters:
T- The type of object used to represent candidate solutions to the problem.
- All Known Implementing Classes:
public interface MutationOperator<T> extends Splittable<MutationOperator<T>>
Implement the MutationOperator interface to implement a mutation operator for use in simulated annealing, and other metaheuristics, that require a way to generate random neighbors of a candidate solution.
If your mutation operator is one in which the inverse operation (i.e., the operation that reverts an object to its previous state from prior to the mutation) can be implemented without substantially affecting the runtime of the mutation itself, then consider implementing the
UndoableMutationOperatorinterface instead, a subinterface of MutationOperator that adds an undo method.
On the other hand, if implementing
UndoableMutationOperator.undo(T)would require significant added cost in either time or memory to the
mutate(T)method, then consider implementing two versions of your mutation operator, one that implements MutationOperator and a second that implements
UndoableMutationOperator. In this way, you can use the first version with metaheuristics that do not utilize the undo method, and the second for those that do.
void mutate(T c)Mutates a candidate solution to a problem, by randomly modifying its state. The mutant that is produced is in the local neighborhood of the original candidate solution.
c- The candidate solution subject to the mutation. This method changes the state of c.