Petri.Chromosome.Integer (petri v0.2.1)

Copy Markdown View Source

An integer-encoded chromosome with per-gene bounds.

Each gene is an integer clamped to {lo, hi}. Use this when your search space is discrete but not permutation-constrained — integer parameters, byte sequences, categorical indices.

Example

iex> chrom = %Petri.Chromosome.Integer{genes: [3, 7], bounds: [{0, 9}, {0, 9}]}
iex> Petri.Chromosome.length(chrom)
2
iex> Petri.Chromosome.genes(chrom)
[3, 7]
iex> Petri.Chromosome.valid?(chrom)
true

Compatible crossover operators: :blx_alpha, :two_point, :sbx. Compatible mutation operators: :gaussian, :uniform.