Genetic Algorithm Info

Crossover Operators

Mutation Operators

Inversion Mutation Operator

'Default Float 0 is "0.01" and represents Minimum Swath Size. Valid Values are [0, 0.75]
        'Default Float 0 is "0.5" and represents Maximum Swath Size. Valid Values are [0, 0.75]

        'If Swathsize is calculated to be less than 2, it will be raised to 2
        Sub Inversion_Mutation(ByRef child1 As PChromo)
            Dim MaxSwathSizePercent As Double = 0.6
            Dim MinSwatchSizePercent As Double = 0.0

            '1 Determine start and stop of swath
            Dim X, Y As Integer
            Dim SwathSize As Integer = RAND.Next(Inversion_Master.Doubles(0) * AlleleCount, Inversion_Master.Doubles(1) * AlleleCount)
            If SwathSize < 2 Then SwathSize = 2
            X = RAND.Next(0, AlleleCount - SwathSize)
            Y = X + SwathSize - 1

            'Store swath values
            Dim C As New Collection
            For j As Integer = X To Y
                C.Add(child1.Alleles(j))
            Next

            'Put the values back in reverse order
            For j As Integer = Y To X Step -1
                child1.Alleles(j) = C.Item(1)
                C.Remove(1)
            Next
        End Sub