Package org.opt4j.benchmarks.queens
Class QueensCopyDecoder
java.lang.Object
org.opt4j.benchmarks.queens.QueensCopyDecoder
- All Implemented Interfaces:
Creator<BooleanGenotype>,Decoder<BooleanGenotype,QueensBoard>
public class QueensCopyDecoder
extends Object
implements Decoder<BooleanGenotype,QueensBoard>, Creator<BooleanGenotype>
A simple decoder strategy. Each field has a binary value that indicates
whether a queen is located on it or not.
The genotype is a
BooleanGenotype of the length size*size.-
Constructor Summary
ConstructorsConstructorDescriptionQueensCopyDecoder(QueensProblem problem, Rand random) Constructs aQueensCopyDecoder. -
Method Summary
Modifier and TypeMethodDescriptioncreate()Creates a randomGenotype.decode(BooleanGenotype vector) Decodes a givenGenotypeto the corresponding phenotype.
-
Constructor Details
-
QueensCopyDecoder
Constructs aQueensCopyDecoder.- Parameters:
problem- the queens problemrandom- the random value generator
-
-
Method Details
-
create
Description copied from interface:CreatorCreates a randomGenotype.- Specified by:
createin interfaceCreator<BooleanGenotype>- Returns:
- the created genotype
-
decode
Description copied from interface:DecoderDecodes a givenGenotypeto the corresponding phenotype.- Specified by:
decodein interfaceDecoder<BooleanGenotype,QueensBoard> - Parameters:
vector- the genotype to decode- Returns:
- the decoded phenotype
-