Hi everyone. Once again, i'm here.
What I have is two structures:
Public Structure poblacion
Public ind() As individuo
End Structure
Public Structure individuo
Public pos as List(Of Point)
Public fx As Double
End Structure
There's one point where I need to randomize the order of the numbers of the "pos" list. When I do that, it changes ALL ind() including the one I sent to the subroutine. Here's the sub of the problem:
Public Sub generarPoblacion(ByRef pob As poblacion, ByVal tpob As Integer)
For i = 0 To tpob
generarIndividuo(pob.ind(i).pos, nvars)
Next
End Sub
'I found the next code on internet to reorder the content of an array.
Sub generarIndividuo(ByRef pos As List(Of Point), ByVal nvars As Integer)
Dim rnd As New Random, j As Integer
For i = 0 To nvars
j = rnd.Next(i, nvars)
swapPuntos(pos(i), pos(j))
Next
End Sub
Sub swapPuntos(ByRef punto1 As Point, ByRef punto2 As Point)
Dim temp As Point = punto1
punto1 = punto2
punto2 = temp
End Sub
And here's an screenshot of it affecting all ind:
http://i205.photobucket.com/albums/bb66/pundia/screenshotFALCON.png