Jido.Evolve.Evolvable.Permutation (Jido Evolve v1.0.0)

Copy Markdown View Source

Helper functions for working with permutation genomes.

A permutation is a list of unique integers from 0 to n-1. Used for problems like the Traveling Salesman Problem (TSP) where the order of elements matters and no duplicates are allowed.

Note: Permutations use the existing Jido.Evolve.Evolvable.List protocol implementation. This module provides validation and creation utilities specific to permutations.

Summary

Functions

Creates a new random permutation of length n.

Validates that a list is a valid permutation.

Functions

new(n)

Creates a new random permutation of length n.

valid?(permutation)

Validates that a list is a valid permutation.

Returns true if:

  • All elements are unique
  • All elements are integers from 0 to n-1